summaryrefslogtreecommitdiff
path: root/auth2-hostbased.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2018-07-31 03:10:27 +0000
committerDamien Miller <djm@mindrot.org>2018-07-31 13:13:26 +1000
commit74287f5df9966a0648b4a68417451dd18f079ab8 (patch)
treed65deaf7d3ef15405cf8bdbffc9d96b88341a314 /auth2-hostbased.c
parent1a66079c0669813306cc69e5776a4acd9fb49015 (diff)
upstream: delay bailout for invalid authentic
=?UTF-8?q?ating=20user=20until=20after=20the=20packet=20containing=20the?= =?UTF-8?q?=20request=20has=20been=20fully=20parsed.=20Reported=20by=20Dar?= =?UTF-8?q?iusz=20Tytko=20and=20Micha=C5=82=20Sajdak;=20ok=20deraadt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OpenBSD-Commit-ID: b4891882fbe413f230fe8ac8a37349b03bd0b70d
Diffstat (limited to 'auth2-hostbased.c')
-rw-r--r--auth2-hostbased.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/auth2-hostbased.c b/auth2-hostbased.c
index 60159a56c..359393291 100644
--- a/auth2-hostbased.c
+++ b/auth2-hostbased.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth2-hostbased.c,v 1.35 2018/07/09 21:35:50 markus Exp $ */ 1/* $OpenBSD: auth2-hostbased.c,v 1.36 2018/07/31 03:10:27 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000 Markus Friedl. All rights reserved.
4 * 4 *
@@ -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 ||
@@ -117,6 +113,11 @@ userauth_hostbased(struct ssh *ssh)
117 goto done; 113 goto done;
118 } 114 }
119 115
116 if (!authctxt->valid || authctxt->user == NULL) {
117 debug2("%s: disabled because of invalid user", __func__);
118 goto done;
119 }
120
120 if ((b = sshbuf_new()) == NULL) 121 if ((b = sshbuf_new()) == NULL)
121 fatal("%s: sshbuf_new failed", __func__); 122 fatal("%s: sshbuf_new failed", __func__);
122 /* reconstruct packet */ 123 /* reconstruct packet */