summarylogtreecommitdiffstats
path: root/allow-preserve-env-with-arg.patch
diff options
context:
space:
mode:
Diffstat (limited to 'allow-preserve-env-with-arg.patch')
-rw-r--r--allow-preserve-env-with-arg.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/allow-preserve-env-with-arg.patch b/allow-preserve-env-with-arg.patch
new file mode 100644
index 000000000000..8bf6acc1be47
--- /dev/null
+++ b/allow-preserve-env-with-arg.patch
@@ -0,0 +1,35 @@
+
+# HG changeset patch
+# User Todd C. Miller <Todd.Miller@sudo.ws>
+# Date 1526483443 21600
+# Node ID 8ea75ca8fbd2de3877fed1b83a63d9ac8a9c14b1
+# Parent 7972215392428f23eb47c11ddffc0cc8a824fff0
+Only set MODE_PRESERVE_ENV when preserving the entire environment.
+Fixes a problem introduced in 1.8.23 where "sudo -i" could not be
+used in conjunction with --preserve-env=VARIABLE. Bug #835
+
+diff -r 797221539242 -r 8ea75ca8fbd2 src/parse_args.c
+--- a/src/parse_args.c Tue May 15 16:35:07 2018 -0600
++++ b/src/parse_args.c Wed May 16 09:10:43 2018 -0600
+@@ -330,14 +330,15 @@
+ case 'E':
+ /*
+ * Optional argument is a comma-separated list of
+- * environment variables to preserve. If not present,
+- * preserve everything.
++ * environment variables to preserve.
++ * If not present, preserve everything.
+ */
+- if (optarg == NULL)
++ if (optarg == NULL) {
+ sudo_settings[ARG_PRESERVE_ENVIRONMENT].value = "true";
+- else
++ SET(flags, MODE_PRESERVE_ENV);
++ } else {
+ parse_env_list(&extra_env, optarg);
+- SET(flags, MODE_PRESERVE_ENV);
++ }
+ break;
+ case 'e':
+ if (mode && mode != MODE_EDIT)
+