aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2014-03-13 02:59:24 +0100
committerDan Fandrich <dan@coneharvesters.com>2014-03-14 23:37:59 +0100
commit8c4d6ceec0fe38ec330b14a60fc346e16118c0e8 (patch)
tree8b09a6774e29fcd786ebf7262b5df123ba109731
parent891ef341b329ab01f27d2375157de662ec1eb9b8 (diff)
ssh: abort immediately on a header callback error
-rw-r--r--lib/ssh.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/ssh.c b/lib/ssh.c
index ac4409401..ea81a65dc 100644
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -1196,7 +1196,13 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
using ordinary FTP. */
result = Curl_client_write(conn, CLIENTWRITE_HEADER, tmp, strlen(tmp));
free(tmp);
- state(conn, SSH_SFTP_NEXT_QUOTE);
+ if(result) {
+ state(conn, SSH_SFTP_CLOSE);
+ sshc->nextstate = SSH_NO_STATE;
+ sshc->actualcode = result;
+ }
+ else
+ state(conn, SSH_SFTP_NEXT_QUOTE);
break;
}
else if(cmd) {
@@ -2171,6 +2177,8 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
conn->cselect_bits = CURL_CSELECT_IN;
}
if(result) {
+ /* this should never occur; the close state should be entered
+ at the time the error occurs */
state(conn, SSH_SFTP_CLOSE);
sshc->actualcode = result;
}