summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2014-07-01 14:36:30 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2014-07-01 15:48:03 +0200
commit4b42a7a4c2de0572bdd7fa01c75a55981bdd964b (patch)
tree2f55862a424c6d556f2113bc9783a7f5d46a00a7
parent3fbcd1330529f522d69917a79d7ce97a74718895 (diff)
downloadgnutls-4b42a7a4c2de0572bdd7fa01c75a55981bdd964b.tar.gz
p11tool/certtool: use GNUTLS_SO_PIN for reading security officer's PIN
-rw-r--r--src/common.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/common.c b/src/common.c
index 19e54b776f..401e055f51 100644
--- a/src/common.c
+++ b/src/common.c
@@ -968,11 +968,15 @@ pin_callback(void *user, int attempt, const char *token_url,
/* allow caching of PIN */
static char *cached_url = NULL;
static char cached_pin[32] = "";
+ const char *env;
- if (flags & GNUTLS_PIN_SO)
+ if (flags & GNUTLS_PIN_SO) {
+ env = "GNUTLS_SO_PIN";
desc = "security officer";
- else
+ } else {
+ env = "GNUTLS_PIN";
desc = "user";
+ }
if (flags & GNUTLS_PIN_FINAL_TRY) {
cache = 0;
@@ -1008,7 +1012,9 @@ pin_callback(void *user, int attempt, const char *token_url,
printf("Token '%s' with URL '%s' ", token_label, token_url);
printf("requires %s PIN\n", desc);
- password = getenv("GNUTLS_PIN");
+ password = getenv(env);
+ if (env == NULL) /* compatibility */
+ password = getenv("GNUTLS_PIN");
if (password == NULL) {
password = getpass("Enter PIN: ");