Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
b858908cfe
!37 [sync] PR-36: Move temporary files from /var/run to /run to delete warning in installing
From: @openeuler-sync-bot 
Reviewed-by: @HuaxinLuGitee 
Signed-off-by: @HuaxinLuGitee
2025-03-12 02:11:22 +00:00
yixiangzhike
c43aff3d75 Move temporary files from /var/run to /run to delete warning in installing
(cherry picked from commit 514383e2d24b714a68127b3aab147d3f3d270376)
2025-03-11 15:39:08 +08:00
openeuler-ci-bot
581ea24f51
!28 [sync] PR-26: 【openEuler-22.03-LTS-SP1】Fix NULL pointer deref on memory allocation failure
From: @openeuler-sync-bot 
Reviewed-by: @dillon_chen 
Signed-off-by: @dillon_chen
2024-10-25 08:59:55 +00:00
yixiangzhike
3418927262 Fix NULL pointer deref on memory allocation failure
(cherry picked from commit 0f4d5f76ae1793b2f50ddb06c619e95f40e47130)
2024-10-25 15:12:26 +08:00
openeuler-ci-bot
23c0dd8498
!20 [sync] PR-19: 【openEuler-22.03-LTS-SP1】Fix memory leak in config parsing
From: @openeuler-sync-bot 
Reviewed-by: @dillon_chen 
Signed-off-by: @dillon_chen
2024-10-11 07:43:29 +00:00
yixiangzhike
2861370c0e Fix memory leak in config parsing
(cherry picked from commit c9393ef5097874df86a1ead0b0c13c7c24558f0f)
2024-10-10 17:46:59 +08:00
openeuler-ci-bot
c12a5a2c98
!9 【openEuler-22.03-LTS-Next】update to 0.9.12
From: @yixiangzhike 
Reviewed-by: @houmingyong, @HuaxinLuGitee 
Signed-off-by: @HuaxinLuGitee
2022-10-25 09:13:28 +00:00
yixiangzhike
eb240ef98a update to 0.9.12
Signed-off-by: yixiangzhike <yixiangzhike007@163.com>
2022-10-24 12:38:56 +08:00
openeuler-ci-bot
e358e06e34
!7 【openEuler-22.03-LTS-Next】fix one error in closing file descriptors
From: @yixiangzhike 
Reviewed-by: @houmingyong, @HuaxinLuGitee 
Signed-off-by: @HuaxinLuGitee
2022-10-19 03:47:39 +00:00
yixiangzhike
d3b20da1f4 fix one error in closing file descriptors
Signed-off-by: yixiangzhike <yixiangzhike007@163.com>
2022-10-19 09:42:54 +08:00
10 changed files with 142 additions and 7 deletions

View File

