summaryrefslogtreecommitdiff
path: root/sshconnect2.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2018-11-16 02:46:20 +0000
committerDamien Miller <djm@mindrot.org>2018-11-16 13:52:18 +1100
commitaaed635e3a401cfcc4cc97f33788179c458901c3 (patch)
tree6d670ffe6939d1041fda8ec60eb3eeb671052337 /sshconnect2.c
parente76135e3007f1564427b2956c628923d8dc2f75a (diff)
upstream: fix bug in client that was keeping a redundant ssh-agent
socket around for the life of the connection; bz#2912; reported by Simon Tatham; ok dtucker@ OpenBSD-Commit-ID: 4ded588301183d343dce3e8c5fc1398e35058478
Diffstat (limited to 'sshconnect2.c')
-rw-r--r--sshconnect2.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sshconnect2.c b/sshconnect2.c
index 1675f3935..cf60c7d43 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshconnect2.c,v 1.288 2018/10/11 03:48:04 djm Exp $ */ 1/* $OpenBSD: sshconnect2.c,v 1.289 2018/11/16 02:46:20 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.
@@ -379,7 +379,6 @@ ssh_userauth2(const char *local_user, const char *server_user, char *host,
379 379
380 /* setup authentication context */ 380 /* setup authentication context */
381 memset(&authctxt, 0, sizeof(authctxt)); 381 memset(&authctxt, 0, sizeof(authctxt));
382 pubkey_prepare(&authctxt);
383 authctxt.server_user = server_user; 382 authctxt.server_user = server_user;
384 authctxt.local_user = local_user; 383 authctxt.local_user = local_user;
385 authctxt.host = host; 384 authctxt.host = host;
@@ -392,6 +391,7 @@ ssh_userauth2(const char *local_user, const char *server_user, char *host,
392 authctxt.active_ktype = authctxt.oktypes = authctxt.ktypes = NULL; 391 authctxt.active_ktype = authctxt.oktypes = authctxt.ktypes = NULL;
393 authctxt.info_req_seen = 0; 392 authctxt.info_req_seen = 0;
394 authctxt.agent_fd = -1; 393 authctxt.agent_fd = -1;
394 pubkey_prepare(&authctxt);
395 if (authctxt.method == NULL) 395 if (authctxt.method == NULL)
396 fatal("ssh_userauth2: internal error: cannot send userauth none request"); 396 fatal("ssh_userauth2: internal error: cannot send userauth none request");
397 397
@@ -1620,8 +1620,10 @@ pubkey_cleanup(Authctxt *authctxt)
1620{ 1620{
1621 Identity *id; 1621 Identity *id;
1622 1622
1623 if (authctxt->agent_fd != -1) 1623 if (authctxt->agent_fd != -1) {
1624 ssh_close_authentication_socket(authctxt->agent_fd); 1624 ssh_close_authentication_socket(authctxt->agent_fd);
1625 authctxt->agent_fd = -1;
1626 }
1625 for (id = TAILQ_FIRST(&authctxt->keys); id; 1627 for (id = TAILQ_FIRST(&authctxt->keys); id;
1626 id = TAILQ_FIRST(&authctxt->keys)) { 1628 id = TAILQ_FIRST(&authctxt->keys)) {
1627 TAILQ_REMOVE(&authctxt->keys, id, next); 1629 TAILQ_REMOVE(&authctxt->keys, id, next);