mgahagan / rpms / openssh

Forked from rpms/openssh 6 years ago
Clone
88adbf2
From 5b64f85bb811246c59ebab70aed331f26ba37b18 Mon Sep 17 00:00:00 2001
88adbf2
From: "djm@openbsd.org" <djm@openbsd.org>
88adbf2
Date: Sat, 18 Jul 2015 07:57:14 +0000
88adbf2
Subject: upstream commit
88adbf2
88adbf2
only query each keyboard-interactive device once per
88adbf2
 authentication request regardless of how many times it is listed; ok markus@
88adbf2
88adbf2
Upstream-ID: d73fafba6e86030436ff673656ec1f33d9ffeda1
88adbf2
---
88adbf2
 auth2-chall.c | 11 ++++++++---
88adbf2
 1 file changed, 8 insertions(+), 3 deletions(-)
88adbf2
88adbf2
diff --git a/auth2-chall.c b/auth2-chall.c
88adbf2
index ddabe1a..4aff09d 100644
88adbf2
--- a/auth2-chall.c
88adbf2
+++ b/auth2-chall.c
88adbf2
@@ -83,6 +83,7 @@ struct KbdintAuthctxt
88adbf2
 	void *ctxt;
88adbf2
 	KbdintDevice *device;
88adbf2
 	u_int nreq;
88adbf2
+	u_int devices_done;
88adbf2
 };
88adbf2
 
88adbf2
 #ifdef USE_PAM
88adbf2
@@ -169,11 +170,15 @@ kbdint_next_device(Authctxt *authctxt, KbdintAuthctxt *kbdintctxt)
88adbf2
 		if (len == 0)
88adbf2
 			break;
88adbf2
 		for (i = 0; devices[i]; i++) {
88adbf2
-			if (!auth2_method_allowed(authctxt,
88adbf2
+			if ((kbdintctxt->devices_done & (1 << i)) != 0 ||
88adbf2
+			    !auth2_method_allowed(authctxt,
88adbf2
 			    "keyboard-interactive", devices[i]->name))
88adbf2
 				continue;
88adbf2
-			if (strncmp(kbdintctxt->devices, devices[i]->name, len) == 0)
88adbf2
+			if (strncmp(kbdintctxt->devices, devices[i]->name,
88adbf2
+			    len) == 0) {
88adbf2
 				kbdintctxt->device = devices[i];
88adbf2
+				kbdintctxt->devices_done |= 1 << i;
88adbf2
+			}
88adbf2
 		}
88adbf2
 		t = kbdintctxt->devices;
88adbf2
 		kbdintctxt->devices = t[len] ? xstrdup(t+len+1) : NULL;
88adbf2
-- 
88adbf2
cgit v0.11.2
88adbf2
88adbf2