summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2016-11-10 06:39:32 +0100
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2016-11-10 06:41:06 +0100
commit7db2f8fddbaae1c3a9a613ca355bb36d2946f009 (patch)
tree809c92e896718bcae46dde70857d0cf43603cd41
parentd895ddee08d01fa603f257578544ffa9690ce89f (diff)
downloadgnutls-tmp-pkcs11-updates.tar.gz
p11tool: --initialize will no longer reset user PINtmp-pkcs11-updates
That is because it only resetted the user PIN and not the admin PIN, while at the same time it had problems to cope with the case where the URL changed between token initialization and PIN setting (which is the case if --label is provided to --initialize).
-rw-r--r--src/pkcs11.c24
1 files changed, 1 insertions, 23 deletions
diff --git a/src/pkcs11.c b/src/pkcs11.c
index 6f028ed9d8..4cce8e0d7d 100644
--- a/src/pkcs11.c
+++ b/src/pkcs11.c
@@ -900,29 +900,7 @@ pkcs11_init(FILE * outfile, const char *url, const char *label,
}
fprintf(stderr, "done\n");
- fprintf(stderr, "Setting token's user PIN...\n");
- if (info->pin != NULL) {
- pin = info->pin;
- } else {
- pin = getenv("GNUTLS_PIN");
- if (pin == NULL && info->batch == 0)
- pin = getpass("Enter User's new PIN: ");
- if (pin == NULL)
- exit(1);
- }
-
- if (pin == NULL || pin[0] == '\n')
- exit(1);
-
- /* do not ask the SO PIN twice */
- setenv("GNUTLS_SO_PIN", so_pin, 0);
-
- ret = gnutls_pkcs11_token_set_pin(url, NULL, pin, GNUTLS_PIN_USER);
- if (ret < 0) {
- fprintf(stderr, "Error in %s:%d: %s\n", __func__, __LINE__,
- gnutls_strerror(ret));
- exit(1);
- }
+ fprintf(stderr, "\nToken was successfully initialized; use --initialize-pin and --initialize-so-pin to set or reset PINs\n");
return;
}