]> git.pond.sub.org Git - empserver/commitdiff
client: Drop use of getpass()
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 27 Dec 2020 10:57:54 +0000 (11:57 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 23 Jan 2021 06:08:03 +0000 (07:08 +0100)
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 <armbru@pond.sub.org>
configure.ac
src/client/configure.ac
src/client/getpass.c

index d2d27c90ae6ab0041a05ff6e44633d9278cbb1dd..4113bc781d2cbad3c80ba18808f9f23a30274a9d 100644 (file)
@@ -27,7 +27,7 @@
 #   configure.ac: Autoconf input file
 #
 #   Known contributors to this file:
 #   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.
 
 #
 # Process this file with autoconf to produce a configure script.
 
@@ -167,7 +167,7 @@ main(int argc, char *argv[])
 
 ### Checks for library functions
 
 
 ### Checks for library functions
 
-AC_CHECK_FUNCS(getaddrinfo getpass)
+AC_CHECK_FUNCS(getaddrinfo)
 MY_FUNC_MAKECONTEXT
 
 
 MY_FUNC_MAKECONTEXT
 
 
index d701a22931fc2f85be432142477b2bddf52ee472..00aac39ec46c0efa034a83a10f4a5a039aeb93c3 100644 (file)
@@ -27,7 +27,7 @@
 #   configure.ac: Autoconf input file
 #
 #   Known contributors to this file:
 #   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.
 
 #
 # Process this file with autoconf to produce a configure script.
 
@@ -76,7 +76,7 @@ fi
 
 ### Checks for library functions.
 
 
 ### Checks for library functions.
 
-AC_CHECK_FUNCS(getaddrinfo getpass)
+AC_CHECK_FUNCS(getaddrinfo)
 
 
 ### Site configuration
 
 
 ### Site configuration
index b04ec7e504cf66b6e3b81de123e162347bc8d46f..297b8417b0b604a69819a0705963f5773f553ee6 100644 (file)
 
 #include <config.h>
 
 
 #include <config.h>
 
-#ifdef HAVE_GETPASS
-#include <unistd.h>
-#else
 #include <string.h>
 #ifdef _WIN32
 #include <windows.h>
 #else
 #include <termios.h>
 #endif
 #include <string.h>
 #ifdef _WIN32
 #include <windows.h>
 #else
 #include <termios.h>
 #endif
-#endif
 #include "misc.h"
 
 #include "misc.h"
 
-#ifndef HAVE_GETPASS
 static int
 set_echo_if_tty(int on)
 {
 static int
 set_echo_if_tty(int on)
 {
@@ -79,14 +74,10 @@ set_echo_if_tty(int on)
     return 1;
 #endif
 }
     return 1;
 #endif
 }
-#endif /* !HAVE_GETPASS */
 
 char *
 get_password(const char *prompt)
 {
 
 char *
 get_password(const char *prompt)
 {
-#ifdef HAVE_GETPASS
-    return getpass(prompt);
-#else
     static char buf[128];
     char *p;
     size_t len;
     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;
     if (p[len - 1] == '\n')
        p[len - 1] = 0;
     return p;
-#endif /* !HAVE_GETPASS */
 }
 }