create and provide tcpdump user only when build with drop_priv
authorTomasz Pala <gotar@pld-linux.org>
Sat, 9 Aug 2014 07:17:40 +0000 (09:17 +0200)
committerTomasz Pala <gotar@pld-linux.org>
Sat, 9 Aug 2014 07:17:40 +0000 (09:17 +0200)
such lame priviledge disposal only pollutes one's user database, while
it's all up to cap_net_raw,cap_net_admin=ep

tcpdump.spec

index a2c9e64cccdab3ab10b02d02e8235960843a00b1..c1b4f4eb9d8012b776958567d28a01fbbc76460f 100644 (file)
@@ -29,10 +29,12 @@ BuildRequires:      libpcap-devel >= 2:1.6.1
 BuildRequires: openssl-devel >= 0.9.7d
 BuildRequires: rpmbuild(macros) >= 1.202
 Requires:      libpcap >= 2:1.6.1
+%if %{with drop_priv}
 Provides:      user(tcpdump)
-Requires(postun):      /usr/sbin/userdel
 Requires(pre): /bin/id
 Requires(pre): /usr/sbin/useradd
+%endif
+Requires(postun):      /usr/sbin/userdel
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -100,12 +102,14 @@ rm -rf $RPM_BUILD_ROOT
 
 %{__rm} $RPM_BUILD_ROOT%{_sbindir}/tcpdump.%{version}
 
+%if %{with drop_priv}
 %pre
 %useradd -u 273 -r -d /usr/share/empty -s /bin/false -c "tcpdump User" -g nobody tcpdump
+%endif
 
 %postun
 if [ "$1" = "0" ]; then
-       %userremove tcpdump
+       %userremove tcpdump || :
 fi
 
 %clean
This page took 0.085611 seconds and 4 git commands to generate.