summaryrefslogtreecommitdiff
blob: 021005f888c4ec1302325bd1db9636cdecb01ce9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
diff -ruN sudo-1.6.7p5/env.c sudo-1.6.7p5.new/env.c
--- sudo-1.6.7p5/env.c	2003-05-06 05:32:22.000000000 +0100
+++ sudo-1.6.7p5.new/env.c	2004-11-11 23:27:47.659539072 +0000
@@ -296,7 +296,14 @@
 	/* Pull in vars we want to keep from the old environment. */
 	for (ep = envp; *ep; ep++) {
 	    keepit = 0;
-	    for (cur = def_list(I_ENV_KEEP); cur; cur = cur->next) {
+
+		/* Skip variables with values beginning with () (bash functions) */
+		if ((cp = strchr(*ep, '=')) != NULL) {
+			if (strncmp(cp, "=() ", 3) == 0)
+				continue;
+		}
+	    
+		for (cur = def_list(I_ENV_KEEP); cur; cur = cur->next) {
 		len = strlen(cur->value);
 		/* Deal with '*' wildcard */
 		if (cur->value[len - 1] == '*') {
@@ -370,6 +377,12 @@
 	for (ep = envp; *ep; ep++) {
 	    okvar = 1;
 
+		/* Skip variables with values beginning with () (bash functions) */
+		if ((cp = strchr(*ep, '=')) != NULL) {
+			if (strncmp(cp, "=() ", 3) == 0)
+				continue;
+		}
+
 	    /* Skip anything listed in env_delete. */
 	    for (cur = def_list(I_ENV_DELETE); cur && okvar; cur = cur->next) {
 		len = strlen(cur->value);