summaryrefslogtreecommitdiff
path: root/auth2-hostbased.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2018-07-31 03:10:27 +0000
committerColin Watson <cjwatson@debian.org>2018-08-17 12:29:54 +0100
commitc4ca1497658e0508e8595ad74978c07bc92a18e3 (patch)
tree5fa70ab6ec0dab7dbda6f686afa8e3321f0114df /auth2-hostbased.c
parent60256f28189c3d0650a78e737eb0ca4753478a4b (diff)
upstream: delay bailout for invalid authenticating user
... until after the packet containing the request has been fully parsed. Reported by Dariusz Tytko and MichaƂ Sajdak; ok deraadt OpenBSD-Commit-ID: b4891882fbe413f230fe8ac8a37349b03bd0b70d Origin: backport, http://anongit.mindrot.org/openssh.git/commit/?id=74287f5df9966a0648b4a68417451dd18f079ab8 Bug-Debian: https://bugs.debian.org/906236 Last-Update: 2018-08-17 Patch-Name: upstream-delay-bailout-for-invalid-authenticating-user.patch
Diffstat (limited to 'auth2-hostbased.c')
-rw-r--r--auth2-hostbased.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/auth2-hostbased.c b/auth2-hostbased.c
index 8996f7e05..82a7dcdae 100644
--- a/auth2-hostbased.c
+++ b/auth2-hostbased.c
@@ -67,10 +67,6 @@ userauth_hostbased(struct ssh *ssh)
67 size_t alen, blen, slen; 67 size_t alen, blen, slen;
68 int r, pktype, authenticated = 0; 68 int r, pktype, authenticated = 0;
69 69
70 if (!authctxt->valid) {
71 debug2("%s: disabled because of invalid user", __func__);
72 return 0;
73 }
74 /* XXX use sshkey_froms() */ 70 /* XXX use sshkey_froms() */
75 if ((r = sshpkt_get_cstring(ssh, &pkalg, &alen)) != 0 || 71 if ((r = sshpkt_get_cstring(ssh, &pkalg, &alen)) != 0 ||
76 (r = sshpkt_get_string(ssh, &pkblob, &blen)) != 0 || 72 (r = sshpkt_get_string(ssh, &pkblob, &blen)) != 0 ||
@@ -118,6 +114,11 @@ userauth_hostbased(struct ssh *ssh)
118 goto done; 114 goto done;
119 } 115 }
120 116
117 if (!authctxt->valid || authctxt->user == NULL) {
118 debug2("%s: disabled because of invalid user", __func__);
119 goto done;
120 }
121
121 if ((b = sshbuf_new()) == NULL) 122 if ((b = sshbuf_new()) == NULL)
122 fatal("%s: sshbuf_new failed", __func__); 123 fatal("%s: sshbuf_new failed", __func__);
123 /* reconstruct packet */ 124 /* reconstruct packet */