diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1998-02-06 19:02:56 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1998-02-06 19:02:56 +0000 |
commit | 837bd2c6b777e11e61125d36e9527aa60eb912e1 (patch) | |
tree | 96f15c2a79d2989a76f5e188717e7dd4073c35b5 /gnu | |
parent | e048156d1a32b41aae14ad1f28ca8000432bbedd (diff) |
Remove bogus flush of stderr
Spew prompt before turning off echo. Seems to fix a weird problem where
if sudo complained about a bogus stamp file the user would sometimes
not have a chance to enter a password.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/usr.bin/sudo/sudo/check.c | 4 | ||||
-rw-r--r-- | gnu/usr.bin/sudo/sudo/tgetpass.c | 53 |
2 files changed, 28 insertions, 29 deletions
diff --git a/gnu/usr.bin/sudo/sudo/check.c b/gnu/usr.bin/sudo/sudo/check.c index ce1b3c6c054..b8632542645 100644 --- a/gnu/usr.bin/sudo/sudo/check.c +++ b/gnu/usr.bin/sudo/sudo/check.c @@ -1,4 +1,4 @@ -/* $OpenBSD: check.c,v 1.6 1998/01/13 05:30:20 millert Exp $ */ +/* $OpenBSD: check.c,v 1.7 1998/02/06 19:02:52 millert Exp $ */ /* * CU sudo version 1.5.4 (based on Root Group sudo version 1.1) @@ -880,7 +880,5 @@ static void reminder() " #1) Respect the privacy of others.", " #2) Think before you type." ); - - (void) fflush(stderr); } #endif /* NO_MESSAGE */ diff --git a/gnu/usr.bin/sudo/sudo/tgetpass.c b/gnu/usr.bin/sudo/sudo/tgetpass.c index 1f7c5bc7537..a09015b17a1 100644 --- a/gnu/usr.bin/sudo/sudo/tgetpass.c +++ b/gnu/usr.bin/sudo/sudo/tgetpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tgetpass.c,v 1.6 1998/01/23 03:54:05 millert Exp $ */ +/* $OpenBSD: tgetpass.c,v 1.7 1998/02/06 19:02:55 millert Exp $ */ /* * CU sudo version 1.5.4 @@ -139,37 +139,13 @@ char * tgetpass(prompt, timeout, user, host) if ((input = fopen(_PATH_TTY, "r+")) == NULL) { input = stdin; output = stderr; - (void) fflush(output); } else { output = input; } /* - * turn off echo + * print the prompt */ -#ifdef HAVE_TERMIOS_H - (void) tcgetattr(fileno(input), &term); - if ((echo = (term.c_lflag & ECHO))) { - term.c_lflag &= ~ECHO; - (void) tcsetattr(fileno(input), TCSAFLUSH|TCSASOFT, &term); - } -#else -#ifdef HAVE_TERMIO_H - (void) ioctl(fileno(input), TCGETA, &term); - if ((echo = (term.c_lflag & ECHO))) { - term.c_lflag &= ~ECHO; - (void) ioctl(fileno(input), TCSETA, &term); - } -#else - (void) ioctl(fileno(input), TIOCGETP, &ttyb); - if ((echo = (ttyb.sg_flags & ECHO))) { - ttyb.sg_flags &= ~ECHO; - (void) ioctl(fileno(input), TIOCSETP, &ttyb); - } -#endif /* HAVE_TERMIO_H */ -#endif /* HAVE_TERMIOS_H */ - - /* print the prompt */ if (prompt) { p = (char *) prompt; do { @@ -197,6 +173,31 @@ char * tgetpass(prompt, timeout, user, host) } /* + * turn off echo + */ +#ifdef HAVE_TERMIOS_H + (void) tcgetattr(fileno(input), &term); + if ((echo = (term.c_lflag & ECHO))) { + term.c_lflag &= ~ECHO; + (void) tcsetattr(fileno(input), TCSAFLUSH|TCSASOFT, &term); + } +#else +#ifdef HAVE_TERMIO_H + (void) ioctl(fileno(input), TCGETA, &term); + if ((echo = (term.c_lflag & ECHO))) { + term.c_lflag &= ~ECHO; + (void) ioctl(fileno(input), TCSETA, &term); + } +#else + (void) ioctl(fileno(input), TIOCGETP, &ttyb); + if ((echo = (ttyb.sg_flags & ECHO))) { + ttyb.sg_flags &= ~ECHO; + (void) ioctl(fileno(input), TIOCSETP, &ttyb); + } +#endif /* HAVE_TERMIO_H */ +#endif /* HAVE_TERMIOS_H */ + + /* * Timeout of <= 0 means no timeout */ if (timeout > 0) { |