mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
Merge branch '3036_sftp_wrong_password_crash'
* 3036_sftp_wrong_password_crash: Ticket #3036: fix crash after entering a wrong SFTP password.
This commit is contained in:
commit
f3037dbb79
@ -376,7 +376,7 @@ sftpfs_open_connection (struct vfs_s_super *super, GError ** error)
|
||||
*/
|
||||
super_data->socket_handle = sftpfs_open_socket (super, error);
|
||||
if (super_data->socket_handle == -1)
|
||||
goto deinit_by_error;
|
||||
return (-1);
|
||||
|
||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||
* and setup crypto, compression, and MAC layers
|
||||
@ -385,7 +385,7 @@ sftpfs_open_connection (struct vfs_s_super *super, GError ** error)
|
||||
if (rc != 0)
|
||||
{
|
||||
g_set_error (error, MC_ERROR, -1, _("sftp: Failure establishing SSH session: (%d)"), rc);
|
||||
goto deinit_by_error;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* At this point we havn't yet authenticated. The first thing to do
|
||||
@ -400,21 +400,17 @@ sftpfs_open_connection (struct vfs_s_super *super, GError ** error)
|
||||
if (!sftpfs_open_connection_ssh_agent (super, error)
|
||||
&& !sftpfs_open_connection_ssh_key (super, error)
|
||||
&& !sftpfs_open_connection_ssh_password (super, error))
|
||||
goto deinit_by_error;
|
||||
return (-1);
|
||||
|
||||
super_data->sftp_session = libssh2_sftp_init (super_data->session);
|
||||
|
||||
if (super_data->sftp_session == NULL)
|
||||
goto deinit_by_error;
|
||||
return (-1);
|
||||
|
||||
/* Since we have not set non-blocking, tell libssh2 we are blocking */
|
||||
libssh2_session_set_blocking (super_data->session, 1);
|
||||
|
||||
return 0;
|
||||
|
||||
deinit_by_error:
|
||||
sftpfs_close_connection (super, "Shutdown with errors", NULL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -438,6 +434,8 @@ sftpfs_close_connection (struct vfs_s_super *super, const char *shutdown_message
|
||||
return;
|
||||
|
||||
vfs_path_element_free (super_data->original_connection_info);
|
||||
super_data->original_connection_info = NULL;
|
||||
|
||||
if (super_data->agent != NULL)
|
||||
{
|
||||
libssh2_agent_disconnect (super_data->agent);
|
||||
@ -456,8 +454,8 @@ sftpfs_close_connection (struct vfs_s_super *super, const char *shutdown_message
|
||||
libssh2_session_disconnect (super_data->session, shutdown_message);
|
||||
super_data->session = NULL;
|
||||
}
|
||||
if (super_data->fingerprint != NULL)
|
||||
super_data->fingerprint = NULL;
|
||||
|
||||
super_data->fingerprint = NULL;
|
||||
|
||||
if (super_data->socket_handle != -1)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user