diff --git a/crypto/external/bsd/openssh/dist/auth2-chall.c b/crypto/external/bsd/openssh/dist/auth2-chall.c index 40debf50ded3..888e6100332e 100644 --- a/crypto/external/bsd/openssh/dist/auth2-chall.c +++ b/crypto/external/bsd/openssh/dist/auth2-chall.c @@ -1,4 +1,4 @@ -/* $NetBSD: auth2-chall.c,v 1.7 2015/04/03 23:58:19 christos Exp $ */ +/* $NetBSD: auth2-chall.c,v 1.8 2015/07/29 15:04:40 christos Exp $ */ /* $OpenBSD: auth2-chall.c,v 1.42 2015/01/19 20:07:45 markus Exp $ */ /* * Copyright (c) 2001 Markus Friedl. All rights reserved. @@ -26,7 +26,7 @@ */ #include "includes.h" -__RCSID("$NetBSD: auth2-chall.c,v 1.7 2015/04/03 23:58:19 christos Exp $"); +__RCSID("$NetBSD: auth2-chall.c,v 1.8 2015/07/29 15:04:40 christos Exp $"); #include #include @@ -83,6 +83,7 @@ struct KbdintAuthctxt void *ctxt; KbdintDevice *device; u_int nreq; + u_int devices_done; }; #ifdef USE_PAM @@ -170,11 +171,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;