diff options
author | Tomas Mraz <tmraz@fedoraproject.org> | 2021-04-12 18:28:47 +0200 |
---|---|---|
committer | Tomas Mraz <tmraz@fedoraproject.org> | 2021-04-12 18:28:47 +0200 |
commit | e65d93223bbcf9931f580963edeacbe3c2cf72cb (patch) | |
tree | f22cbb87b8aed545b2b5d73d9d0aa1303e1d42bc /libpam_misc | |
parent | 08992030c56c940c0707ccbc442b1c325aa01e6d (diff) | |
download | pam-e65d93223bbcf9931f580963edeacbe3c2cf72cb.tar.gz pam-e65d93223bbcf9931f580963edeacbe3c2cf72cb.tar.bz2 pam-e65d93223bbcf9931f580963edeacbe3c2cf72cb.zip |
misc_conv: Flush the terminal input after the password is read
Fixes #347
* libpam_misc/misc_conv.c (read_string): Use TCSAFLUSH instead
of TCSADRAIN when resetting the terminal echo state
Diffstat (limited to 'libpam_misc')
-rw-r--r-- | libpam_misc/misc_conv.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libpam_misc/misc_conv.c b/libpam_misc/misc_conv.c index 35610e05..f28b1093 100644 --- a/libpam_misc/misc_conv.c +++ b/libpam_misc/misc_conv.c @@ -194,7 +194,7 @@ static int read_string(int echo, const char *prompt, char **retstr) if (have_term) { (void) tcsetattr(STDIN_FILENO, TCSADRAIN, &term_before); if (!echo || expired) /* do we need a newline? */ - fprintf(stderr,"\n"); + fprintf(stderr, "\n"); } if ( delay > 0 ) { reset_alarm(&old_sig); @@ -252,7 +252,7 @@ static int read_string(int echo, const char *prompt, char **retstr) if (have_term) { (void) sigprocmask(SIG_SETMASK, &oset, NULL); - (void) tcsetattr(STDIN_FILENO, TCSADRAIN, &term_before); + (void) tcsetattr(STDIN_FILENO, TCSAFLUSH, &term_before); } return nc; |