From 83d841595a412cb36eee3aa6859cf5c7c5d41531 Mon Sep 17 00:00:00 2001 From: jiangheng Date: Thu, 5 May 2022 16:40:43 +0800 Subject: [PATCH] restore remove nscd --- glibc-1070416.patch | 38 +++++++++++++++++++ glibc.spec | 89 ++++++++++++++++++++++++++++++++++++++++++--- nscd.conf | 1 + 3 files changed, 123 insertions(+), 5 deletions(-) create mode 100644 glibc-1070416.patch create mode 100644 nscd.conf diff --git a/glibc-1070416.patch b/glibc-1070416.patch new file mode 100644 index 0000000..0975e0f --- /dev/null +++ b/glibc-1070416.patch @@ -0,0 +1,38 @@ +Short description: Add syslog.target dependency. +Author(s): Fedora glibc team +Origin: PATCH +Bug-Fedora: #1070416 +Upstream status: not-needed + +Fedora-specific changes to the nscd.service file. +See also: glibc-nscd-sysconfig.patch. + +--- a/nscd/nscd.service ++++ b/nscd/nscd.service +@@ -2,6 +2,7 @@ + + [Unit] + Description=Name Service Cache Daemon ++After=syslog.target + + [Service] + Type=forking +@@ -17,3 +18,4 @@ + + [Install] + WantedBy=multi-user.target ++Also=nscd.socket +diff --git a/nscd/nscd.socket b/nscd/nscd.socket +new file mode 100644 +index 0000000..7e512d5 +--- /dev/null ++++ b/nscd/nscd.socket +@@ -0,0 +1,8 @@ ++[Unit] ++Description=Name Service Cache Daemon Socket ++ ++[Socket] ++ListenDatagram=/var/run/nscd/socket ++ ++[Install] ++WantedBy=sockets.target diff --git a/glibc.spec b/glibc.spec index ddf7720..bea2751 100644 --- a/glibc.spec +++ b/glibc.spec @@ -66,12 +66,13 @@ ############################################################################## Name: glibc Version: 2.34 -Release: 78 +Release: 79 Summary: The GNU libc libraries License: %{all_license} URL: http://www.gnu.org/software/glibc/ Source0: https://ftp.gnu.org/gnu/glibc/%{name}-%{version}.tar.xz +Source1: nscd.conf Source2: nsswitch.conf Source3: bench.mk Source4: glibc-bench-compare @@ -83,6 +84,7 @@ Source7: replace_same_file_to_hard_link.py Source8: testsuite_whitelist %endif +Patch0: glibc-1070416.patch Patch1: glibc-c-utf8-locale.patch Patch2: backport-CVE-2021-38604-0001-librt-add-test-bug-28213.patch Patch3: backport-CVE-2021-38604-0002-librt-fix-NULL-pointer-dereference-bug-28213.patch @@ -241,7 +243,6 @@ Patch9019: 0003-elf-ld.so-use-special-mmap-for-hugepage-to-get-symbo.patch Patch9020: malloc-use-__get_nprocs-replace-__get_nprocs_sched.patch Patch9021: use-mlock-to-determine-hugepage-RLIMIT_MEMLOCK-soft-.patch -Obsoletes: nscd < 2.35 Provides: ldconfig rtld(GNU_HASH) bundled(gnulib) BuildRequires: audit-libs-devel >= 1.1.3, sed >= 3.95, libcap-devel, gettext @@ -399,6 +400,24 @@ The glibc-devel package contains the object files necessary for developing programs which use the standard C libraries. Besides, it contains the headers. Thus, it is necessory to install glibc-devel if you ned develop programs. +############################################################################## +# glibc "nscd" sub-package +############################################################################## +%package -n nscd +Summary: Name caching service daemon. +Requires: %{name} = %{version}-%{release} +%if %{without bootstrap} +Requires: libselinux >= 1.17.10-1 +%endif +Requires: audit-libs >= 1.1.3 +Requires(pre): shadow-utils, coreutils +Requires: systemd +Requires(postun): shadow-utils + +%description -n nscd +The nscd package is able to daemon caches name service lookups and improve +the performance with LDAP. + ############################################################################## # nss modules sub-package ############################################################################## @@ -583,8 +602,7 @@ pushd $builddir %if 0%{rpm_version_ge_412} --disable-crypt \ %endif - --disable-build-nscd \ - --disable-nscd || + || { cat config.log; false; } make %{?_smp_mflags} -O -r %{glibc_make_flags} @@ -676,11 +694,20 @@ install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT/etc/nsswitch.conf install -p -m 755 build-%{target}/nptl/libpthread-2.17.so $RPM_BUILD_ROOT%{_libdir} %endif +# This is for ncsd - in glibc 2.2 +install -m 644 nscd/nscd.conf $RPM_BUILD_ROOT/etc +mkdir -p $RPM_BUILD_ROOT%{_tmpfilesdir} +install -m 644 %{SOURCE1} %{buildroot}%{_tmpfilesdir} +mkdir -p $RPM_BUILD_ROOT/lib/systemd/system +install -m 644 nscd/nscd.service nscd/nscd.socket $RPM_BUILD_ROOT/lib/systemd/system + # Include ld.so.conf echo 'include ld.so.conf.d/*.conf' > $RPM_BUILD_ROOT/etc/ld.so.conf truncate -s 0 $RPM_BUILD_ROOT/etc/ld.so.cache chmod 644 $RPM_BUILD_ROOT/etc/ld.so.conf mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d +mkdir -p $RPM_BUILD_ROOT/etc/sysconfig +truncate -s 0 $RPM_BUILD_ROOT/etc/sysconfig/nscd truncate -s 0 $RPM_BUILD_ROOT/etc/gai.conf # Include %{_libdir}/gconv/gconv-modules.cache @@ -732,6 +759,10 @@ popd rm -f $RPM_BUILD_ROOT%{_infodir}/dir %endif +mkdir -p $RPM_BUILD_ROOT/var/{db,run}/nscd +touch $RPM_BUILD_ROOT/var/{db,run}/nscd/{passwd,group,hosts,services} +touch $RPM_BUILD_ROOT/var/run/nscd/{socket,nscd.pid} + mkdir -p $RPM_BUILD_ROOT%{_libdir} mv -f $RPM_BUILD_ROOT/%{_lib}/lib{pcprofile,memusage}.so \ $RPM_BUILD_ROOT%{_libdir} @@ -760,6 +791,7 @@ touch master.filelist touch glibc.filelist touch common.filelist touch devel.filelist +touch nscd.filelist touch nss_modules.filelist touch nss-devel.filelist touch libnsl.filelist @@ -814,6 +846,7 @@ cat master.filelist \ -e '%{_libdir}/lib.*\.a' \ -e '%{_libdir}/.*\.o' \ -e '%{_libdir}/lib.*\.so' \ + -e 'nscd' \ -e '%{_prefix}/bin' \ -e '%{_prefix}/lib/locale' \ -e '%{_prefix}/sbin/[^i]' \ @@ -840,7 +873,8 @@ echo '%{_libdir}/libpcprofile.so' >> glibc.filelist ############################################################################## grep '%{_prefix}/bin' master.filelist > common.filelist grep '%{_prefix}/sbin' master.filelist \ - | grep -v '%{_prefix}/sbin/iconvconfig' >> common.filelist + | grep -v '%{_prefix}/sbin/iconvconfig' \ + | grep -v 'nscd' >> common.filelist grep '%{_prefix}/share' master.filelist \ | grep -v \ @@ -872,6 +906,11 @@ grep '%{_libdir}/lib.*\.a' < master.filelist \ >> devel.filelist +############################################################################## +# glibc "nscd" sub-package +############################################################################## +echo '%{_prefix}/sbin/nscd' > nscd.filelist + ############################################################################## # nss modules sub-package ############################################################################## @@ -1234,6 +1273,24 @@ if [ -L %{_prefix}/include/scsi ] ; then rm -f %{_prefix}/include/scsi fi +%pre -n nscd +getent group nscd >/dev/null || /usr/sbin/groupadd -g 28 -r nscd +getent passwd nscd >/dev/null || + /usr/sbin/useradd -M -o -r -d / -s /sbin/nologin \ + -c "NSCD Daemon" -u 28 -g nscd nscd + +%post -n nscd +%systemd_post nscd.service + +%preun -n nscd +%systemd_preun nscd.service + +%postun -n nscd +if test $1 = 0; then + /usr/sbin/userdel nscd > /dev/null 2>&1 || : +fi +%systemd_postun_with_restart nscd.service + ############################################################################## # Files list ############################################################################## @@ -1283,6 +1340,25 @@ fi %files -f devel.filelist devel +%files -f nscd.filelist -n nscd +%config(noreplace) /etc/nscd.conf +%dir %attr(0755,root,root) /var/run/nscd +%dir %attr(0755,root,root) /var/db/nscd +/lib/systemd/system/nscd.service +/lib/systemd/system/nscd.socket +%{_tmpfilesdir}/nscd.conf +%attr(0644,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/nscd.pid +%attr(0666,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/socket +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/passwd +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/group +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/hosts +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/run/nscd/services +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/nscd/passwd +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/nscd/group +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/nscd/hosts +%attr(0600,root,root) %verify(not md5 size mtime) %ghost %config(missingok,noreplace) /var/db/nscd/services +%ghost %config(missingok,noreplace) /etc/sysconfig/nscd + %files -f nss_modules.filelist -n nss_modules /var/db/Makefile @@ -1311,6 +1387,9 @@ fi %endif %changelog +* Thu May 05 2022 jiangheng - 2.34-79 +- restore nscd + * Thu May 5 2022 Qingqing Li - 2.34-78 - linux: Fix fchmodat with AT_SYMLINK_NOFOLLOW for 64 bit time_t (BZ#29097) diff --git a/nscd.conf b/nscd.conf new file mode 100644 index 0000000..8a24a78 --- /dev/null +++ b/nscd.conf @@ -0,0 +1 @@ +d /run/nscd 0755 root root -- Gitee