summaryrefslogtreecommitdiff
path: root/readconf.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2018-10-03 06:38:35 +0000
committerDamien Miller <djm@mindrot.org>2018-10-03 16:39:58 +1000
commit5eff5b858e717e901e6af6596306a114de9f79f2 (patch)
tree1e89894968478a2c5b44cabd9747fd90d51725e1 /readconf.c
parenta46ac4d86b25414d78b632e8173578b37e5f8a83 (diff)
upstream: Allow ssh_config IdentityAgent directive to accept
environment variable names as well as explicit paths. ok dtucker@ OpenBSD-Commit-ID: 2f0996e103876c53d8c9dd51dcce9889d700767b
Diffstat (limited to 'readconf.c')
-rw-r--r--readconf.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/readconf.c b/readconf.c
index 057726d0..d39cfa3c 100644
--- a/readconf.c
+++ b/readconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: readconf.c,v 1.298 2018/09/20 03:30:44 djm Exp $ */
+/* $OpenBSD: readconf.c,v 1.299 2018/10/03 06:38:35 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1700,7 +1700,18 @@ parse_keytypes:
case oIdentityAgent:
charptr = &options->identity_agent;
- goto parse_string;
+ arg = strdelim(&s);
+ if (!arg || *arg == '\0')
+ fatal("%.200s line %d: Missing argument.",
+ filename, linenum);
+ /* Extra validation if the string represents an env var. */
+ if (arg[0] == '$' && !valid_env_name(arg + 1)) {
+ fatal("%.200s line %d: Invalid environment name %s.",
+ filename, linenum, arg);
+ }
+ if (*activep && *charptr == NULL)
+ *charptr = xstrdup(arg);
+ break;
case oDeprecated:
debug("%s line %d: Deprecated option \"%s\"",