View | Details | Raw Unified | Return to bug 2185 | Differences between
and this patch

Collapse All | Expand All

(-)/tmp/openssh-6.4p1/ssh-pkcs11.c (-9 / +17 lines)
Lines 258-275 Link Here
258
			error("need pin");
258
			error("need pin");
259
			return (-1);
259
			return (-1);
260
		}
260
		}
261
		snprintf(prompt, sizeof(prompt), "Enter PIN for '%s': ",
261
		if (si->token.flags & CKF_PROTECTED_AUTHENTICATION_PATH) {
262
		    si->token.label);
262
			printf("Enter PIN for '%s' on reader pinpad. ", si->token.label);
263
		pin = read_passphrase(prompt, RP_ALLOW_EOF);
263
			fflush(stdout);
264
		if (pin == NULL)
264
			pin = malloc(1);
265
			return (-1);	/* bail out */
265
			*pin = '\0';
266
		if ((rv = f->C_Login(si->session, CKU_USER,
266
		} else {
267
		    (u_char *)pin, strlen(pin))) != CKR_OK) {
267
			snprintf(prompt, sizeof(prompt), "Enter PIN for '%s': ",
268
			free(pin);
268
			    si->token.label);
269
			pin = read_passphrase(prompt, RP_ALLOW_EOF);
270
			if (pin == NULL)
271
				return (-1);	/* bail out */
272
		}
273
		rv = f->C_Login(si->session, CKU_USER, (u_char *)pin, strlen(pin));
274
		free(pin);
275
		if (si->token.flags & CKF_PROTECTED_AUTHENTICATION_PATH)
276
			printf("\n");
277
		if (rv != CKR_OK) {
269
			error("C_Login failed: %lu", rv);
278
			error("C_Login failed: %lu", rv);
270
			return (-1);
279
			return (-1);
271
		}
280
		}
272
		free(pin);
273
		si->logged_in = 1;
281
		si->logged_in = 1;
274
	}
282
	}
275
	key_filter[1].pValue = k11->keyid;
283
	key_filter[1].pValue = k11->keyid;

Return to bug 2185