!8 【Mainline】fix one error in closing file descriptors

From: @yixiangzhike 
Reviewed-by: @houmingyong, @HuaxinLuGitee 
Signed-off-by: @HuaxinLuGitee
This commit is contained in:
openeuler-ci-bot 2022-10-19 03:47:47 +00:00 committed by Gitee
commit 7285edf13a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,27 @@
From 1c9b021e78dc67b9cdca5f9ad10cbde08418ee28 Mon Sep 17 00:00:00 2001
From: Arthur de Jong <arthur@arthurdejong.org>
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

View File

@ -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 <yixiangzhike007@163.com> - 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 <yixiangzhike007@163.com> - 0.9.12-1
- Type:bugfix
- ID:NA