@ -0,0 +1,46 @@
From 91bb8c995f977d289077e6a6dceff74f4aed60b6 Mon Sep 17 00:00:00 2001
From: Arthur de Jong <arthur@arthurdejong.org>
Date: Tue, 27 Aug 2024 21:20:29 +0200
Subject: [PATCH] Fix NULL pointer deref on memory allocation failure
This fixes a NULL pointer dereference when a call to malloc() failed.
Closes https://github.com/arthurdejong/nss-pam-ldapd/issues/70
---
nslcd/passwd.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/nslcd/passwd.c b/nslcd/passwd.c
index a4e2678..59b21d0 100644
--- a/nslcd/passwd.c
+++ b/nslcd/passwd.c
@@ -5,7 +5,7 @@
Copyright (C) 1997-2005 Luke Howard
Copyright (C) 2006 West Consulting
- Copyright (C) 2006-2017 Arthur de Jong
+ Copyright (C) 2006-2024 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -293,8 +293,16 @@ char *dn2uid(MYLDAP_SESSION *session, const char *dn, char *buf, size_t buflen)
/* see if we have a cached entry */
pthread_mutex_lock(&dn2uid_cache_mutex);
if (dn2uid_cache == NULL)
+ {
dn2uid_cache = dict_new();
- if ((dn2uid_cache != NULL) && ((cacheentry = dict_get(dn2uid_cache, dn)) != NULL))
+ if (dn2uid_cache == NULL)
+ {
+ log_log(LOG_ERR, "dict_new() failed to allocate memory");
+ pthread_mutex_unlock(&dn2uid_cache_mutex);
+ return NULL;
+ }
+ }
+ if ((cacheentry = dict_get(dn2uid_cache, dn)) != NULL)
{
if ((cacheentry->uid != NULL) && (strlen(cacheentry->uid) < buflen))
{
--
2.33.0

View File

@ -0,0 +1,29 @@
From 9a353ac7f84a2b6485dd1bb1b272cb8405bd4e9e Mon Sep 17 00:00:00 2001
From: Arthur de Jong <arthur@arthurdejong.org>
Date: Tue, 27 Aug 2024 21:39:21 +0200
Subject: [PATCH] Fix memory leak in config parsing
This fixes a one-time memory leak in reading the base configuration
option.
---
nslcd/cfg.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/nslcd/cfg.c b/nslcd/cfg.c
index 86917d5..6e56161 100644
--- a/nslcd/cfg.c
+++ b/nslcd/cfg.c
@@ -685,7 +685,10 @@ static void handle_base(const char *filename, int lnr,
#endif /* not HAVE_LDAP_DOMAIN2DN */
}
if (strcasecmp(value, "\"\"") == 0)
+ {
+ free(value);
value = "";
+ }
/* find the spot in the list of bases */
for (i = 0; i < NSS_LDAP_CONFIG_MAX_BASES; i++)
if (bases[i] == NULL)
--
2.33.0

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

@ -5,7 +5,7 @@ Documentation=man:nslcd(8) man:nslcd.conf(5)
[Service]
Type=forking
PIDFile=/var/run/nslcd/nslcd.pid
PIDFile=/run/nslcd/nslcd.pid
ExecStart=/usr/sbin/nslcd
RestartSec=10s
Restart=on-failure

View File

@ -1,2 +1,2 @@
# nslcd needs a directory in /var/run to store its pid file and socket
d /var/run/nslcd 0775 nslcd root
# nslcd needs a directory in /run to store its pid file and socket
d /run/nslcd 0775 nslcd root

Binary file not shown.

Binary file not shown.

BIN
nss-pam-ldapd-0.9.12.tar.gz Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,8 +1,8 @@
%define _hardened_build 1
Name: nss-pam-ldapd
Version: 0.9.11
Release: 1
Version: 0.9.12
Release: 4
Summary: NSS and PAM libraries for name lookups and authentication using LDAP
License: LGPLv2+
URL: http://arthurdejong.org/nss-pam-ldapd/
@ -13,6 +13,9 @@ 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
Patch3: backport-Fix-memory-leak-in-config-parsing.patch
Patch4: backport-Fix-NULL-pointer-deref-on-memory-allocation-failure.patch
BuildRequires: gcc, openldap-devel, krb5-devel, autoconf, automake, pam-devel, systemd-units
%{?systemd_requires}
@ -64,7 +67,7 @@ ln -s libnss_ldap.so.2 $RPM_BUILD_ROOT/%{_lib}/libnss_ldap.so
sed -i -e 's,^uid.*,uid nslcd,g' -e 's,^gid.*,gid ldap,g' \
$RPM_BUILD_ROOT/%{_sysconfdir}/nslcd.conf
touch -r nslcd.conf $RPM_BUILD_ROOT/%{_sysconfdir}/nslcd.conf
mkdir -p -m 0755 $RPM_BUILD_ROOT/var/run/nslcd
mkdir -p -m 0755 $RPM_BUILD_ROOT/run/nslcd
mkdir -p -m 0755 $RPM_BUILD_ROOT/%{_tmpfilesdir}
install -p -m 0644 %{SOURCE3} $RPM_BUILD_ROOT/%{_tmpfilesdir}/%{name}.conf
@ -94,12 +97,42 @@ getent passwd nslcd > /dev/null || \
%attr(0600,root,root) %config(noreplace) %verify(not md5 size mtime) /etc/nslcd.conf
%attr(0644,root,root) %config(noreplace) %{_tmpfilesdir}/%{name}.conf
%{_unitdir}/nslcd.service
%attr(0775,nslcd,root) /var/run/nslcd
%attr(0775,nslcd,root) /run/nslcd
%files help
%{_mandir}/*/*
%changelog
* Wed Mar 5 2025 yixiangzhike <yixiangzhike007@163.com> - 0.9.12-4
- Type:bugfix
- ID:NA
- SUG:restart
- DESC:Move temporary files from /var/run to /run to delete warning in installing
* Thu Oct 24 2024 yixiangzhike <yixiangzhike007@163.com> - 0.9.12-3
- Type:bugfix
- ID:NA
- SUG:restart
- DESC:Fix NULL pointer deref on memory allocation failure
* Wed Oct 09 2024 yixiangzhike <yixiangzhike007@163.com> - 0.9.12-2
- Type:bugfix
- ID:NA
- SUG:restart
- DESC:fix memory leak in config parsing
* Mon Oct 24 2022 yixiangzhike <yixiangzhike007@163.com> - 0.9.12-1
- Type:task
- ID:NA
- SUG:restart
- DESC:update to 0.9.12
* Wed Oct 19 2022 yixiangzhike <yixiangzhike007@163.com> - 0.9.11-2
- Type:bugfix
- ID:NA
- SUG:restart
- DESC:fix off-by one error in closing file descriptors
* Mon Jul 27 2020 Liquor <lirui130@huawei.com> - 0.9.11-1
- Type:bugfix
- ID:NA