summaryrefslogtreecommitdiff
path: root/libpam_misc
diff options
context:
space:
mode:
authorTomas Mraz <tm@t8m.info>2005-11-09 10:17:00 +0000
committerTomas Mraz <tm@t8m.info>2005-11-09 10:17:00 +0000
commit2d243af6b8ebe579f19ad27d3ab3907ebfe6a77e (patch)
treee991eb0aabc5987b410af4bf85aa31a0a40c448f /libpam_misc
parent6c22ab1b705ee1e990ef3436ffbbbf18dc4c52d6 (diff)
Relevant BUGIDs: 562730, 435990
Purpose of commit: bugfix Commit summary: --------------- * modules/pam_access/pam_access.c (pam_sm_acct_mgmt): Parse correctly full path tty name. * modules/pam_time/pam_time.c (pam_sm_acct_mgmt): Parse correctly full path tty name. Allow unset tty. (logic_member): Allow matching ':' in tty name. * modules/pam_group/pam_group.c (pam_sm_acct_mgmt): Parse correctly full path tty name. Allow unset tty. (logic_member): Allow matching ':' in tty name. * libpam_misc/misc_conv.c (read_string): Read only up to EOL if stdin is not terminal.
Diffstat (limited to 'libpam_misc')
-rw-r--r--libpam_misc/misc_conv.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libpam_misc/misc_conv.c b/libpam_misc/misc_conv.c
index ded256b2..52d647ab 100644
--- a/libpam_misc/misc_conv.c
+++ b/libpam_misc/misc_conv.c
@@ -180,7 +180,18 @@ static int read_string(int echo, const char *prompt, char **retstr)
D(("<failed to set alarm>"));
break;
} else {
- nc = read(STDIN_FILENO, line, INPUTSIZE-1);
+ if (have_term)
+ nc = read(STDIN_FILENO, line, INPUTSIZE-1);
+ else /* we must read one line only */
+ for (nc = 0; nc < INPUTSIZE-1 && (nc?line[nc-1]:0) != '\n';
+ nc++) {
+ int rv;
+ if ((rv=read(STDIN_FILENO, line+nc, 1)) != 1) {
+ if (rv < 0)
+ nc = rv;
+ break;
+ }
+ }
if (have_term) {
(void) tcsetattr(STDIN_FILENO, TCSADRAIN, &term_before);
if (!echo || expired) /* do we need a newline? */