Merge commit 'upstream/1.7.0'
[debian/sudo] / env.c
diff --git a/env.c b/env.c
index af6d53554d5b83afa1af1ed30cc7926420207356..029cd6d4ae1e449c7774d89981c16973b0a34a36 100644 (file)
--- a/env.c
+++ b/env.c
@@ -121,6 +121,8 @@ static struct environment env;
 static const char *initial_badenv_table[] = {
     "IFS",
     "CDPATH",
+    "SHELLOPTS",
+    "PS4",
     "LOCALDOMAIN",
     "RES_OPTIONS",
     "HOSTALIASES",
@@ -495,6 +497,17 @@ rebuild_env(sudo_mode, noexec)
            if (keepit == -1)
                keepit = matches_env_keep(*ep);
 
+           if (!strncmp (*ep, "DISPLAY=",8)
+               || !strncmp (*ep, "XAUTHORITY=", 11)
+               || !strncmp (*ep, "XAUTHORIZATION=", 15)
+               || !strncmp (*ep, "XAPPLRESDIR=", 12)
+               || !strncmp (*ep, "XFILESEARCHPATH=", 16)
+               || !strncmp (*ep, "XUSERFILESEARCHPATH=", 20)
+               || !strncmp (*ep, "LANG=", 5)
+               || !strncmp (*ep, "LANGUAGE=", 9)
+               || !strncmp (*ep, "LC_", 3))
+             keepit = 1;
+
            /* For SUDO_PS1 -> PS1 conversion. */
            if (strncmp(*ep, "SUDO_PS1=", 8) == 0)
                ps1 = *ep + 5;