aboutsummaryrefslogtreecommitdiff
path: root/crypto/openssh/auth2-chall.c
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2015-07-28 19:59:22 +0000
committerXin LI <delphij@FreeBSD.org>2015-07-28 19:59:22 +0000
commitb768bf90231687be0e762c2e523a20c0e3cd711d (patch)
tree18ed1d227e1c63142d09c88146f25f9d72967e67 /crypto/openssh/auth2-chall.c
parent2e0ab575832c2ee9daa7b2f1a16a14fc5a61a718 (diff)
Notes
Diffstat (limited to 'crypto/openssh/auth2-chall.c')
-rw-r--r--crypto/openssh/auth2-chall.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/crypto/openssh/auth2-chall.c b/crypto/openssh/auth2-chall.c
index e6dbffe22b91..e5f6d67f5046 100644
--- a/crypto/openssh/auth2-chall.c
+++ b/crypto/openssh/auth2-chall.c
@@ -82,6 +82,7 @@ struct KbdintAuthctxt
void *ctxt;
KbdintDevice *device;
u_int nreq;
+ u_int devices_done;
};
#ifdef USE_PAM
@@ -169,9 +170,14 @@ kbdint_next_device(KbdintAuthctxt *kbdintctxt)
if (len == 0)
break;
- for (i = 0; devices[i]; i++)
- if (strncmp(kbdintctxt->devices, devices[i]->name, len) == 0)
+ for (i = 0; devices[i]; i++) {
+ if ((kbdintctxt->devices_done & (1 << i)) != 0)
+ continue;
+ 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;
xfree(t);