summaryrefslogtreecommitdiff
path: root/ssh-add.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-add.c')
-rw-r--r--ssh-add.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/ssh-add.c b/ssh-add.c
index c2be36d93..d8d6481f2 100644
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-add.c,v 1.124 2015/09/13 13:48:19 tim Exp $ */ 1/* $OpenBSD: ssh-add.c,v 1.125 2015/09/13 14:39:16 tim 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
@@ -218,17 +218,16 @@ add_file(int agent_fd, const char *filename, int key_only)
218 close(fd); 218 close(fd);
219 219
220 /* At first, try empty passphrase */ 220 /* At first, try empty passphrase */
221 if ((r = sshkey_parse_private_fileblob(keyblob, "", filename, 221 if ((r = sshkey_parse_private_fileblob(keyblob, "", &private,
222 &private, &comment)) != 0 && r != SSH_ERR_KEY_WRONG_PASSPHRASE) { 222 &comment)) != 0 && r != SSH_ERR_KEY_WRONG_PASSPHRASE) {
223 fprintf(stderr, "Error loading key \"%s\": %s\n", 223 fprintf(stderr, "Error loading key \"%s\": %s\n",
224 filename, ssh_err(r)); 224 filename, ssh_err(r));
225 goto fail_load; 225 goto fail_load;
226 } 226 }
227 /* try last */ 227 /* try last */
228 if (private == NULL && pass != NULL) { 228 if (private == NULL && pass != NULL) {
229 if ((r = sshkey_parse_private_fileblob(keyblob, pass, filename, 229 if ((r = sshkey_parse_private_fileblob(keyblob, pass, &private,
230 &private, &comment)) != 0 && 230 &comment)) != 0 && r != SSH_ERR_KEY_WRONG_PASSPHRASE) {
231 r != SSH_ERR_KEY_WRONG_PASSPHRASE) {
232 fprintf(stderr, "Error loading key \"%s\": %s\n", 231 fprintf(stderr, "Error loading key \"%s\": %s\n",
233 filename, ssh_err(r)); 232 filename, ssh_err(r));
234 goto fail_load; 233 goto fail_load;
@@ -244,7 +243,7 @@ add_file(int agent_fd, const char *filename, int key_only)
244 if (strcmp(pass, "") == 0) 243 if (strcmp(pass, "") == 0)
245 goto fail_load; 244 goto fail_load;
246 if ((r = sshkey_parse_private_fileblob(keyblob, pass, 245 if ((r = sshkey_parse_private_fileblob(keyblob, pass,
247 filename, &private, &comment)) == 0) 246 &private, &comment)) == 0)
248 break; 247 break;
249 else if (r != SSH_ERR_KEY_WRONG_PASSPHRASE) { 248 else if (r != SSH_ERR_KEY_WRONG_PASSPHRASE) {
250 fprintf(stderr, 249 fprintf(stderr,