sftp: Do not fail if the status message does not contain error message

Some SFTP servers (Cisco) do not implement the v3 protocol correctly and do not
send the mandatory part of the status message. This falls back to the v2
behavior when the error message and language tag are not provided.

Fixes: #272

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Sahana Prasad <sahana@redhat.com>
(cherry picked from commit 0306581f1c)
This commit is contained in:
Jakub Jelen
2024-09-03 10:43:07 +02:00
parent 1eff5d68f4
commit 827c24055f

View File

@@ -894,12 +894,8 @@ sftp_status_message parse_status_msg(sftp_message msg)
&status->langmsg);
if (rc != SSH_OK && msg->sftp->version >= 3) {
/* These are mandatory from version 3 */
SAFE_FREE(status);
ssh_set_error(msg->sftp->session, SSH_FATAL,
"Invalid SSH_FXP_STATUS message");
sftp_set_error(msg->sftp, SSH_FX_FAILURE);
return NULL;
SSH_LOG(SSH_LOG_WARN,
"Invalid SSH_FXP_STATUS message. Missing error message.");
}
if (status->errormsg == NULL)