2 * Security checks of environment
3 * Added from shadow-utils package
4 * by Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
13 extern char **environ;
15 static char * const forbid[] = {
17 "BASH_ENV=", /* GNU creeping featurism strikes again... */
22 "LD_", /* anything with the LD_ prefix */
32 /* these are allowed, but with no slashes inside
33 (to work around security problems in GNU gettext) */
34 static char * const noslash[] = {
37 "LC_", /* anything with the LC_ prefix */
44 char **envp = environ;
49 for (cur = envp; *cur; cur++) {
50 for (bad = forbid; *bad; bad++) {
51 if (strncmp(*cur, *bad, strlen(*bad)) == 0) {
52 for (move = cur; *move; move++)
60 for (cur = envp; *cur; cur++) {
61 for (bad = noslash; *bad; bad++) {
62 if (strncmp(*cur, *bad, strlen(*bad)) != 0)
64 if (!strchr(*cur, '/'))
66 for (move = cur; *move; move++)