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.ank...@gmail.com>
        Baptiste Daroussin <b...@freebsd.org>
        Brian Fundakowski Feldman <gr...@freebsd.org>
+       Brooks Davis <bro...@freebsd.org>
        Christos Zoulas <chris...@netbsd.org>
        Daniel Richard G. <sk...@iskunk.org>
        Darren J. Moffat <darren.mof...@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 */
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to