]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
p11tool: Do not allow a newline as PIN.
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Wed, 25 Jun 2014 13:29:35 +0000 (15:29 +0200)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Wed, 25 Jun 2014 13:29:35 +0000 (15:29 +0200)
src/common.c

index d878ecf29dc5cbcf79c1cc37fa2930fb0dc19be7..f468de07b7145deb96a197389ad14d6d9e3f51d8 100644 (file)
@@ -1026,17 +1026,17 @@ pin_callback(void *user, int attempt, const char *token_url,
        
        password = getenv("GNUTLS_PIN");
 
-       if (password == NULL)
+       if (password == NULL) {
                password = getpass("Enter PIN: ");
-       else {
+       else {
                if (flags & GNUTLS_PIN_WRONG) {
                        fprintf(stderr, "Cannot continue with a wrong password in the environment.\n");
                        exit(1);
                }
        }
 
-       if (password == NULL || password[0] == 0) {
-               fprintf(stderr, "No password given\n");
+       if (password == NULL || password[0] == 0 || password[0] == '\n') {
+               fprintf(stderr, "No PIN given\n");
                exit(1);
        }