- Resolves: RHEL-59136 - sudo passes SHELL environment variable twice to the shell being executed [rhel-10]

- Resolves: RHEL-128212 - [RFE] request to backport support for regex in sudo [rhel-10]
- Resolves: RHEL-112100 - Rebase of sudo to 1.9.17p2 [rhel-10]
This commit is contained in:
Alejandro López 2025-11-07 16:05:42 +01:00
parent 02e5985e44
commit af6f43a7df
2 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,32 @@
From 3d467a705ea6ee53081cb11cc21ecf08eb47700d Mon Sep 17 00:00:00 2001
From: "Todd C. Miller" <Todd.Miller@sudo.ws>
Date: Thu, 6 Nov 2025 12:05:24 -0700
Subject: [PATCH] rebuild_env: Avoid setting SHELL twice for "sudo -i"
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Make sure DID_SHELL is set when we set SHELL in the "sudo -i" case.
Otherwise, it will be set again when setting fallback values.
Reported by Alejandro López at Red Hat.
The code to make sure that SHELL is setu
---
plugins/sudoers/env.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/plugins/sudoers/env.c b/plugins/sudoers/env.c
index 866ef3991..61b615513 100644
--- a/plugins/sudoers/env.c
+++ b/plugins/sudoers/env.c
@@ -966,6 +966,7 @@ rebuild_env(const struct sudoers_context *ctx)
if (ISSET(ctx->mode, MODE_LOGIN_SHELL)) {
CHECK_SETENV2("SHELL", ctx->runas.pw->pw_shell,
ISSET(didvar, DID_SHELL), true);
+ SET(didvar, DID_SHELL);
#ifdef _AIX
CHECK_SETENV2("LOGIN", ctx->runas.pw->pw_name,
ISSET(didvar, DID_LOGIN), true);
--
2.51.1

View File

@ -34,6 +34,7 @@ BuildRequires: zlib-devel
Patch1: 0001-coverity.patch
Patch2: 0002-sudo-conf.patch
Patch3: 0003-rebuild_env-Avoid-setting-SHELL-twice-for-sudo-i.patch
%description
Sudo (superuser do) allows a system administrator to give certain