summaryrefslogtreecommitdiffstats
path: root/auth-options.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 /auth-options.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 'auth-options.c')
-rw-r--r--auth-options.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/auth-options.c b/auth-options.c
index 27c0eb05..b05d6d6f 100644
--- a/auth-options.c
+++ b/auth-options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth-options.c,v 1.83 2018/06/19 02:59:41 djm Exp $ */
+/* $OpenBSD: auth-options.c,v 1.84 2018/10/03 06:38:35 djm Exp $ */
/*
* Copyright (c) 2018 Damien Miller <djm@mindrot.org>
*
@@ -469,13 +469,16 @@ sshauthopt_parse(const char *opts, const char **errstrp)
errstr = "invalid environment string";
goto fail;
}
- for (cp = opt; cp < tmp; cp++) {
- if (!isalnum((u_char)*cp) && *cp != '_') {
- free(opt);
- errstr = "invalid environment string";
- goto fail;
- }
+ if ((cp = strdup(opt)) == NULL)
+ goto alloc_fail;
+ cp[tmp - opt] = '\0'; /* truncate at '=' */
+ if (!valid_env_name(cp)) {
+ free(cp);
+ free(opt);
+ errstr = "invalid environment string";
+ goto fail;
}
+ free(cp);
/* Append it. */
oarray = ret->env;
if ((ret->env = recallocarray(ret->env, ret->nenv,