From b737cd29a5c0911a968050a927154d44e9ec9a53 Mon Sep 17 00:00:00 2001 From: si-gui <245140120@qq.com> Date: Thu, 3 Sep 2020 17:10:27 +0800 Subject: [PATCH] Subject: Modify etc group file directly in case of selinux attr changes Modify nss_wrapper.pl when it add user to group, the nss_wrapper.pl will change the /etc/group file's selinux attr from passwd_file_t to etc_t,so we modify the /etc/group directly Signed-off-by: si-gui <245140120@qq.com> --- nss_wrapper.pl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nss_wrapper.pl b/nss_wrapper.pl index 48fa2c5..73dd655 100755 --- a/nss_wrapper.pl +++ b/nss_wrapper.pl @@ -386,10 +386,9 @@ sub group_save($) push(@lines, $line); } - open(GROUP, ">$tmppath") or die("Unable to open '$tmppath' for write"); + open(GROUP, ">$path") or die("Unable to open '$path' for write"); print GROUP join("\n", @lines)."\n"; close(GROUP); - rename($tmppath, $path) or die("Unable to rename $tmppath => $path"); } sub passwd_add($$$$$) -- 2.23.0