Accepting request 575619 from home:jengelh:branches:server:dns

- Check group existence before creating it, for real.
- Stop deleting users from the system, it might remove a legitimate
  user that nsd unfortunately shared its name with.
- typographical edit in description for completeness

OBS-URL: https://build.opensuse.org/request/show/575619
OBS-URL: https://build.opensuse.org/package/show/server:dns/nsd?expand=0&rev=39
This commit is contained in:
Adam Majer 2018-02-12 12:25:36 +00:00 committed by Git OBS Bridge
parent 62b4809376
commit 4c25569d21
2 changed files with 14 additions and 17 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Feb 12 11:50:14 UTC 2018 - jengelh@inai.de
- Check group existence before creating it, for real.
- Stop deleting users from the system, it might remove a legitimate
user that nsd unfortunately shared its name with.
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Feb 12 08:54:46 UTC 2018 - adam.majer@suse.de Mon Feb 12 08:54:46 UTC 2018 - adam.majer@suse.de

View File

@ -33,7 +33,7 @@ Name: nsd
Version: 4.1.19 Version: 4.1.19
Release: 0 Release: 0
# #
Summary: An authoritative only domain name server Summary: An authoritative-only domain name server
# #
License: BSD-3-Clause License: BSD-3-Clause
Group: Productivity/Networking/DNS/Servers Group: Productivity/Networking/DNS/Servers
@ -68,8 +68,8 @@ PreReq: %insserv_prereq
%endif %endif
%description %description
NSD is a complete implementation of an authoritative domain name server developed NSD is a complete implementation of an authoritative domain name server, developed
by NLnet Labs with the purpose of creating more diversity in the DNS landscape. by NLnet Labs, with the purpose of creating more diversity in the DNS landscape.
%prep %prep
%setup -q %setup -q
@ -115,16 +115,10 @@ ln -s -f %{_sysconfdir}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name}
%endif %endif
%pre %pre
# getent group _nsd >/dev/null || groupadd -r _nsd
# adding user and group, if it doesn't exist yet getent passwd _nsd >/dev/null || \
# useradd -r -g _nsd -s /bin/false -c "user for %{name}" \
if ! %{_bindir}/id _nsd > /dev/null 2> /dev/null -d %{home} _nsd
then
echo "Creating _nsd:_nsd" && \
%{_sbindir}/groupadd -r _nsd && \
%{_sbindir}/useradd -r -g _nsd -s /bin/false -c "user for %{name}" -d %{home} _nsd || \
exit $?
fi
%if %{with systemd} %if %{with systemd}
%service_add_pre %{name}.service %service_add_pre %{name}.service
%endif %endif
@ -152,10 +146,6 @@ if [ "x"$1 = "x2" ] && [ "x"`stat -c '%%G' %{home}/nsd.db` = 'xnsd' ]; then
%else %else
%{_sbindir}/rcnsd restart ||: %{_sbindir}/rcnsd restart ||:
%endif %endif
# remove old username/group
%{_sbindir}/userdel nsd || :
%{_sbindir}/groupdel nsd || :
fi fi
%preun %preun