summaryrefslogtreecommitdiff
path: root/sshconnect2.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2016-12-20 00:22:52 +0000
committerColin Watson <cjwatson@debian.org>2016-12-20 00:22:52 +0000
commit971a7653746a6972b907dfe0ce139c06e4a6f482 (patch)
tree70fb964265d57ae4967be55b75dbb2a122e9b969 /sshconnect2.c
parenta8ed8d256b2e2c05b0c15565a7938028c5192277 (diff)
parent4a354fc231174901f2629437c2a6e924a2dd6772 (diff)
Import openssh_7.4p1.orig.tar.gz
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 fae8b0f2c..103a2b36a 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.
@@ -318,6 +318,7 @@ void userauth(Authctxt *, char *);
318static int sign_and_send_pubkey(Authctxt *, Identity *); 318static int sign_and_send_pubkey(Authctxt *, Identity *);
319static void pubkey_prepare(Authctxt *); 319static void pubkey_prepare(Authctxt *);
320static void pubkey_cleanup(Authctxt *); 320static void pubkey_cleanup(Authctxt *);
321static void pubkey_reset(Authctxt *);
321static Key *load_identity_file(Identity *); 322static Key *load_identity_file(Identity *);
322 323
323static Authmethod *authmethod_get(char *authlist); 324static Authmethod *authmethod_get(char *authlist);
@@ -404,6 +405,8 @@ ssh_userauth2(const char *local_user, const char *server_user, char *host,
404 pubkey_cleanup(&authctxt); 405 pubkey_cleanup(&authctxt);
405 ssh_dispatch_range(ssh, SSH2_MSG_USERAUTH_MIN, SSH2_MSG_USERAUTH_MAX, NULL); 406 ssh_dispatch_range(ssh, SSH2_MSG_USERAUTH_MIN, SSH2_MSG_USERAUTH_MAX, NULL);
406 407
408 if (!authctxt.success)
409 fatal("Authentication failed.");
407 debug("Authentication succeeded (%s).", authctxt.method->name); 410 debug("Authentication succeeded (%s).", authctxt.method->name);
408} 411}
409 412
@@ -558,8 +561,7 @@ input_userauth_failure(int type, u_int32_t seq, void *ctxt)
558 if (partial != 0) { 561 if (partial != 0) {
559 verbose("Authenticated with partial success."); 562 verbose("Authenticated with partial success.");
560 /* reset state */ 563 /* reset state */
561 pubkey_cleanup(authctxt); 564 pubkey_reset(authctxt);
562 pubkey_prepare(authctxt);
563 } 565 }
564 debug("Authentications that can continue: %s", authlist); 566 debug("Authentications that can continue: %s", authlist);
565 567
@@ -1412,6 +1414,15 @@ pubkey_cleanup(Authctxt *authctxt)
1412 } 1414 }
1413} 1415}
1414 1416
1417static void
1418pubkey_reset(Authctxt *authctxt)
1419{
1420 Identity *id;
1421
1422 TAILQ_FOREACH(id, &authctxt->keys, next)
1423 id->tried = 0;
1424}
1425
1415static int 1426static int
1416try_identity(Identity *id) 1427try_identity(Identity *id)
1417{ 1428{
@@ -1460,6 +1471,7 @@ userauth_pubkey(Authctxt *authctxt)
1460 } 1471 }
1461 key_free(id->key); 1472 key_free(id->key);
1462 id->key = NULL; 1473 id->key = NULL;
1474 id->isprivate = 0;
1463 } 1475 }
1464 } 1476 }
1465 if (sent) 1477 if (sent)