svn commit: r367832 - in head/contrib/openpam: . lib/libpam

Dag-Erling Smørgrav des at FreeBSD.org
Thu Nov 19 05:47:00 UTC 2020


Author: des
Date: Thu Nov 19 05:46:59 2020
New Revision: 367832
URL: https://svnweb.freebsd.org/changeset/base/367832

Log:
  Merge upstream r948: fix race condition in openpam_ttyconv(3).

Modified:
  head/contrib/openpam/CREDITS
  head/contrib/openpam/lib/libpam/openpam_ttyconv.c
Directory Properties:
  head/contrib/openpam/   (props changed)

Modified: head/contrib/openpam/CREDITS
==============================================================================
--- head/contrib/openpam/CREDITS	Thu Nov 19 05:44:41 2020	(r367831)
+++ head/contrib/openpam/CREDITS	Thu Nov 19 05:46:59 2020	(r367832)
@@ -18,6 +18,7 @@ ideas:
 	Ankita Pal <pal.ankita.ankita at gmail.com>
 	Baptiste Daroussin <bapt at freebsd.org>
 	Brian Fundakowski Feldman <green at freebsd.org>
+	Brooks Davis <brooks at freebsd.org>
 	Christos Zoulas <christos at netbsd.org>
 	Daniel Richard G. <skunk at iskunk.org>
 	Darren J. Moffat <darren.moffat at sun.com>

Modified: head/contrib/openpam/lib/libpam/openpam_ttyconv.c
==============================================================================
--- head/contrib/openpam/lib/libpam/openpam_ttyconv.c	Thu Nov 19 05:44:41 2020	(r367831)
+++ head/contrib/openpam/lib/libpam/openpam_ttyconv.c	Thu Nov 19 05:46:59 2020	(r367832)
@@ -94,12 +94,6 @@ prompt_tty(int ifd, int ofd, const char *message, char
 	int pos, ret;
 	char ch;
 
-	/* write prompt */
-	if (write(ofd, message, strlen(message)) < 0) {
-		openpam_log(PAM_LOG_ERROR, "write(): %m");
-		return (-1);
-	}
-
 	/* turn echo off if requested */
 	slflag = 0; /* prevent bogus uninitialized variable warning */
 	if (!echo) {
@@ -113,6 +107,12 @@ prompt_tty(int ifd, int ofd, const char *message, char
 			openpam_log(PAM_LOG_ERROR, "tcsetattr(): %m");
 			return (-1);
 		}
+	}
+
+	/* write prompt */
+	if (write(ofd, message, strlen(message)) < 0) {
+		openpam_log(PAM_LOG_ERROR, "write(): %m");
+		return (-1);
 	}
 
 	/* install signal handlers */


More information about the svn-src-head mailing list