From 0cd89e34e34c359a9c6564b7183a7f38d9547511 Mon Sep 17 00:00:00 2001 From: yixiangzhike Date: Wed, 19 Oct 2022 09:48:36 +0800 Subject: [PATCH] fix one error in closing file descriptors Signed-off-by: yixiangzhike --- ...ne-error-in-closing-file-descriptors.patch | 27 +++++++++++++++++++ nss-pam-ldapd.spec | 9 ++++++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 backport-Fix-off-by-one-error-in-closing-file-descriptors.patch diff --git a/backport-Fix-off-by-one-error-in-closing-file-descriptors.patch b/backport-Fix-off-by-one-error-in-closing-file-descriptors.patch new file mode 100644 index 0000000..c0e2354 --- /dev/null +++ b/backport-Fix-off-by-one-error-in-closing-file-descriptors.patch @@ -0,0 +1,27 @@ +From 1c9b021e78dc67b9cdca5f9ad10cbde08418ee28 Mon Sep 17 00:00:00 2001 +From: Arthur de Jong +Date: Mon, 10 Oct 2022 23:15:06 +0200 +Subject: [PATCH] Fix off-by one error in closing file descriptors + +This could leave file descriptor 3 open from the parent process starting +nslcd. +--- + nslcd/daemonize.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/nslcd/daemonize.c b/nslcd/daemonize.c +index d11d358..be3b386 100644 +--- a/nslcd/daemonize.c ++++ b/nslcd/daemonize.c +@@ -50,7 +50,7 @@ void daemonize_closefds(void) + hope we closed enough */ + if (i < 0) + i = 32; +- for (; i > 3; i--) ++ for (; i > 2; i--) + close(i); + } + +-- +2.27.0 + diff --git a/nss-pam-ldapd.spec b/nss-pam-ldapd.spec index 4006e36..95c0fb8 100644 --- a/nss-pam-ldapd.spec +++ b/nss-pam-ldapd.spec @@ -2,7 +2,7 @@ Name: nss-pam-ldapd Version: 0.9.12 -Release: 1 +Release: 2 Summary: NSS and PAM libraries for name lookups and authentication using LDAP License: LGPLv2+ URL: http://arthurdejong.org/nss-pam-ldapd/ @@ -13,6 +13,7 @@ Source4: nslcd.service Patch0: 0001-Disable-pylint-tests.patch Patch1: 0002-Watch-for-uint32_t-overflows.patch +Patch2: backport-Fix-off-by-one-error-in-closing-file-descriptors.patch BuildRequires: gcc, openldap-devel, krb5-devel, autoconf, automake, pam-devel, systemd-units %{?systemd_requires} @@ -100,6 +101,12 @@ getent passwd nslcd > /dev/null || \ %{_mandir}/*/* %changelog +* Wed Oct 19 2022 yixiangzhike - 0.9.12-2 +- Type:bugfix +- ID:NA +- SUG:restart +- DESC:fix off-by one error in closing file descriptors + * Mon Feb 21 2022 yixiangzhike - 0.9.12-1 - Type:bugfix - ID:NA -- Gitee