File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818#include <ctype.h>
1919#include <errno.h>
2020#include <fcntl.h>
21+ #include <fnmatch.h>
2122#include <limits.h>
2223#ifdef HAVE_LINUX_CLOSE_RANGE_H
2324# include <linux/close_range.h>
@@ -129,18 +130,22 @@ env_filter(void)
129130 }
130131
131132 TAILQ_FOREACH (env , env_list , entries ) {
133+ RC_STRING * var ;
134+
132135 /* Check the whitelist */
133136 if (env_allowed (env_allowlist , env -> value ))
134137 continue ;
135138 if (rc_is_user () && env_allowed (usrenv_allowlist , env -> value ))
136139 continue ;
137140
138141 /* Check our user defined list */
139- if (rc_stringlist_find (env_allow , env -> value ))
140- continue ;
142+ TAILQ_FOREACH (var , env_allow , entries )
143+ if (fnmatch (var -> value , env -> value , FNM_NOESCAPE | FNM_PERIOD ) == 0 )
144+ goto next ;
141145
142146 /* OK, not allowed! */
143147 unsetenv (env -> value );
148+ next :;
144149 }
145150
146151 /* Now add anything missing from the profile */
You can’t perform that action at this time.
0 commit comments