Hi,

encrypt(1) updated to use readpassphrase(3) instead of getpass(3).
Thought I would grep the tree after the recent commit to passwd(1)
by tedu.

Index: encrypt.c
===================================================================
RCS file: /cvs/src/usr.bin/encrypt/encrypt.c,v
retrieving revision 1.42
diff -u -p -r1.42 encrypt.c
--- encrypt.c   10 Oct 2015 18:14:20 -0000      1.42
+++ encrypt.c   31 Aug 2016 23:05:17 -0000
@@ -36,6 +36,7 @@
 #include <unistd.h>
 #include <login_cap.h>
 #include <limits.h>
+#include <readpassphrase.h>
 
 /*
  * Very simple little program, for encrypting passwords from the command
@@ -123,11 +124,13 @@ main(int argc, char **argv)
        }
 
        if (((argc - optind) < 1)) {
-               char line[BUFSIZ], *string;
+               char line[BUFSIZ];
+               char string[_PASSWORD_LEN + 1];
 
                if (prompt) {
-                       if ((string = getpass("Enter string: ")) == NULL)
-                               err(1, "getpass");
+                       if (readpassphrase("Enter string: ", string,
+                           sizeof(string), RPP_ECHO_OFF) == NULL)
+                               err(1, "readpassphrase");
                        print_passwd(string, operation, extra);
                        (void)fputc('\n', stdout);
                } else {

Reply via email to