summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2016-09-02 17:06:59 +0000
committertedu <tedu@openbsd.org>2016-09-02 17:06:59 +0000
commita18011af2ec9f4a4a995547a6f46b88890c52714 (patch)
treed32086780341c9b0823d6fbfc2b205b95d8c714b
parentAdd switch(4) cdev entry (diff)
downloadwireguard-openbsd-a18011af2ec9f4a4a995547a6f46b88890c52714.tar.xz
wireguard-openbsd-a18011af2ec9f4a4a995547a6f46b88890c52714.zip
convert getpass to readpassphrase. from Dimitris Papastamos
-rw-r--r--usr.bin/encrypt/encrypt.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/encrypt/encrypt.c b/usr.bin/encrypt/encrypt.c
index f127a2f0783..4ded29d4c1a 100644
--- a/usr.bin/encrypt/encrypt.c
+++ b/usr.bin/encrypt/encrypt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: encrypt.c,v 1.42 2015/10/10 18:14:20 doug Exp $ */
+/* $OpenBSD: encrypt.c,v 1.43 2016/09/02 17:06:59 tedu Exp $ */
/*
* Copyright (c) 1996, Jason Downs. All rights reserved.
@@ -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 {