diff --git a/CREDITS b/CREDITS index b40c9d3..a560f9e 100644 --- a/CREDITS +++ b/CREDITS @@ -18,6 +18,7 @@ ideas: Ankita Pal Baptiste Daroussin Brian Fundakowski Feldman + Brooks Davis Christos Zoulas Daniel Richard G. Darren J. Moffat diff --git a/HISTORY b/HISTORY index 98032d7..234604e 100644 --- a/HISTORY +++ b/HISTORY @@ -1,3 +1,8 @@ +OpenPAM ??? 2020-07-?? + + - BUGFIX: Fix race condition in openpam_ttyconv(3) when used with + expect scripts. +============================================================================ OpenPAM Tabebuia 2019-02-24 - BUGFIX: Fix off-by-one bug in pam_getenv(3) which was introduced in diff --git a/lib/libpam/openpam_ttyconv.c b/lib/libpam/openpam_ttyconv.c index dd958a9..4b223d9 100644 --- a/lib/libpam/openpam_ttyconv.c +++ b/lib/libpam/openpam_ttyconv.c @@ -94,12 +94,6 @@ prompt_tty(int ifd, int ofd, const char *message, char *response, int echo) 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) { @@ -115,6 +109,12 @@ prompt_tty(int ifd, int ofd, const char *message, char *response, int echo) } } + /* write prompt */ + if (write(ofd, message, strlen(message)) < 0) { + openpam_log(PAM_LOG_ERROR, "write(): %m"); + return (-1); + } + /* install signal handlers */ caught_signal = 0; action.sa_handler = &catch_signal;