summaryrefslogtreecommitdiff
path: root/sshconnect2.c
diff options
context:
space:
mode:
Diffstat (limited to 'sshconnect2.c')
-rw-r--r--sshconnect2.c18
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 *);
370static int sign_and_send_pubkey(Authctxt *, Identity *); 370static int sign_and_send_pubkey(Authctxt *, Identity *);
371static void pubkey_prepare(Authctxt *); 371static void pubkey_prepare(Authctxt *);
372static void pubkey_cleanup(Authctxt *); 372static void pubkey_cleanup(Authctxt *);
373static void pubkey_reset(Authctxt *);
373static Key *load_identity_file(Identity *); 374static Key *load_identity_file(Identity *);
374 375
375static Authmethod *authmethod_get(char *authlist); 376static 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
1531static void
1532pubkey_reset(Authctxt *authctxt)
1533{
1534 Identity *id;
1535
1536 TAILQ_FOREACH(id, &authctxt->keys, next)
1537 id->tried = 0;
1538}
1539
1529static int 1540static int
1530try_identity(Identity *id) 1541try_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)