Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/crypto/external/bsd/netpgp/dist/src Revert "Remove a useless...
details: https://anonhg.NetBSD.org/src/rev/a47d50660235
branches: trunk
changeset: 351730:a47d50660235
user: khorben <khorben%NetBSD.org@localhost>
date: Fri Feb 24 01:26:17 2017 +0000
description:
Revert "Remove a useless loop around getpass()"
getpass(3) may return NULL upon failures on Linux, and netpgp should remain
portable to other systems.
diffstat:
crypto/external/bsd/netpgp/dist/src/lib/netpgp.c | 10 +++++++---
crypto/external/bsd/netpgp/dist/src/lib/reader.c | 5 +++--
crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c | 4 +++-
3 files changed, 13 insertions(+), 6 deletions(-)
diffs (65 lines):
diff -r 56732953de5a -r a47d50660235 crypto/external/bsd/netpgp/dist/src/lib/netpgp.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Thu Feb 23 23:19:04 2017 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/netpgp.c Fri Feb 24 01:26:17 2017 +0000
@@ -34,7 +34,7 @@
#if defined(__NetBSD__)
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: netpgp.c,v 1.99 2017/02/20 01:38:28 khorben Exp $");
+__RCSID("$NetBSD: netpgp.c,v 1.100 2017/02/24 01:26:17 khorben Exp $");
#endif
#include <sys/types.h>
@@ -740,10 +740,14 @@
}
for (i = 0 ; i < attempts ; i++) {
(void) snprintf(prompt, sizeof(prompt), "Enter passphrase for %.16s: ", id);
- cp = getpass(prompt);
+ if ((cp = getpass(prompt)) == NULL) {
+ break;
+ }
cc = snprintf(buf, sizeof(buf), "%s", cp);
(void) snprintf(prompt, sizeof(prompt), "Repeat passphrase for %.16s: ", id);
- cp = getpass(prompt);
+ if ((cp = getpass(prompt)) == NULL) {
+ break;
+ }
cc = snprintf(passphrase, size, "%s", cp);
if (strcmp(buf, passphrase) == 0) {
(void) memset(buf, 0x0, sizeof(buf));
diff -r 56732953de5a -r a47d50660235 crypto/external/bsd/netpgp/dist/src/lib/reader.c
--- a/crypto/external/bsd/netpgp/dist/src/lib/reader.c Thu Feb 23 23:19:04 2017 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/lib/reader.c Fri Feb 24 01:26:17 2017 +0000
@@ -54,7 +54,7 @@
#if defined(__NetBSD__)
__COPYRIGHT("@(#) Copyright (c) 2009 The NetBSD Foundation, Inc. All rights reserved.");
-__RCSID("$NetBSD: reader.c,v 1.50 2017/02/20 01:33:28 khorben Exp $");
+__RCSID("$NetBSD: reader.c,v 1.51 2017/02/24 01:27:14 khorben Exp $");
#endif
#include <sys/types.h>
@@ -162,7 +162,8 @@
char *p;
if (in == NULL) {
- p = getpass("netpgp passphrase: ");
+ while ((p = getpass("netpgp passphrase: ")) == NULL) {
+ }
(void) snprintf(phrase, size, "%s", p);
} else {
if (fgets(phrase, (int)size, in) == NULL) {
diff -r 56732953de5a -r a47d50660235 crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c
--- a/crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c Thu Feb 23 23:19:04 2017 +0000
+++ b/crypto/external/bsd/netpgp/dist/src/librsa/rsastubs.c Fri Feb 24 01:26:17 2017 +0000
@@ -43,7 +43,9 @@
USE_ARG(rwflag);
snprintf(prompt, sizeof(prompt), "\"%s\" passphrase: ", (char *)u);
- passphrase = getpass(prompt);
+ if ((passphrase = getpass(prompt)) == NULL) {
+ return -1;
+ }
(void) memcpy(buf, passphrase, (size_t)size);
return (int)strlen(passphrase);
}
Home |
Main Index |
Thread Index |
Old Index