mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-12-09 15:41:10 +03:00
sftp.c: call ssh_set_error
Since sftp_init() returns 0 on success, < 0 on error with ssh error set. This change sets the appropriate ssh error when the SSH_FXP_VERSION packet cannot be unpacked and sftp_init() return with -1. Signed-off-by: Ajit Singh <ajeetsinghchahar2@gmail.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
@@ -464,7 +464,10 @@ int sftp_init(sftp_session sftp)
|
|||||||
|
|
||||||
/* TODO: are we sure there are 4 bytes ready? */
|
/* TODO: are we sure there are 4 bytes ready? */
|
||||||
rc = ssh_buffer_unpack(packet->payload, "d", &version);
|
rc = ssh_buffer_unpack(packet->payload, "d", &version);
|
||||||
if (rc != SSH_OK){
|
if (rc != SSH_OK) {
|
||||||
|
ssh_set_error(sftp->session,
|
||||||
|
SSH_FATAL,
|
||||||
|
"Unable to unpack SSH_FXP_VERSION packet");
|
||||||
sftp_set_error(sftp, SSH_FX_FAILURE);
|
sftp_set_error(sftp, SSH_FX_FAILURE);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user