#
# Conditional build:
%bcond_without libsmi # Build without SMI support
+%bcond_with drop_priv # Breaks "-w" option
Summary: dumps packets that are sent or received over a network interface
Summary(de.UTF-8): deponiert Pakete, die über eine Netzwerkschnittstelle gesandt oder empfangen werden
Summary(uk.UTF-8): Інструмент для моніторингу мережевого трафіку
Name: tcpdump
Version: 4.2.0
-Release: 1
+Release: 6
Epoch: 1
License: BSD
Group: Networking/Utilities
BuildRequires: libpcap-devel >= 2:1.2.0
%{?with_libsmi:BuildRequires: libsmi-devel}
BuildRequires: openssl-devel >= 0.9.7d
+BuildRequires: rpmbuild(macros) >= 1.202
Requires: libpcap >= 2:1.2.0
+Provides: user(tcpdump)
+Requires(postun): /usr/sbin/userdel
+Requires(pre): /bin/id
+Requires(pre): /usr/sbin/useradd
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
%configure \
CFLAGS="-I. %{rpmcflags} %{rpmcppflags}" \
%{?with_smi:--with-smi} \
- --enable-ipv6 \
- --with-chroot=/usr/share/empty
+%if %{with drop_priv}
+ --with-user=tcpdump \
+ --with-chroot=/usr/share/empty \
+%endif
+ --enable-ipv6
%{__make}
%install
rm -rf $RPM_BUILD_ROOT
-
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT
-rm $RPM_BUILD_ROOT%{_sbindir}/tcpdump.%{version}
+%{__rm} $RPM_BUILD_ROOT%{_sbindir}/tcpdump.%{version}
+
+%pre
+%useradd -u 273 -r -d /usr/share/empty -s /bin/false -c "tcpdump User" -g nobody tcpdump
+
+%postun
+if [ "$1" = "0" ]; then
+ %userremove tcpdump
+fi
%clean
rm -rf $RPM_BUILD_ROOT