diff options
Diffstat (limited to 'ssh-add.c')
-rw-r--r-- | ssh-add.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-add.c,v 1.112 2014/07/03 03:15:01 djm Exp $ */ | 1 | /* $OpenBSD: ssh-add.c,v 1.113 2014/07/09 14:15:56 benno 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 |
@@ -205,8 +205,6 @@ add_file(AuthenticationConnection *ac, const char *filename, int key_only) | |||
205 | if ((r = sshkey_parse_private_fileblob(&keyblob, "", filename, | 205 | if ((r = sshkey_parse_private_fileblob(&keyblob, "", filename, |
206 | &private, &comment)) != 0 && r != SSH_ERR_KEY_WRONG_PASSPHRASE) | 206 | &private, &comment)) != 0 && r != SSH_ERR_KEY_WRONG_PASSPHRASE) |
207 | fatal("Cannot parse %s: %s", filename, ssh_err(r)); | 207 | fatal("Cannot parse %s: %s", filename, ssh_err(r)); |
208 | if (comment == NULL) | ||
209 | comment = xstrdup(filename); | ||
210 | /* try last */ | 208 | /* try last */ |
211 | if (private == NULL && pass != NULL) { | 209 | if (private == NULL && pass != NULL) { |
212 | if ((r = sshkey_parse_private_fileblob(&keyblob, pass, filename, | 210 | if ((r = sshkey_parse_private_fileblob(&keyblob, pass, filename, |
@@ -214,6 +212,8 @@ add_file(AuthenticationConnection *ac, const char *filename, int key_only) | |||
214 | r != SSH_ERR_KEY_WRONG_PASSPHRASE) | 212 | r != SSH_ERR_KEY_WRONG_PASSPHRASE) |
215 | fatal("Cannot parse %s: %s", filename, ssh_err(r)); | 213 | fatal("Cannot parse %s: %s", filename, ssh_err(r)); |
216 | } | 214 | } |
215 | if (comment == NULL) | ||
216 | comment = xstrdup(filename); | ||
217 | if (private == NULL) { | 217 | if (private == NULL) { |
218 | /* clear passphrase since it did not work */ | 218 | /* clear passphrase since it did not work */ |
219 | clear_pass(); | 219 | clear_pass(); |