1 Star 0 Fork 25

池鱼/util-linux

forked from src-anolis-os/util-linux 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0074-Complete-Linux-PAM-compliance-for-forked-child-in-su.patch 1.97 KB
一键复制 编辑 原始数据 按行查看 历史
From 9e7cedda86e5356d1723e6bd0bab5e38c4fe4a34 Mon Sep 17 00:00:00 2001
From: "Andrew G. Morgan" <morgan@kernel.org>
Date: Sat, 27 Nov 2021 21:00:22 -0800
Subject: [PATCH 74/74] Complete Linux-PAM compliance for forked child in su
and login.
As documented here:
http://www.linux-pam.org/Linux-PAM-html/adg-interface-by-app-expected.html#adg-pam_end
The child that is about to exec*() the user shell is supposed to pam_end()
with PAM_DATA_SILENT. This gives the modules a last chance to do a minor
cleanup of the module state before the user's shell is launched.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1950187
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2033566
Upstream: http://github.com/util-linux/util-linux/commit/4660286e9cdff6d95b49295674b96f83af10ea36
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
---
login-utils/login.c | 3 +++
login-utils/su-common.c | 3 +++
2 files changed, 6 insertions(+)
diff --git a/login-utils/login.c b/login-utils/login.c
index 8c9e43292..9f50fe03b 100644
--- a/login-utils/login.c
+++ b/login-utils/login.c
@@ -1370,6 +1370,9 @@ int main(int argc, char **argv)
childArgv[childArgc++] = NULL;
+ /* http://www.linux-pam.org/Linux-PAM-html/adg-interface-by-app-expected.html#adg-pam_end */
+ (void) pam_end(cxt.pamh, PAM_SUCCESS|PAM_DATA_SILENT);
+
execvp(childArgv[0], childArgv + 1);
if (!strcmp(childArgv[0], "/bin/sh"))
diff --git a/login-utils/su-common.c b/login-utils/su-common.c
index c1b1a04e4..825ff1d5a 100644
--- a/login-utils/su-common.c
+++ b/login-utils/su-common.c
@@ -1428,6 +1428,9 @@ int su_main(int argc, char **argv, int mode)
if (su->simulate_login && chdir(su->pwd->pw_dir) != 0)
warn(_("warning: cannot change directory to %s"), su->pwd->pw_dir);
+ /* http://www.linux-pam.org/Linux-PAM-html/adg-interface-by-app-expected.html#adg-pam_end */
+ (void) pam_end(su->pamh, PAM_SUCCESS|PAM_DATA_SILENT);
+
if (shell)
run_shell(su, shell, command, argv + optind, max(0, argc - optind));
--
2.31.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zxy19951122/util-linux.git
git@gitee.com:zxy19951122/util-linux.git
zxy19951122
util-linux
util-linux
a8

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385