summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/readpass.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1999-09-30 05:03:04 +0000
committerderaadt <deraadt@openbsd.org>1999-09-30 05:03:04 +0000
commit90652e5aa71883cdf393f95cbdc7c15df082bd02 (patch)
treeef85e188be17bffb3b2a0e734d0cff418c99d092 /usr.bin/ssh/readpass.c
parentmore culling (diff)
downloadwireguard-openbsd-90652e5aa71883cdf393f95cbdc7c15df082bd02.tar.xz
wireguard-openbsd-90652e5aa71883cdf393f95cbdc7c15df082bd02.zip
cull more ancient garbage from pre-POSIX days
Diffstat (limited to 'usr.bin/ssh/readpass.c')
-rw-r--r--usr.bin/ssh/readpass.c38
1 files changed, 1 insertions, 37 deletions
diff --git a/usr.bin/ssh/readpass.c b/usr.bin/ssh/readpass.c
index c9b37dd9b5f..e5363722601 100644
--- a/usr.bin/ssh/readpass.c
+++ b/usr.bin/ssh/readpass.c
@@ -14,18 +14,13 @@ Functions for reading passphrases and passwords.
*/
#include "includes.h"
-RCSID("$Id: readpass.c,v 1.1 1999/09/26 20:53:37 deraadt Exp $");
+RCSID("$Id: readpass.c,v 1.2 1999/09/30 05:03:05 deraadt Exp $");
#include "xmalloc.h"
#include "ssh.h"
/* Saved old terminal mode for read_passphrase. */
-#ifdef USING_TERMIOS
static struct termios saved_tio;
-#endif
-#ifdef USING_SGTTY
-static struct sgttyb saved_tio;
-#endif
/* Old interrupt signal handler for read_passphrase. */
static RETSIGTYPE (*old_handler)(int sig) = NULL;
@@ -35,12 +30,7 @@ static RETSIGTYPE (*old_handler)(int sig) = NULL;
RETSIGTYPE intr_handler(int sig)
{
/* Restore terminal modes. */
-#ifdef USING_TERMIOS
tcsetattr(fileno(stdin), TCSANOW, &saved_tio);
-#endif
-#ifdef USING_SGTTY
- ioctl(fileno(stdin), TIOCSETP, &saved_tio);
-#endif
/* Restore the old signal handler. */
signal(sig, old_handler);
/* Resend the signal, with the old handler. */
@@ -55,12 +45,7 @@ RETSIGTYPE intr_handler(int sig)
char *read_passphrase(const char *prompt, int from_stdin)
{
char buf[1024], *cp;
-#ifdef USING_TERMIOS
struct termios tio;
-#endif
-#ifdef USING_SGTTY
- struct sgttyb tio;
-#endif
FILE *f;
if (from_stdin)
@@ -105,37 +90,21 @@ char *read_passphrase(const char *prompt, int from_stdin)
fflush(stderr);
/* Get terminal modes. */
-#ifdef USING_TERMIOS
tcgetattr(fileno(f), &tio);
-#endif
-#ifdef USING_SGTTY
- ioctl(fileno(f), TIOCGETP, &tio);
-#endif
saved_tio = tio;
/* Save signal handler and set the new handler. */
old_handler = signal(SIGINT, intr_handler);
/* Set new terminal modes disabling all echo. */
-#ifdef USING_TERMIOS
tio.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL);
tcsetattr(fileno(f), TCSANOW, &tio);
-#endif
-#ifdef USING_SGTTY
- tio.sg_flags &= ~(ECHO);
- ioctl(fileno(f), TIOCSETP, &tio);
-#endif
/* Read the passphrase from the terminal. */
if (fgets(buf, sizeof(buf), f) == NULL)
{
/* Got EOF. Just exit. */
/* Restore terminal modes. */
-#ifdef USING_TERMIOS
tcsetattr(fileno(f), TCSANOW, &saved_tio);
-#endif
-#ifdef USING_SGTTY
- ioctl(fileno(f), TIOCSETP, &saved_tio);
-#endif
/* Restore the signal handler. */
signal(SIGINT, old_handler);
/* Print a newline (the prompt probably didn\'t have one). */
@@ -146,12 +115,7 @@ char *read_passphrase(const char *prompt, int from_stdin)
exit(1);
}
/* Restore terminal modes. */
-#ifdef USING_TERMIOS
tcsetattr(fileno(f), TCSANOW, &saved_tio);
-#endif
-#ifdef USING_SGTTY
- ioctl(fileno(f), TIOCSETP, &saved_tio);
-#endif
/* Restore the signal handler. */
(void)signal(SIGINT, old_handler);
/* Remove newline from the passphrase. */