aboutsummaryrefslogtreecommitdiff
path: root/crypto/openssh/auth1.c
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2003-03-31 13:45:36 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2003-03-31 13:45:36 +0000
commitfc0824d97d17d840792cfda31dc58891c4c41389 (patch)
tree5c905c6c4267e057178b82179f25046713e54de9 /crypto/openssh/auth1.c
parenteffd19ed24e81d73e1ddcc812a563537d8730a25 (diff)
downloadsrc-fc0824d97d17d840792cfda31dc58891c4c41389.tar.gz
src-fc0824d97d17d840792cfda31dc58891c4c41389.zip
If an ssh1 client initiated challenge-response authentication but did
not respond to challenge, and later successfully authenticated itself using another method, the kbdint context would never be released, leaving the PAM child process behind even after the connection ended. Fix this by automatically releasing the kbdint context if a packet of type SSH_CMSG_AUTH_TIS is follwed by anything but a packet of type SSH_CMSG_AUTH_TIS_RESPONSE. MFC after: 1 week
Notes
Notes: svn path=/head/; revision=112870
Diffstat (limited to 'crypto/openssh/auth1.c')
-rw-r--r--crypto/openssh/auth1.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/crypto/openssh/auth1.c b/crypto/openssh/auth1.c
index f88dcc9aec5b..a13f61011abb 100644
--- a/crypto/openssh/auth1.c
+++ b/crypto/openssh/auth1.c
@@ -74,7 +74,7 @@ do_authloop(Authctxt *authctxt)
char info[1024];
u_int dlen;
u_int ulen;
- int type = 0;
+ int prev, type = 0;
struct passwd *pw = authctxt->pw;
debug("Attempting authentication for %s%.100s.",
@@ -104,8 +104,20 @@ do_authloop(Authctxt *authctxt)
info[0] = '\0';
/* Get a packet from the client. */
+ prev = type;
type = packet_read();
+ /*
+ * If we started challenge-response authentication but the
+ * next packet is not a response to our challenge, release
+ * the resources allocated by get_challenge() (which would
+ * normally have been released by verify_response() had we
+ * received such a response)
+ */
+ if (prev == SSH_CMSG_AUTH_TIS &&
+ type != SSH_CMSG_AUTH_TIS_RESPONSE)
+ abandon_challenge_response(authctxt);
+
/* Process the packet. */
switch (type) {