Author: des
Date: Thu Nov 19 05:44:41 2020
New Revision: 367831
URL: https://svnweb.freebsd.org/changeset/base/367831

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

Modified:
  vendor/openpam/dist/CREDITS
  vendor/openpam/dist/lib/libpam/openpam_ttyconv.c

Modified: vendor/openpam/dist/CREDITS
==============================================================================
--- vendor/openpam/dist/CREDITS Thu Nov 19 04:28:39 2020        (r367830)
+++ vendor/openpam/dist/CREDITS Thu Nov 19 05:44:41 2020        (r367831)
@@ -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: vendor/openpam/dist/lib/libpam/openpam_ttyconv.c
==============================================================================
--- vendor/openpam/dist/lib/libpam/openpam_ttyconv.c    Thu Nov 19 04:28:39 
2020        (r367830)
+++ vendor/openpam/dist/lib/libpam/openpam_ttyconv.c    Thu Nov 19 05:44:41 
2020        (r367831)
@@ -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-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to