summaryrefslogtreecommitdiff
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 27c0eb05e..b05d6d6f3 100644
--- a/auth-options.c
+++ b/auth-options.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth-options.c,v 1.83 2018/06/19 02:59:41 djm Exp $ */ 1/* $OpenBSD: auth-options.c,v 1.84 2018/10/03 06:38:35 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Damien Miller <djm@mindrot.org> 3 * Copyright (c) 2018 Damien Miller <djm@mindrot.org>
4 * 4 *
@@ -469,13 +469,16 @@ sshauthopt_parse(const char *opts, const char **errstrp)
469 errstr = "invalid environment string"; 469 errstr = "invalid environment string";
470 goto fail; 470 goto fail;
471 } 471 }
472 for (cp = opt; cp < tmp; cp++) { 472 if ((cp = strdup(opt)) == NULL)
473 if (!isalnum((u_char)*cp) && *cp != '_') { 473 goto alloc_fail;
474 free(opt); 474 cp[tmp - opt] = '\0'; /* truncate at '=' */
475 errstr = "invalid environment string"; 475 if (!valid_env_name(cp)) {
476 goto fail; 476 free(cp);
477 } 477 free(opt);
478 errstr = "invalid environment string";
479 goto fail;
478 } 480 }
481 free(cp);
479 /* Append it. */ 482 /* Append it. */
480 oarray = ret->env; 483 oarray = ret->env;
481 if ((ret->env = recallocarray(ret->env, ret->nenv, 484 if ((ret->env = recallocarray(ret->env, ret->nenv,