GUAC-1171: Do not attempt to read error strings when there may be no such strings available.

This commit is contained in:
Michael Jumper 2015-07-12 22:36:08 -07:00
parent 4d941545cd
commit 46ce69a8a9

View File

@ -246,8 +246,8 @@ int guac_common_ssh_sftp_handle_file_stream(guac_object* filesystem,
guac_socket_flush(client->socket); guac_socket_flush(client->socket);
} }
else { else {
guac_client_log(client, GUAC_LOG_INFO, "Unable to open file \"%s\": %s", guac_client_log(client, GUAC_LOG_INFO,
fullpath, libssh2_sftp_last_error(sftp_data->sftp_session)); "Unable to open file \"%s\"", fullpath);
guac_protocol_send_ack(client->socket, stream, "SFTP: Open failed", guac_protocol_send_ack(client->socket, stream, "SFTP: Open failed",
GUAC_PROTOCOL_STATUS_RESOURCE_NOT_FOUND); GUAC_PROTOCOL_STATUS_RESOURCE_NOT_FOUND);
guac_socket_flush(client->socket); guac_socket_flush(client->socket);
@ -350,8 +350,7 @@ guac_stream* guac_common_ssh_sftp_download_file(guac_object* filesystem,
LIBSSH2_FXF_READ, 0); LIBSSH2_FXF_READ, 0);
if (file == NULL) { if (file == NULL) {
guac_client_log(client, GUAC_LOG_INFO, guac_client_log(client, GUAC_LOG_INFO,
"Unable to read file \"%s\": %s", "Unable to read file \"%s\"", filename);
filename, libssh2_sftp_last_error(sftp_data->sftp_session));
return NULL; 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); LIBSSH2_SFTP_HANDLE* dir = libssh2_sftp_opendir(sftp, name);
if (dir == NULL) { if (dir == NULL) {
guac_client_log(client, GUAC_LOG_INFO, guac_client_log(client, GUAC_LOG_INFO,
"Unable to read directory \"%s\": %s", "Unable to read directory \"%s\"", name);
name, libssh2_sftp_last_error(sftp));
return 0; return 0;
} }
@ -576,8 +574,7 @@ static int guac_common_ssh_sftp_get_handler(guac_client* client,
LIBSSH2_FXF_READ, 0); LIBSSH2_FXF_READ, 0);
if (file == NULL) { if (file == NULL) {
guac_client_log(client, GUAC_LOG_INFO, guac_client_log(client, GUAC_LOG_INFO,
"Unable to read file \"%s\": %s", "Unable to read file \"%s\"", name);
name, libssh2_sftp_last_error(sftp));
return 0; return 0;
} }
@ -642,8 +639,8 @@ static int guac_common_ssh_sftp_put_handler(guac_client* client,
/* Abort on failure */ /* Abort on failure */
else { else {
guac_client_log(client, GUAC_LOG_INFO, "Unable to open file \"%s\": %s", guac_client_log(client, GUAC_LOG_INFO,
name, libssh2_sftp_last_error(sftp)); "Unable to open file \"%s\"", name);
guac_protocol_send_ack(client->socket, stream, "SFTP: Open failed", guac_protocol_send_ack(client->socket, stream, "SFTP: Open failed",
GUAC_PROTOCOL_STATUS_RESOURCE_NOT_FOUND); GUAC_PROTOCOL_STATUS_RESOURCE_NOT_FOUND);
} }