diff options
author | Colin Watson <cjwatson@debian.org> | 2016-12-20 00:22:52 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2016-12-20 00:22:52 +0000 |
commit | 971a7653746a6972b907dfe0ce139c06e4a6f482 (patch) | |
tree | 70fb964265d57ae4967be55b75dbb2a122e9b969 /sshconnect2.c | |
parent | a8ed8d256b2e2c05b0c15565a7938028c5192277 (diff) | |
parent | 4a354fc231174901f2629437c2a6e924a2dd6772 (diff) |
Import openssh_7.4p1.orig.tar.gz
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 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 *); | |||
318 | static int sign_and_send_pubkey(Authctxt *, Identity *); | 318 | static int sign_and_send_pubkey(Authctxt *, Identity *); |
319 | static void pubkey_prepare(Authctxt *); | 319 | static void pubkey_prepare(Authctxt *); |
320 | static void pubkey_cleanup(Authctxt *); | 320 | static void pubkey_cleanup(Authctxt *); |
321 | static void pubkey_reset(Authctxt *); | ||
321 | static Key *load_identity_file(Identity *); | 322 | static Key *load_identity_file(Identity *); |
322 | 323 | ||
323 | static Authmethod *authmethod_get(char *authlist); | 324 | static 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 | ||
1417 | static void | ||
1418 | pubkey_reset(Authctxt *authctxt) | ||
1419 | { | ||
1420 | Identity *id; | ||
1421 | |||
1422 | TAILQ_FOREACH(id, &authctxt->keys, next) | ||
1423 | id->tried = 0; | ||
1424 | } | ||
1425 | |||
1415 | static int | 1426 | static int |
1416 | try_identity(Identity *id) | 1427 | try_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) |