From 7a06f32cbbd70e38c2af6a1e16eaec00182360c5 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 13 Jun 2011 07:20:28 -0400 Subject: [PATCH] Preserve SHELL variable for "sudo -s". Otherwise we can end up with a situation where the SHELL variable and the actual shell being run do not match. --- plugins/sudoers/env.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/sudoers/env.c b/plugins/sudoers/env.c index 3e713fd65..6d6571899 100644 --- a/plugins/sudoers/env.c +++ b/plugins/sudoers/env.c @@ -390,6 +390,10 @@ matches_env_keep(const char *var) size_t len; int iswild, keepit = FALSE; + /* Preserve SHELL variable for "sudo -s". */ + if (ISSET(sudo_mode, MODE_SHELL) && strncmp(var, "SHELL=", 6) == 0) + return TRUE; + for (cur = def_env_keep; cur; cur = cur->next) { len = strlen(cur->value); /* Deal with '*' wildcard */ -- 2.40.0