From 46ce69a8a9463e5cedb4f2c3cf1525a829438ce3 Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sun, 12 Jul 2015 22:36:08 -0700 Subject: [PATCH] GUAC-1171: Do not attempt to read error strings when there may be no such strings available. --- src/common-ssh/guac_sftp.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/common-ssh/guac_sftp.c b/src/common-ssh/guac_sftp.c index a8e7e060..47fb5c13 100644 --- a/src/common-ssh/guac_sftp.c +++ b/src/common-ssh/guac_sftp.c @@ -246,8 +246,8 @@ int guac_common_ssh_sftp_handle_file_stream(guac_object* filesystem, guac_socket_flush(client->socket); } else { - guac_client_log(client, GUAC_LOG_INFO, "Unable to open file \"%s\": %s", - fullpath, libssh2_sftp_last_error(sftp_data->sftp_session)); + guac_client_log(client, GUAC_LOG_INFO, + "Unable to open file \"%s\"", fullpath); guac_protocol_send_ack(client->socket, stream, "SFTP: Open failed", GUAC_PROTOCOL_STATUS_RESOURCE_NOT_FOUND); guac_socket_flush(client->socket); @@ -350,8 +350,7 @@ guac_stream* guac_common_ssh_sftp_download_file(guac_object* filesystem, LIBSSH2_FXF_READ, 0); if (file == NULL) { guac_client_log(client, GUAC_LOG_INFO, - "Unable to read file \"%s\": %s", - filename, libssh2_sftp_last_error(sftp_data->sftp_session)); + "Unable to read file \"%s\"", filename); return NULL; } @@ -540,8 +539,7 @@ static int guac_common_ssh_sftp_get_handler(guac_client* client, LIBSSH2_SFTP_HANDLE* dir = libssh2_sftp_opendir(sftp, name); if (dir == NULL) { guac_client_log(client, GUAC_LOG_INFO, - "Unable to read directory \"%s\": %s", - name, libssh2_sftp_last_error(sftp)); + "Unable to read directory \"%s\"", name); return 0; } @@ -576,8 +574,7 @@ static int guac_common_ssh_sftp_get_handler(guac_client* client, LIBSSH2_FXF_READ, 0); if (file == NULL) { guac_client_log(client, GUAC_LOG_INFO, - "Unable to read file \"%s\": %s", - name, libssh2_sftp_last_error(sftp)); + "Unable to read file \"%s\"", name); return 0; } @@ -642,8 +639,8 @@ static int guac_common_ssh_sftp_put_handler(guac_client* client, /* Abort on failure */ else { - guac_client_log(client, GUAC_LOG_INFO, "Unable to open file \"%s\": %s", - name, libssh2_sftp_last_error(sftp)); + guac_client_log(client, GUAC_LOG_INFO, + "Unable to open file \"%s\"", name); guac_protocol_send_ack(client->socket, stream, "SFTP: Open failed", GUAC_PROTOCOL_STATUS_RESOURCE_NOT_FOUND); }