GUACAMOLE-222: Merge explicit closing of STFP downloaded files.

This commit is contained in:
James Muehlner 2017-02-26 14:53:38 -08:00
commit c344aa854f

View File

@ -373,8 +373,11 @@ static int guac_common_ssh_sftp_ack_handler(guac_user* user,
} }
/* If bytes could not be read, handle EOF or error condition */
else {
/* If EOF, send end */ /* If EOF, send end */
else if (bytes_read == 0) { if (bytes_read == 0) {
guac_user_log(user, GUAC_LOG_DEBUG, "File sent"); guac_user_log(user, GUAC_LOG_DEBUG, "File sent");
guac_protocol_send_end(user->socket, stream); guac_protocol_send_end(user->socket, stream);
guac_user_free_stream(user, stream); guac_user_free_stream(user, stream);
@ -387,6 +390,14 @@ static int guac_common_ssh_sftp_ack_handler(guac_user* user,
guac_user_free_stream(user, stream); guac_user_free_stream(user, stream);
} }
/* Close file */
if (libssh2_sftp_close(file) == 0)
guac_user_log(user, GUAC_LOG_DEBUG, "File closed");
else
guac_user_log(user, GUAC_LOG_INFO, "Unable to close file");
}
guac_socket_flush(user->socket); guac_socket_flush(user->socket);
} }