!43 groupdel: fix SIGSEGV when passwd does not exist

Merge pull request !43 from panxh_purple/openEuler-20.03-LTS-SP3
This commit is contained in:
openeuler-ci-bot 2022-01-29 01:29:15 +00:00 committed by Gitee
commit d693779ef4
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,32 @@
From a757b458ffb4fb9a40bcbb4f7869449431c67f83 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Rigault?= <frigo@amadeus.com>
Date: Mon, 1 Nov 2021 13:54:25 +0100
Subject: [PATCH] groupdel: fix SIGSEGV when passwd does not exist
When using groupdel with a prefix, groupdel will attempt to read a
passwd file to look for any user in the group. When the file does not
exist it cores with segmentation fault.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1986111
Conflict: context adaptation
---
libmisc/prefix_flag.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libmisc/prefix_flag.c b/libmisc/prefix_flag.c
index cca553a..b6628ac 100644
--- a/libmisc/prefix_flag.c
+++ b/libmisc/prefix_flag.c
@@ -288,6 +288,9 @@ extern struct passwd* prefix_getpwent()
if(!passwd_db_file) {
return getpwent();
}
+ if (!fp_pwent) {
+ return NULL;
+ }
return fgetpwent(fp_pwent);
}
extern void prefix_endpwent()
--
1.8.3.1

View File

@ -1,6 +1,6 @@
Name: shadow
Version: 4.8.1
Release: 4
Release: 5
Epoch: 2
License: BSD and GPLv2+
Summary: Tools for managing accounts and shadow password files
@ -23,6 +23,7 @@ Patch6: add-home_mode-xml-file.patch
Patch7: shadow-4.1.5.1-var-lock.patch
Patch8: shadow-utils-fix-lock-file-residue.patch
Patch9: shadow-add-sm3-crypt-support.patch
Patch10: groupdel-fix-SIGSEGV-when-passwd-does-not-exist.patch
BuildRequires: gcc, libselinux-devel, audit-libs-devel, libsemanage-devel
BuildRequires: libacl-devel, libattr-devel gdb
@ -169,6 +170,9 @@ done
%{_mandir}/*/*
%changelog
* Fri Jan 28 2022 panxiaohe<panxh.life@foxmail.com> - 2:4.8.1-5
- groupdel: fix SIGSEGV when passwd does not exist
* Sat Oct 30 2021 wangcheng<wangcheng156@huawei.com> - 2:4.8.1-4
- add sm3 crypt support