summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2018-11-16 02:46:20 +0000
committerdjm <djm@openbsd.org>2018-11-16 02:46:20 +0000
commitc32ef45e81585dcf0bddc15dd5ec5d606172fb3a (patch)
treeefe62330e973619b32444830034e68d00255d6d8
parentfix bug in HostbasedAcceptedKeyTypes and PubkeyAcceptedKeyTypes options. (diff)
downloadwireguard-openbsd-c32ef45e81585dcf0bddc15dd5ec5d606172fb3a.tar.xz
wireguard-openbsd-c32ef45e81585dcf0bddc15dd5ec5d606172fb3a.zip
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@
-rw-r--r--usr.bin/ssh/sshconnect2.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/ssh/sshconnect2.c b/usr.bin/ssh/sshconnect2.c
index d5146509990..5d647508c41 100644
--- a/usr.bin/ssh/sshconnect2.c
+++ b/usr.bin/ssh/sshconnect2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshconnect2.c,v 1.288 2018/10/11 03:48:04 djm Exp $ */
+/* $OpenBSD: sshconnect2.c,v 1.289 2018/11/16 02:46:20 djm Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2008 Damien Miller. All rights reserved.
@@ -371,7 +371,6 @@ ssh_userauth2(const char *local_user, const char *server_user, char *host,
/* setup authentication context */
memset(&authctxt, 0, sizeof(authctxt));
- pubkey_prepare(&authctxt);
authctxt.server_user = server_user;
authctxt.local_user = local_user;
authctxt.host = host;
@@ -384,6 +383,7 @@ ssh_userauth2(const char *local_user, const char *server_user, char *host,
authctxt.active_ktype = authctxt.oktypes = authctxt.ktypes = NULL;
authctxt.info_req_seen = 0;
authctxt.agent_fd = -1;
+ pubkey_prepare(&authctxt);
if (authctxt.method == NULL)
fatal("ssh_userauth2: internal error: cannot send userauth none request");
@@ -1612,8 +1612,10 @@ pubkey_cleanup(Authctxt *authctxt)
{
Identity *id;
- if (authctxt->agent_fd != -1)
+ if (authctxt->agent_fd != -1) {
ssh_close_authentication_socket(authctxt->agent_fd);
+ authctxt->agent_fd = -1;
+ }
for (id = TAILQ_FIRST(&authctxt->keys); id;
id = TAILQ_FIRST(&authctxt->keys)) {
TAILQ_REMOVE(&authctxt->keys, id, next);