From: Todd C. Miller Date: Mon, 12 Nov 2001 04:51:57 +0000 (+0000) Subject: Add support for '*' in env_keep when not resetting the environment X-Git-Tag: SUDO_1_6_4~163 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=65302649f5795ad7be9909cc6fdd90c763a3673d;p=sudo Add support for '*' in env_keep when not resetting the environment (ie: the normal case). --- diff --git a/env.c b/env.c index 5c020457a..0027a4cce 100644 --- a/env.c +++ b/env.c @@ -399,7 +399,14 @@ rebuild_env(sudo_mode, envp) if (env_keep) { for (ek = env_keep; *ek; ek++) { eklen = strlen(*ek); - if (strncmp(*ek, *ep, eklen) == 0 && (*ep)[eklen] == '=') { + /* Deal with '*' wildcard */ + if ((*ek)[eklen - 1] == '*') { + eklen--; + iswild = 1; + } else + iswild = 0; + if (strncmp(*ek, *ep, eklen) == 0 && + (iswild || (*ep)[eklen] == '=')) { okvar = 1; break; }