summaryrefslogtreecommitdiff
path: root/servconf.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2022-06-03 04:30:46 +0000
committerDamien Miller <djm@mindrot.org>2022-06-03 14:33:18 +1000
commit22e1a3a71ad6d108ff0c5f07f93c3fcbd30f8b40 (patch)
tree51a3beeb61487d6449266b91203118595ab376f0 /servconf.c
parent38ed6c57e9e592c08e020fa6e82b45b4e1040970 (diff)
downloadopenssh-git-22e1a3a71ad6d108ff0c5f07f93c3fcbd30f8b40.tar.gz
upstream: Make SetEnv directives first-match-wins in both
sshd_config and sshd_config; previously if the same name was reused then the last would win (which is the opposite to how the config is supposed to work). While there, make the ssh_config parsing more like sshd_config. bz3438, ok dtucker OpenBSD-Commit-ID: 797909c1e0262c0d00e09280459d7ab00f18273b
Diffstat (limited to 'servconf.c')
-rw-r--r--servconf.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/servconf.c b/servconf.c
index 9d9681f1..29df0463 100644
--- a/servconf.c
+++ b/servconf.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: servconf.c,v 1.384 2022/03/18 04:04:11 djm Exp $ */
+/* $OpenBSD: servconf.c,v 1.385 2022/06/03 04:30:47 djm Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
* All rights reserved
@@ -2033,6 +2033,12 @@ process_server_config_line_depth(ServerOptions *options, char *line,
filename, linenum);
if (!*activep || uvalue != 0)
continue;
+ if (lookup_setenv_in_list(arg, options->setenv,
+ options->num_setenv) != NULL) {
+ debug2("%s line %d: ignoring duplicate env "
+ "name \"%.64s\"", filename, linenum, arg);
+ continue;
+ }
opt_array_append(filename, linenum, keyword,
&options->setenv, &options->num_setenv, arg);
}