diff options
Diffstat (limited to 'ssh-add.c')
-rw-r--r-- | ssh-add.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-add.c,v 1.107 2013/12/15 18:17:26 pascal Exp $ */ | 1 | /* $OpenBSD: ssh-add.c,v 1.108 2013/12/19 00:10:30 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -293,14 +293,17 @@ add_file(AuthenticationConnection *ac, const char *filename, int key_only) | |||
293 | static int | 293 | static int |
294 | update_card(AuthenticationConnection *ac, int add, const char *id) | 294 | update_card(AuthenticationConnection *ac, int add, const char *id) |
295 | { | 295 | { |
296 | char *pin; | 296 | char *pin = NULL; |
297 | int ret = -1; | 297 | int ret = -1; |
298 | 298 | ||
299 | pin = read_passphrase("Enter passphrase for PKCS#11: ", RP_ALLOW_STDIN); | 299 | if (add) { |
300 | if (pin == NULL) | 300 | if ((pin = read_passphrase("Enter passphrase for PKCS#11: ", |
301 | return -1; | 301 | RP_ALLOW_STDIN)) == NULL) |
302 | return -1; | ||
303 | } | ||
302 | 304 | ||
303 | if (ssh_update_card(ac, add, id, pin, lifetime, confirm)) { | 305 | if (ssh_update_card(ac, add, id, pin == NULL ? "" : pin, |
306 | lifetime, confirm)) { | ||
304 | fprintf(stderr, "Card %s: %s\n", | 307 | fprintf(stderr, "Card %s: %s\n", |
305 | add ? "added" : "removed", id); | 308 | add ? "added" : "removed", id); |
306 | ret = 0; | 309 | ret = 0; |