Blame SOURCES/0021-Fix-race-condition-in-SEC_GetPassword.patch

360211
From a40c584691ae071e93e8adf4e5c05bcd90c68159 Mon Sep 17 00:00:00 2001
360211
From: Julien Cristau <jcristau@debian.org>
360211
Date: Sat, 6 May 2017 22:45:34 +0200
360211
Subject: [PATCH 21/29] Fix race condition in SEC_GetPassword
360211
360211
A side effect of echoOff is to discard unread input, so if we print the
360211
prompt before echoOff, the user (or process) at the other end might
360211
react to it by writing the password in between those steps, which is
360211
then discarded.  This bit me when trying to drive pesign with an expect
360211
script.
360211
360211
Signed-off-by: Julien Cristau <jcristau@debian.org>
360211
---
360211
 src/password.c | 2 +-
360211
 1 file changed, 1 insertion(+), 1 deletion(-)
360211
360211
diff --git a/src/password.c b/src/password.c
360211
index cd1c07e..d4eae0d 100644
360211
--- a/src/password.c
360211
+++ b/src/password.c
360211
@@ -71,9 +71,9 @@ static char *SEC_GetPassword(FILE *input, FILE *output, char *prompt,
360211
     for (;;) {
360211
 	/* Prompt for password */
360211
 	if (isTTY) {
360211
+	    echoOff(infd);
360211
 	    fprintf(output, "%s", prompt);
360211
             fflush (output);
360211
-	    echoOff(infd);
360211
 	}
360211
 
360211
 	fgets ( phrase, sizeof(phrase), input);
360211
-- 
360211
2.13.4
360211