diff options
Diffstat (limited to 'sshconnect2.c')
-rw-r--r-- | sshconnect2.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sshconnect2.c b/sshconnect2.c index 34b9d304e..d534e6190 100644 --- a/sshconnect2.c +++ b/sshconnect2.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshconnect2.c,v 1.247 2016/07/22 05:46:11 dtucker Exp $ */ | 1 | /* $OpenBSD: sshconnect2.c,v 1.251 2016/12/04 23:54:02 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2008 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2008 Damien Miller. All rights reserved. |
@@ -370,6 +370,7 @@ void userauth(Authctxt *, char *); | |||
370 | static int sign_and_send_pubkey(Authctxt *, Identity *); | 370 | static int sign_and_send_pubkey(Authctxt *, Identity *); |
371 | static void pubkey_prepare(Authctxt *); | 371 | static void pubkey_prepare(Authctxt *); |
372 | static void pubkey_cleanup(Authctxt *); | 372 | static void pubkey_cleanup(Authctxt *); |
373 | static void pubkey_reset(Authctxt *); | ||
373 | static Key *load_identity_file(Identity *); | 374 | static Key *load_identity_file(Identity *); |
374 | 375 | ||
375 | static Authmethod *authmethod_get(char *authlist); | 376 | static Authmethod *authmethod_get(char *authlist); |
@@ -461,6 +462,8 @@ ssh_userauth2(const char *local_user, const char *server_user, char *host, | |||
461 | pubkey_cleanup(&authctxt); | 462 | pubkey_cleanup(&authctxt); |
462 | ssh_dispatch_range(ssh, SSH2_MSG_USERAUTH_MIN, SSH2_MSG_USERAUTH_MAX, NULL); | 463 | ssh_dispatch_range(ssh, SSH2_MSG_USERAUTH_MIN, SSH2_MSG_USERAUTH_MAX, NULL); |
463 | 464 | ||
465 | if (!authctxt.success) | ||
466 | fatal("Authentication failed."); | ||
464 | debug("Authentication succeeded (%s).", authctxt.method->name); | 467 | debug("Authentication succeeded (%s).", authctxt.method->name); |
465 | } | 468 | } |
466 | 469 | ||
@@ -615,8 +618,7 @@ input_userauth_failure(int type, u_int32_t seq, void *ctxt) | |||
615 | if (partial != 0) { | 618 | if (partial != 0) { |
616 | verbose("Authenticated with partial success."); | 619 | verbose("Authenticated with partial success."); |
617 | /* reset state */ | 620 | /* reset state */ |
618 | pubkey_cleanup(authctxt); | 621 | pubkey_reset(authctxt); |
619 | pubkey_prepare(authctxt); | ||
620 | } | 622 | } |
621 | debug("Authentications that can continue: %s", authlist); | 623 | debug("Authentications that can continue: %s", authlist); |
622 | 624 | ||
@@ -1526,6 +1528,15 @@ pubkey_cleanup(Authctxt *authctxt) | |||
1526 | } | 1528 | } |
1527 | } | 1529 | } |
1528 | 1530 | ||
1531 | static void | ||
1532 | pubkey_reset(Authctxt *authctxt) | ||
1533 | { | ||
1534 | Identity *id; | ||
1535 | |||
1536 | TAILQ_FOREACH(id, &authctxt->keys, next) | ||
1537 | id->tried = 0; | ||
1538 | } | ||
1539 | |||
1529 | static int | 1540 | static int |
1530 | try_identity(Identity *id) | 1541 | try_identity(Identity *id) |
1531 | { | 1542 | { |
@@ -1574,6 +1585,7 @@ userauth_pubkey(Authctxt *authctxt) | |||
1574 | } | 1585 | } |
1575 | key_free(id->key); | 1586 | key_free(id->key); |
1576 | id->key = NULL; | 1587 | id->key = NULL; |
1588 | id->isprivate = 0; | ||
1577 | } | 1589 | } |
1578 | } | 1590 | } |
1579 | if (sent) | 1591 | if (sent) |