From e65d93223bbcf9931f580963edeacbe3c2cf72cb Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Mon, 12 Apr 2021 18:28:47 +0200 Subject: 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 --- libpam_misc/misc_conv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libpam_misc') 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; -- cgit v1.2.3