diff options
author | 2016-09-03 11:01:44 +0000 | |
---|---|---|
committer | 2016-09-03 11:01:44 +0000 | |
commit | 7ca9ec5d37dddfe4f0c06e265da9cc92a3603686 (patch) | |
tree | 42cb5dc011126c654bc25d9c8458a2605f77d48a | |
parent | note that getpass is obsolete. removed from posix in 2001. (diff) | |
download | wireguard-openbsd-7ca9ec5d37dddfe4f0c06e265da9cc92a3603686.tar.xz wireguard-openbsd-7ca9ec5d37dddfe4f0c06e265da9cc92a3603686.zip |
convert to use readpassphrase() instead of DEPRECATED/getpass()
OK millert@
-rw-r--r-- | libexec/login_yubikey/login_yubikey.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libexec/login_yubikey/login_yubikey.c b/libexec/login_yubikey/login_yubikey.c index 58d058f7d14..4a35eff7b0b 100644 --- a/libexec/login_yubikey/login_yubikey.c +++ b/libexec/login_yubikey/login_yubikey.c @@ -1,4 +1,4 @@ -/* $OpenBSD: login_yubikey.c,v 1.15 2016/08/16 04:44:38 tedu Exp $ */ +/* $OpenBSD: login_yubikey.c,v 1.16 2016/09/03 11:01:44 gsoares Exp $ */ /* * Copyright (c) 2010 Daniel Hartmeier <daniel@benzedrine.cx> @@ -37,6 +37,7 @@ #include <ctype.h> #include <login_cap.h> #include <pwd.h> +#include <readpassphrase.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> @@ -66,6 +67,7 @@ main(int argc, char *argv[]) int ch, ret, mode = MODE_LOGIN, count; FILE *f = NULL; char *username, *password = NULL; + char pbuf[1024]; char response[1024]; setpriority(PRIO_PROCESS, 0, 0); @@ -123,8 +125,9 @@ main(int argc, char *argv[]) switch (mode) { case MODE_LOGIN: - if ((password = getpass("Password:")) == NULL) { - syslog(LOG_ERR, "user %s: getpass: %m", + if ((password = readpassphrase("Password:", pbuf, sizeof(pbuf), + RPP_ECHO_OFF)) == NULL) { + syslog(LOG_ERR, "user %s: readpassphrase: %m", username); exit(EXIT_FAILURE); } |