From 4c25569d212e90634e42fd383c318ab1dc616dfb410344a0cfd03102390f213c Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Mon, 12 Feb 2018 12:25:36 +0000 Subject: [PATCH] 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 --- nsd.changes | 7 +++++++ nsd.spec | 24 +++++++----------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/nsd.changes b/nsd.changes index f29ca65..a08f1de 100644 --- a/nsd.changes +++ b/nsd.changes @@ -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 diff --git a/nsd.spec b/nsd.spec index a841756..4effc10 100644 --- a/nsd.spec +++ b/nsd.spec @@ -33,7 +33,7 @@ Name: nsd Version: 4.1.19 Release: 0 # -Summary: An authoritative only domain name server +Summary: An authoritative-only domain name server # License: BSD-3-Clause Group: Productivity/Networking/DNS/Servers @@ -68,8 +68,8 @@ PreReq: %insserv_prereq %endif %description -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. +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. %prep %setup -q @@ -115,16 +115,10 @@ ln -s -f %{_sysconfdir}/init.d/%{name} %{buildroot}%{_sbindir}/rc%{name} %endif %pre -# -# adding user and group, if it doesn't exist yet -# -if ! %{_bindir}/id _nsd > /dev/null 2> /dev/null -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 +getent group _nsd >/dev/null || groupadd -r _nsd +getent passwd _nsd >/dev/null || \ + useradd -r -g _nsd -s /bin/false -c "user for %{name}" \ + -d %{home} _nsd %if %{with systemd} %service_add_pre %{name}.service %endif @@ -152,10 +146,6 @@ if [ "x"$1 = "x2" ] && [ "x"`stat -c '%%G' %{home}/nsd.db` = 'xnsd' ]; then %else %{_sbindir}/rcnsd restart ||: %endif - - # remove old username/group - %{_sbindir}/userdel nsd || : - %{_sbindir}/groupdel nsd || : fi %preun