summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/ssh.c
diff options
context:
space:
mode:
authordtucker <dtucker@openbsd.org>2015-10-25 23:42:00 +0000
committerdtucker <dtucker@openbsd.org>2015-10-25 23:42:00 +0000
commit2520371209a90f9f79a0100c160a60228bdc4d22 (patch)
tree7e29c27a77ba62444542964d35b38ba784d21db1 /usr.bin/ssh/ssh.c
parentPlug memory leak introduced in r1.15. (diff)
downloadwireguard-openbsd-2520371209a90f9f79a0100c160a60228bdc4d22.tar.xz
wireguard-openbsd-2520371209a90f9f79a0100c160a60228bdc4d22.zip
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@
Diffstat (limited to 'usr.bin/ssh/ssh.c')
-rw-r--r--usr.bin/ssh/ssh.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c
index ace67f5991b..7021bc54a3d 100644
--- a/usr.bin/ssh/ssh.c
+++ b/usr.bin/ssh/ssh.c
@@ -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>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -684,13 +684,14 @@ main(int ac, char **av)
options.gss_deleg_creds = 1;
break;
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 "
- "not accessible: %s.\n", optarg,
+ "not accessible: %s.\n", p,
strerror(errno));
- break;
- }
- add_identity_file(&options, NULL, optarg, 1);
+ else
+ add_identity_file(&options, NULL, p, 1);
+ free(p);
break;
case 'I':
#ifdef ENABLE_PKCS11