Browse Source

In openpam_ttyconv(3), wait to print the prompt until after we're ready

to accept input.  Otherwise, there is a small but non-zero chance that
input provided after the prompt appears is discarded when we flush the
tty buffer.

Submitted by:	Brooks Davis <brooks@freebsd.org>


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@948 185d5e19-27fe-0310-9dcf-9bff6b9f3609
remotes/origin/trunk
Dag-Erling Smørgrav 1 year ago
parent
commit
a967883b9c
  1. 1
      CREDITS
  2. 5
      HISTORY
  3. 12
      lib/libpam/openpam_ttyconv.c

1
CREDITS

@ -18,6 +18,7 @@ ideas:
Ankita Pal <pal.ankita.ankita@gmail.com>
Baptiste Daroussin <bapt@freebsd.org>
Brian Fundakowski Feldman <green@freebsd.org>
Brooks Davis <brooks@freebsd.org>
Christos Zoulas <christos@netbsd.org>
Daniel Richard G. <skunk@iskunk.org>
Darren J. Moffat <darren.moffat@sun.com>

5
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

12
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;

Loading…
Cancel
Save