diff options
Diffstat (limited to 'sshconnect2.c')
-rw-r--r-- | sshconnect2.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/sshconnect2.c b/sshconnect2.c index 36d592b42..1b85730fe 100644 --- a/sshconnect2.c +++ b/sshconnect2.c | |||
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: sshconnect2.c,v 1.118 2003/05/14 02:15:47 markus Exp $"); | 26 | RCSID("$OpenBSD: sshconnect2.c,v 1.119 2003/05/15 00:28:28 markus Exp $"); |
27 | 27 | ||
28 | #ifdef KRB5 | 28 | #ifdef KRB5 |
29 | #include <krb5.h> | 29 | #include <krb5.h> |
@@ -204,7 +204,6 @@ int userauth_kerberos(Authctxt *); | |||
204 | void userauth(Authctxt *, char *); | 204 | void userauth(Authctxt *, char *); |
205 | 205 | ||
206 | static int sign_and_send_pubkey(Authctxt *, Identity *); | 206 | static int sign_and_send_pubkey(Authctxt *, Identity *); |
207 | static void clear_auth_state(Authctxt *); | ||
208 | static void pubkey_prepare(Authctxt *); | 207 | static void pubkey_prepare(Authctxt *); |
209 | static void pubkey_cleanup(Authctxt *); | 208 | static void pubkey_cleanup(Authctxt *); |
210 | static Key *load_identity_file(char *); | 209 | static Key *load_identity_file(char *); |
@@ -299,8 +298,11 @@ ssh_userauth2(const char *local_user, const char *server_user, char *host, | |||
299 | dispatch_run(DISPATCH_BLOCK, &authctxt.success, &authctxt); /* loop until success */ | 298 | dispatch_run(DISPATCH_BLOCK, &authctxt.success, &authctxt); /* loop until success */ |
300 | 299 | ||
301 | pubkey_cleanup(&authctxt); | 300 | pubkey_cleanup(&authctxt); |
301 | dispatch_range(SSH2_MSG_USERAUTH_MIN, SSH2_MSG_USERAUTH_MAX, NULL); | ||
302 | |||
302 | debug("Authentication succeeded (%s).", authctxt.method->name); | 303 | debug("Authentication succeeded (%s).", authctxt.method->name); |
303 | } | 304 | } |
305 | |||
304 | void | 306 | void |
305 | userauth(Authctxt *authctxt, char *authlist) | 307 | userauth(Authctxt *authctxt, char *authlist) |
306 | { | 308 | { |
@@ -316,6 +318,12 @@ userauth(Authctxt *authctxt, char *authlist) | |||
316 | if (method == NULL) | 318 | if (method == NULL) |
317 | fatal("Permission denied (%s).", authlist); | 319 | fatal("Permission denied (%s).", authlist); |
318 | authctxt->method = method; | 320 | authctxt->method = method; |
321 | |||
322 | /* reset the per method handler */ | ||
323 | dispatch_range(SSH2_MSG_USERAUTH_PER_METHOD_MIN, | ||
324 | SSH2_MSG_USERAUTH_PER_METHOD_MAX, NULL); | ||
325 | |||
326 | /* and try new method */ | ||
319 | if (method->userauth(authctxt) != 0) { | 327 | if (method->userauth(authctxt) != 0) { |
320 | debug2("we sent a %s packet, wait for reply", method->name); | 328 | debug2("we sent a %s packet, wait for reply", method->name); |
321 | break; | 329 | break; |
@@ -353,7 +361,6 @@ input_userauth_success(int type, u_int32_t seq, void *ctxt) | |||
353 | fatal("input_userauth_success: no authentication context"); | 361 | fatal("input_userauth_success: no authentication context"); |
354 | if (authctxt->authlist) | 362 | if (authctxt->authlist) |
355 | xfree(authctxt->authlist); | 363 | xfree(authctxt->authlist); |
356 | clear_auth_state(authctxt); | ||
357 | authctxt->success = 1; /* break out */ | 364 | authctxt->success = 1; /* break out */ |
358 | } | 365 | } |
359 | 366 | ||
@@ -375,7 +382,6 @@ input_userauth_failure(int type, u_int32_t seq, void *ctxt) | |||
375 | logit("Authenticated with partial success."); | 382 | logit("Authenticated with partial success."); |
376 | debug("Authentications that can continue: %s", authlist); | 383 | debug("Authentications that can continue: %s", authlist); |
377 | 384 | ||
378 | clear_auth_state(authctxt); | ||
379 | userauth(authctxt, authlist); | 385 | userauth(authctxt, authlist); |
380 | } | 386 | } |
381 | void | 387 | void |
@@ -438,10 +444,6 @@ done: | |||
438 | xfree(pkalg); | 444 | xfree(pkalg); |
439 | xfree(pkblob); | 445 | xfree(pkblob); |
440 | 446 | ||
441 | /* unregister */ | ||
442 | clear_auth_state(authctxt); | ||
443 | dispatch_set(SSH2_MSG_USERAUTH_PK_OK, NULL); | ||
444 | |||
445 | /* try another method if we did not send a packet */ | 447 | /* try another method if we did not send a packet */ |
446 | if (sent == 0) | 448 | if (sent == 0) |
447 | userauth(authctxt, NULL); | 449 | userauth(authctxt, NULL); |
@@ -558,13 +560,6 @@ input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt) | |||
558 | &input_userauth_passwd_changereq); | 560 | &input_userauth_passwd_changereq); |
559 | } | 561 | } |
560 | 562 | ||
561 | static void | ||
562 | clear_auth_state(Authctxt *authctxt) | ||
563 | { | ||
564 | /* XXX clear authentication state */ | ||
565 | dispatch_set(SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ, NULL); | ||
566 | } | ||
567 | |||
568 | static int | 563 | static int |
569 | identity_sign(Identity *id, u_char **sigp, u_int *lenp, | 564 | identity_sign(Identity *id, u_char **sigp, u_int *lenp, |
570 | u_char *data, u_int datalen) | 565 | u_char *data, u_int datalen) |