Skip to content

Commit

Permalink
Merge 3b32dc5 into 36f0f47
Browse files Browse the repository at this point in the history
  • Loading branch information
MonkeybreadSoftware committed Apr 16, 2018
2 parents 36f0f47 + 3b32dc5 commit e6c87e6
Showing 1 changed file with 49 additions and 14 deletions.
63 changes: 49 additions & 14 deletions lib/ssh.c
Expand Up @@ -839,7 +839,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
state(conn, SSH_AUTH_DONE);
}
else {
char *err_msg;
char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0);
infof(data, "SSH public key authentication failed: %s\n", err_msg);
Expand Down Expand Up @@ -1046,7 +1046,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
*/
sshc->sftp_session = libssh2_sftp_init(sshc->ssh_session);
if(!sshc->sftp_session) {
char *err_msg;
char *err_msg = NULL;
if(libssh2_session_last_errno(sshc->ssh_session) ==
LIBSSH2_ERROR_EAGAIN) {
rc = LIBSSH2_ERROR_EAGAIN;
Expand Down Expand Up @@ -2276,7 +2276,10 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
if(rc < 0) {
infof(data, "Failed to close libssh2 file\n");
char *err_msg = NULL;
(void)libssh2_session_last_error(
sshc->ssh_session, &err_msg, NULL, 0);
infof(data, "Failed to close libssh2 file: %d %s\n", rc, err_msg);
}
sshc->sftp_handle = NULL;
}
Expand Down Expand Up @@ -2310,7 +2313,10 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
if(rc < 0) {
infof(data, "Failed to close libssh2 file\n");
char *err_msg = NULL;
(void)libssh2_session_last_error(
sshc->ssh_session, &err_msg, NULL, 0);
infof(data, "Failed to close libssh2 file: %d %s\n", rc, err_msg);
}
sshc->sftp_handle = NULL;
}
Expand Down Expand Up @@ -2365,7 +2371,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
data->state.infilesize);
if(!sshc->ssh_channel) {
int ssh_err;
char *err_msg;
char *err_msg = NULL;

if(libssh2_session_last_errno(sshc->ssh_session) ==
LIBSSH2_ERROR_EAGAIN) {
Expand Down Expand Up @@ -2438,7 +2444,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)

if(!sshc->ssh_channel) {
int ssh_err;
char *err_msg;
char *err_msg = NULL;

if(libssh2_session_last_errno(sshc->ssh_session) ==
LIBSSH2_ERROR_EAGAIN) {
Expand Down Expand Up @@ -2491,7 +2497,11 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
if(rc) {
infof(data, "Failed to send libssh2 channel EOF\n");
char *err_msg = NULL;
(void)libssh2_session_last_error(
sshc->ssh_session, &err_msg, NULL, 0);
infof(data, "Failed to send libssh2 channel EOF: %d %s\n",
rc, err_msg);
}
}
state(conn, SSH_SCP_WAIT_EOF);
Expand All @@ -2504,7 +2514,10 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
if(rc) {
infof(data, "Failed to get channel EOF: %d\n", rc);
char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0);
infof(data, "Failed to get channel EOF: %d %s\n", rc, err_msg);
}
}
state(conn, SSH_SCP_WAIT_CLOSE);
Expand All @@ -2517,7 +2530,10 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
if(rc) {
infof(data, "Channel failed to close: %d\n", rc);
char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0);
infof(data, "Channel failed to close: %d %s\n", rc, err_msg);
}
}
state(conn, SSH_SCP_CHANNEL_FREE);
Expand All @@ -2530,7 +2546,11 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
if(rc < 0) {
infof(data, "Failed to free libssh2 scp subsystem\n");
char *err_msg = NULL;
(void)libssh2_session_last_error(
sshc->ssh_session, &err_msg, NULL, 0);
infof(data, "Failed to free libssh2 scp subsystem: %d %s\n",
rc, err_msg);
}
sshc->ssh_channel = NULL;
}
Expand All @@ -2552,7 +2572,11 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
if(rc < 0) {
infof(data, "Failed to free libssh2 scp subsystem\n");
char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0);
infof(data, "Failed to free libssh2 scp subsystem: %d %s\n",
rc, err_msg);
}
sshc->ssh_channel = NULL;
}
Expand All @@ -2563,7 +2587,11 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
if(rc < 0) {
infof(data, "Failed to disconnect libssh2 session\n");
char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0);
infof(data, "Failed to disconnect libssh2 session: %d %s\n",
rc, err_msg);
}
}

Expand All @@ -2588,7 +2616,11 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
if(rc < 0) {
infof(data, "Failed to disconnect from libssh2 agent\n");
char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0);
infof(data, "Failed to disconnect from libssh2 agent: %d %s\n",
rc, err_msg);
}
libssh2_agent_free(sshc->ssh_agent);
sshc->ssh_agent = NULL;
Expand All @@ -2606,7 +2638,10 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
break;
}
if(rc < 0) {
infof(data, "Failed to free libssh2 session\n");
char *err_msg = NULL;
(void)libssh2_session_last_error(sshc->ssh_session,
&err_msg, NULL, 0);
infof(data, "Failed to free libssh2 session: %d %s\n", rc, err_msg);
}
sshc->ssh_session = NULL;
}
Expand Down

0 comments on commit e6c87e6

Please sign in to comment.