From 22e1a3a71ad6d108ff0c5f07f93c3fcbd30f8b40 Mon Sep 17 00:00:00 2001 From: "djm@openbsd.org" Date: Fri, 3 Jun 2022 04:30:46 +0000 Subject: 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 --- servconf.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'servconf.c') 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 , 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); } -- cgit v1.2.3