From 8e00a618125b0ff0a86d927c78da8061fe596402 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 27 Dec 2020 11:57:54 +0100 Subject: [PATCH] client: Drop use of getpass() getpass() is traditional Unix, but has been withdrawn from POSIX. We still use it when it's available, and fall back to portable code only when it's not. The portable code behaves differently: it reads stdin instead of /dev/tty, and in noncanonical mode. Simplify things: always use the replacement. Signed-off-by: Markus Armbruster --- configure.ac | 4 ++-- src/client/configure.ac | 4 ++-- src/client/getpass.c | 10 ---------- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/configure.ac b/configure.ac index d2d27c90a..4113bc781 100644 --- a/configure.ac +++ b/configure.ac @@ -27,7 +27,7 @@ # configure.ac: Autoconf input file # # Known contributors to this file: -# Markus Armbruster, 2005-2016 +# Markus Armbruster, 2005-2020 # # Process this file with autoconf to produce a configure script. @@ -167,7 +167,7 @@ main(int argc, char *argv[]) ### Checks for library functions -AC_CHECK_FUNCS(getaddrinfo getpass) +AC_CHECK_FUNCS(getaddrinfo) MY_FUNC_MAKECONTEXT diff --git a/src/client/configure.ac b/src/client/configure.ac index d701a2293..00aac39ec 100644 --- a/src/client/configure.ac +++ b/src/client/configure.ac @@ -27,7 +27,7 @@ # configure.ac: Autoconf input file # # Known contributors to this file: -# Markus Armbruster, 2005-2016 +# Markus Armbruster, 2005-2020 # # Process this file with autoconf to produce a configure script. @@ -76,7 +76,7 @@ fi ### Checks for library functions. -AC_CHECK_FUNCS(getaddrinfo getpass) +AC_CHECK_FUNCS(getaddrinfo) ### Site configuration diff --git a/src/client/getpass.c b/src/client/getpass.c index b04ec7e50..297b8417b 100644 --- a/src/client/getpass.c +++ b/src/client/getpass.c @@ -32,19 +32,14 @@ #include -#ifdef HAVE_GETPASS -#include -#else #include #ifdef _WIN32 #include #else #include #endif -#endif #include "misc.h" -#ifndef HAVE_GETPASS static int set_echo_if_tty(int on) { @@ -79,14 +74,10 @@ set_echo_if_tty(int on) return 1; #endif } -#endif /* !HAVE_GETPASS */ char * get_password(const char *prompt) { -#ifdef HAVE_GETPASS - return getpass(prompt); -#else static char buf[128]; char *p; size_t len; @@ -109,5 +100,4 @@ get_password(const char *prompt) if (p[len - 1] == '\n') p[len - 1] = 0; return p; -#endif /* !HAVE_GETPASS */ } -- 2.43.0