[ssh-add.c]
     fix loading of private keys
This commit is contained in:
Damien Miller 2014-07-02 15:30:00 +10:00
parent 4b3ed647d5
commit ec3d0e24a1
2 changed files with 8 additions and 5 deletions

View File

@ -62,6 +62,9 @@
[channels.c channels.h clientloop.c ssh.c] [channels.c channels.h clientloop.c ssh.c]
fix remote fwding with same listen port but different listen address fix remote fwding with same listen port but different listen address
with gerhard@, ok djm@ with gerhard@, ok djm@
- markus@cvs.openbsd.org 2014/06/27 18:50:39
[ssh-add.c]
fix loading of private keys
20140618 20140618
- (tim) [openssh/session.c] Work around to get chroot sftp working on UnixWare - (tim) [openssh/session.c] Work around to get chroot sftp working on UnixWare

View File

@ -1,4 +1,4 @@
/* $OpenBSD: ssh-add.c,v 1.110 2014/06/24 01:13:21 djm Exp $ */ /* $OpenBSD: ssh-add.c,v 1.111 2014/06/27 18:50:39 markus Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -202,14 +202,14 @@ add_file(AuthenticationConnection *ac, const char *filename, int key_only)
close(fd); close(fd);
/* At first, try empty passphrase */ /* At first, try empty passphrase */
if ((r = sshkey_parse_private_fileblob(&keyblob, filename, "", if ((r = sshkey_parse_private_fileblob(&keyblob, "", filename,
&private, &comment)) != 0 && r != SSH_ERR_KEY_WRONG_PASSPHRASE) &private, &comment)) != 0 && r != SSH_ERR_KEY_WRONG_PASSPHRASE)
fatal("Cannot parse %s: %s", filename, ssh_err(r)); fatal("Cannot parse %s: %s", filename, ssh_err(r));
if (comment == NULL) if (comment == NULL)
comment = xstrdup(filename); comment = xstrdup(filename);
/* try last */ /* try last */
if (private == NULL && pass != NULL) { if (private == NULL && pass != NULL) {
if ((r = sshkey_parse_private_fileblob(&keyblob, filename, pass, if ((r = sshkey_parse_private_fileblob(&keyblob, pass, filename,
&private, &comment)) != 0 && &private, &comment)) != 0 &&
r != SSH_ERR_KEY_WRONG_PASSPHRASE) r != SSH_ERR_KEY_WRONG_PASSPHRASE)
fatal("Cannot parse %s: %s", filename, ssh_err(r)); fatal("Cannot parse %s: %s", filename, ssh_err(r));
@ -228,7 +228,7 @@ add_file(AuthenticationConnection *ac, const char *filename, int key_only)
return -1; return -1;
} }
if ((r = sshkey_parse_private_fileblob(&keyblob, if ((r = sshkey_parse_private_fileblob(&keyblob,
filename, pass, &private, &comment)) != 0 && pass, filename, &private, NULL)) != 0 &&
r != SSH_ERR_KEY_WRONG_PASSPHRASE) r != SSH_ERR_KEY_WRONG_PASSPHRASE)
fatal("Cannot parse %s: %s", fatal("Cannot parse %s: %s",
filename, ssh_err(r)); filename, ssh_err(r));