summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTavis Ormandy <taviso@gentoo.org>2004-11-11 23:25:15 +0000
committerTavis Ormandy <taviso@gentoo.org>2004-11-11 23:25:15 +0000
commit9ddd1e1f598e77087bb0c02ba4b100b098329ce2 (patch)
tree1732cf298d97f21989097d5fdfe6817e9b263de8 /app-admin/sudo/files
parentfix typo (Manifest recommit) (diff)
downloadgentoo-2-9ddd1e1f598e77087bb0c02ba4b100b098329ce2.tar.gz
gentoo-2-9ddd1e1f598e77087bb0c02ba4b100b098329ce2.tar.bz2
gentoo-2-9ddd1e1f598e77087bb0c02ba4b100b098329ce2.zip
strip bash functions from environment
Diffstat (limited to 'app-admin/sudo/files')
-rw-r--r--app-admin/sudo/files/sudo-strip-bash-functions.diff44
1 files changed, 44 insertions, 0 deletions
diff --git a/app-admin/sudo/files/sudo-strip-bash-functions.diff b/app-admin/sudo/files/sudo-strip-bash-functions.diff
new file mode 100644
index 000000000000..1bd6d6483508
--- /dev/null
+++ b/app-admin/sudo/files/sudo-strip-bash-functions.diff
@@ -0,0 +1,44 @@
+Index: env.c
+===================================================================
+RCS file: /home/cvs/courtesan/sudo/env.c,v
+retrieving revision 1.42
+retrieving revision 1.43
+diff -u -r1.42 -r1.43
+--- env.c 8 Sep 2004 15:57:49 -0000 1.42
++++ env.c 11 Nov 2004 16:20:59 -0000 1.43
+@@ -52,7 +52,7 @@
+ #include "sudo.h"
+
+ #ifndef lint
+-static const char rcsid[] = "$Sudo: env.c,v 1.42 2004/09/08 15:57:49 millert Exp $";
++static const char rcsid[] = "$Sudo: env.c,v 1.43 2004/11/11 16:20:59 millert Exp $";
+ #endif /* lint */
+
+ /*
+@@ -323,6 +323,13 @@
+ /* Pull in vars we want to keep from the old environment. */
+ for (ep = envp; *ep; ep++) {
+ keepit = 0;
++
++ /* Skip variables with values beginning with () (bash functions) */
++ if ((cp = strchr(*ep, '=')) != NULL) {
++ if (strncmp(cp, "=() ", 3) == 0)
++ continue;
++ }
++
+ for (cur = def_env_keep; cur; cur = cur->next) {
+ len = strlen(cur->value);
+ /* Deal with '*' wildcard */
+@@ -404,6 +411,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_env_delete; cur && okvar; cur = cur->next) {