diff options
author | 2014-07-09 14:15:56 +0000 | |
---|---|---|
committer | 2014-07-09 14:15:56 +0000 | |
commit | 244d51a8c38dafb91b63a36d3e7f036f9854b807 (patch) | |
tree | c826d971d34fe93a3cfdc4ecaad8e126faab2a21 /usr.bin/ssh/ssh-add.c | |
parent | Cleanup the chunk placement routine by removing the conflict resolver. (diff) | |
download | wireguard-openbsd-244d51a8c38dafb91b63a36d3e7f036f9854b807.tar.xz wireguard-openbsd-244d51a8c38dafb91b63a36d3e7f036f9854b807.zip |
fix ssh-add crash while loading more than one key
ok markus@
Diffstat (limited to 'usr.bin/ssh/ssh-add.c')
-rw-r--r-- | usr.bin/ssh/ssh-add.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/ssh/ssh-add.c b/usr.bin/ssh/ssh-add.c index 9657f2c4f01..3265072f7a6 100644 --- a/usr.bin/ssh/ssh-add.c +++ b/usr.bin/ssh/ssh-add.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssh-add.c,v 1.112 2014/07/03 03:15:01 djm Exp $ */ +/* $OpenBSD: ssh-add.c,v 1.113 2014/07/09 14:15:56 benno Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -199,8 +199,6 @@ add_file(AuthenticationConnection *ac, const char *filename, int key_only) if ((r = sshkey_parse_private_fileblob(&keyblob, "", filename, &private, &comment)) != 0 && r != SSH_ERR_KEY_WRONG_PASSPHRASE) fatal("Cannot parse %s: %s", filename, ssh_err(r)); - if (comment == NULL) - comment = xstrdup(filename); /* try last */ if (private == NULL && pass != NULL) { if ((r = sshkey_parse_private_fileblob(&keyblob, pass, filename, @@ -208,6 +206,8 @@ add_file(AuthenticationConnection *ac, const char *filename, int key_only) r != SSH_ERR_KEY_WRONG_PASSPHRASE) fatal("Cannot parse %s: %s", filename, ssh_err(r)); } + if (comment == NULL) + comment = xstrdup(filename); if (private == NULL) { /* clear passphrase since it did not work */ clear_pass(); |