upstream commit

Expand tildes in filenames passed to -i before checking
 whether or not the identity file exists.  This means that if the shell
 doesn't do the expansion (eg because the option and filename were given as a
 single argument) then we'll still add the key.  bz#2481, ok markus@

Upstream-ID: db1757178a14ac519e9a3e1a2dbd21113cb3bfc6
This commit is contained in:
dtucker@openbsd.org 2015-10-25 23:42:00 +00:00 committed by Damien Miller
parent 97e184e508
commit 03239c1831
1 changed files with 7 additions and 6 deletions

13
ssh.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: ssh.c,v 1.428 2015/10/16 18:40:49 djm Exp $ */ /* $OpenBSD: ssh.c,v 1.429 2015/10/25 23:42:00 dtucker 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
@ -714,13 +714,14 @@ main(int ac, char **av)
options.gss_deleg_creds = 1; options.gss_deleg_creds = 1;
break; break;
case 'i': case 'i':
if (stat(optarg, &st) < 0) { p = tilde_expand_filename(optarg, original_real_uid);
if (stat(p, &st) < 0)
fprintf(stderr, "Warning: Identity file %s " fprintf(stderr, "Warning: Identity file %s "
"not accessible: %s.\n", optarg, "not accessible: %s.\n", p,
strerror(errno)); strerror(errno));
break; else
} add_identity_file(&options, NULL, p, 1);
add_identity_file(&options, NULL, optarg, 1); free(p);
break; break;
case 'I': case 'I':
#ifdef ENABLE_PKCS11 #ifdef ENABLE_PKCS11