summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordtucker@openbsd.org <dtucker@openbsd.org>2015-10-25 23:42:00 +0000
committerDamien Miller <djm@mindrot.org>2015-10-29 19:07:13 +1100
commit03239c18312b9bab7d1c3b03062c61e8bbc1ca6e (patch)
treedaf73ca92db941ce8cd5f4f5c4e97880e77bd894
parent97e184e508dd33c37860c732c0eca3fc57698b40 (diff)
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
-rw-r--r--ssh.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ssh.c b/ssh.c
index de4e61552..cceb36e83 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh.c,v 1.428 2015/10/16 18:40:49 djm Exp $ */ 1/* $OpenBSD: ssh.c,v 1.429 2015/10/25 23:42:00 dtucker 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
@@ -714,13 +714,14 @@ main(int ac, char **av)
714 options.gss_deleg_creds = 1; 714 options.gss_deleg_creds = 1;
715 break; 715 break;
716 case 'i': 716 case 'i':
717 if (stat(optarg, &st) < 0) { 717 p = tilde_expand_filename(optarg, original_real_uid);
718 if (stat(p, &st) < 0)
718 fprintf(stderr, "Warning: Identity file %s " 719 fprintf(stderr, "Warning: Identity file %s "
719 "not accessible: %s.\n", optarg, 720 "not accessible: %s.\n", p,
720 strerror(errno)); 721 strerror(errno));
721 break; 722 else
722 } 723 add_identity_file(&options, NULL, p, 1);
723 add_identity_file(&options, NULL, optarg, 1); 724 free(p);
724 break; 725 break;
725 case 'I': 726 case 'I':
726#ifdef ENABLE_PKCS11 727#ifdef ENABLE_PKCS11