From 5eff5b858e717e901e6af6596306a114de9f79f2 Mon Sep 17 00:00:00 2001 From: "djm@openbsd.org" Date: Wed, 3 Oct 2018 06:38:35 +0000 Subject: upstream: Allow ssh_config IdentityAgent directive to accept environment variable names as well as explicit paths. ok dtucker@ OpenBSD-Commit-ID: 2f0996e103876c53d8c9dd51dcce9889d700767b --- auth-options.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'auth-options.c') 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 @@ -/* $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 * @@ -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, -- cgit v1.2.3