Github user mike-jumper commented on a diff in the pull request:
https://github.com/apache/incubator-guacamole-server/pull/11#discussion_r71967184
--- Diff: src/protocols/rdp/rdp.c ---
@@ -1003,36 +1003,27 @@ void* guac_rdp_client_thread(void* data) {
/* Attempt SSH connection */
rdp_client->sftp_session =
guac_common_ssh_create_session(client, settings->sftp_hostname,
- settings->sftp_port, rdp_client->sftp_user);
-
- /* Fail if SSH connection does not succeed */
- if (rdp_client->sftp_session == NULL) {
- /* Already aborted within guac_common_ssh_create_session() */
- guac_common_ssh_destroy_user(rdp_client->sftp_user);
- return NULL;
- }
-
- /* Load and expose filesystem */
- rdp_client->sftp_filesystem =
- guac_common_ssh_create_sftp_filesystem(
- rdp_client->sftp_session, "/");
-
- /* Expose filesystem to connection owner */
- guac_client_for_owner(client,
- guac_common_ssh_expose_sftp_filesystem,
- rdp_client->sftp_filesystem);
-
- /* Abort if SFTP connection fails */
- if (rdp_client->sftp_filesystem == NULL) {
- guac_common_ssh_destroy_session(rdp_client->sftp_session);
- guac_common_ssh_destroy_user(rdp_client->sftp_user);
- guac_client_abort(client, GUAC_PROTOCOL_STATUS_UPSTREAM_ERROR,
- "SFTP connection failed.");
- return NULL;
+ settings->sftp_port, rdp_client->sftp_user, 0);
+
+ /* Try to initialize SFTP if connection succeeded */
+ if (rdp_client->sftp_session != NULL) {
+ /* Load filesystem */
+ rdp_client->sftp_filesystem =
+ guac_common_ssh_create_sftp_filesystem(
+ rdp_client->sftp_session, "/");
+
+ /* Expose filesystem to connection owner */
+ guac_client_for_owner(client,
+ guac_common_ssh_expose_sftp_filesystem,
+ rdp_client->sftp_filesystem);
+
+ /* Verify that SFTP connection succeeded */
+ if (rdp_client->sftp_filesystem != NULL) {
+ guac_client_log(client, GUAC_LOG_DEBUG,
+ "SFTP connection succeeded.");
+ }
}
--- End diff --
I think you've accidentally killed the required calls to
`guac_common_ssh_destroy_user()`, as well as the other cleanup in the case that
the filesystem object creation fails, etc.
If the session fails to start, the user object will be leaked. If the
filesystem fails, the user and session objects will be leaked.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---