diff options
author | Daniel Stenberg <daniel@haxx.se> | 2015-08-02 22:50:31 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2015-08-02 22:50:31 +0200 |
commit | c4eb10e2f06fbd6cc904f1d78e4c7c5cc1afde63 (patch) | |
tree | 392e9e76194a90c1e64cced79bf39366027e68be | |
parent | 3b4ee0d432d4e8e929dcbd564b10e14653896f20 (diff) |
SSH: three state machine fixups
The SSH state machine didn't clear the 'rc' variable appropriately in a
two places which prevented it from looping the way it should. And it
lacked an 'else' statement that made it possible to erroneously get
stuck in the SSH_AUTH_AGENT state.
Reported-by: Tim Stack
Closes #357
-rw-r--r-- | lib/ssh.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -935,6 +935,7 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) } else { state(conn, SSH_AUTH_HOST_INIT); + rc = 0; /* clear rc and continue */ } break; @@ -1019,11 +1020,11 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) sshc->sshagent_identity); if(rc < 0) { - if(rc != LIBSSH2_ERROR_EAGAIN) { + if(rc != LIBSSH2_ERROR_EAGAIN) /* tried and failed? go to next identity */ sshc->sshagent_prev_identity = sshc->sshagent_identity; - } - break; + else + break; } } @@ -1037,8 +1038,10 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block) infof(data, "Agent based authentication successful\n"); state(conn, SSH_AUTH_DONE); } - else + else { state(conn, SSH_AUTH_KEY_INIT); + rc = 0; /* clear rc and continue */ + } #endif break; |