summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2015-07-18 07:57:14 +0000
committerdjm <djm@openbsd.org>2015-07-18 07:57:14 +0000
commit6a0f1cd9bd24cc4b47cdcd14ae92f1e499d8b8f3 (patch)
treebee105d1ac716da904c219e1d1b3637d40efbcff
parentAdd RCS ID. (diff)
downloadwireguard-openbsd-6a0f1cd9bd24cc4b47cdcd14ae92f1e499d8b8f3.tar.xz
wireguard-openbsd-6a0f1cd9bd24cc4b47cdcd14ae92f1e499d8b8f3.zip
only query each keyboard-interactive device once per authentication
request regardless of how many times it is listed; ok markus@
-rw-r--r--usr.bin/ssh/auth2-chall.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.bin/ssh/auth2-chall.c b/usr.bin/ssh/auth2-chall.c
index cb35dbe135c..73dfb42325e 100644
--- a/usr.bin/ssh/auth2-chall.c
+++ b/usr.bin/ssh/auth2-chall.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth2-chall.c,v 1.42 2015/01/19 20:07:45 markus Exp $ */
+/* $OpenBSD: auth2-chall.c,v 1.43 2015/07/18 07:57:14 djm Exp $ */
/*
* Copyright (c) 2001 Markus Friedl. All rights reserved.
* Copyright (c) 2001 Per Allansson. All rights reserved.
@@ -57,6 +57,7 @@ struct KbdintAuthctxt
void *ctxt;
KbdintDevice *device;
u_int nreq;
+ u_int devices_done;
};
static KbdintAuthctxt *
@@ -123,11 +124,15 @@ kbdint_next_device(Authctxt *authctxt, KbdintAuthctxt *kbdintctxt)
if (len == 0)
break;
for (i = 0; devices[i]; i++) {
- if (!auth2_method_allowed(authctxt,
+ if ((kbdintctxt->devices_done & (1 << i)) != 0 ||
+ !auth2_method_allowed(authctxt,
"keyboard-interactive", devices[i]->name))
continue;
- if (strncmp(kbdintctxt->devices, devices[i]->name, len) == 0)
+ if (strncmp(kbdintctxt->devices, devices[i]->name,
+ len) == 0) {
kbdintctxt->device = devices[i];
+ kbdintctxt->devices_done |= 1 << i;
+ }
}
t = kbdintctxt->devices;
kbdintctxt->devices = t[len] ? xstrdup(t+len+1) : NULL;