From d115fc0d580f1eca4eefde0c4f51705234835c17 Mon Sep 17 00:00:00 2001 From: Michal Sekletar Date: Mon, 7 Oct 2013 15:40:31 +0200 Subject: [PATCH] savefile: don't try to change ownership of stdout I case we already opened savefile we want to change ownership of the file to the given user (tcpdump by default), but we shouldn't do so when dumping to stdout is requested. Resolves: #1015767 --- tcpdump-4.4.0-eperm.patch | 8 ++++---- tcpdump.spec | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tcpdump-4.4.0-eperm.patch b/tcpdump-4.4.0-eperm.patch index e96dbbe..5750a8a 100644 --- a/tcpdump-4.4.0-eperm.patch +++ b/tcpdump-4.4.0-eperm.patch @@ -1,6 +1,6 @@ diff -up tcpdump-4.4.0/tcpdump.1.in.eperm tcpdump-4.4.0/tcpdump.1.in ---- tcpdump-4.4.0/tcpdump.1.in.eperm 2013-05-06 13:24:27.832436506 +0200 -+++ tcpdump-4.4.0/tcpdump.1.in 2013-05-06 13:24:27.839436511 +0200 +--- tcpdump-4.4.0/tcpdump.1.in.eperm 2013-10-07 15:21:26.795602764 +0200 ++++ tcpdump-4.4.0/tcpdump.1.in 2013-10-07 15:21:26.800602762 +0200 @@ -221,6 +221,9 @@ have the name specified with the flag, with a number after it, starting at 1 and continuing upward. The units of \fIfile_size\fP are millions of bytes (1,000,000 bytes, @@ -24,7 +24,7 @@ diff -up tcpdump-4.4.0/tcpdump.1.in.eperm tcpdump-4.4.0/tcpdump.1.in selects which packets will be dumped. diff -up tcpdump-4.4.0/tcpdump.c.eperm tcpdump-4.4.0/tcpdump.c --- tcpdump-4.4.0/tcpdump.c.eperm 2013-03-24 22:49:18.000000000 +0100 -+++ tcpdump-4.4.0/tcpdump.c 2013-05-06 13:28:40.929602618 +0200 ++++ tcpdump-4.4.0/tcpdump.c 2013-10-07 15:22:26.360590143 +0200 @@ -1426,11 +1426,24 @@ main(int argc, char **argv) } #endif /* HAVE_CAP_NG_H */ @@ -66,7 +66,7 @@ diff -up tcpdump-4.4.0/tcpdump.c.eperm tcpdump-4.4.0/tcpdump.c + if (!pwd) + error("Couldn't find user '%s'", username); + -+ if (chown(dumpinfo.CurrentFileName, pwd->pw_uid, pwd->pw_gid) < 0) ++ if (strcmp(WFileName, "-") && chown(dumpinfo.CurrentFileName, pwd->pw_uid, pwd->pw_gid) < 0) + error("Couldn't change ownership of savefile"); + + if (username || chroot_dir) diff --git a/tcpdump.spec b/tcpdump.spec index 64c2990..78f90d5 100644 --- a/tcpdump.spec +++ b/tcpdump.spec @@ -2,7 +2,7 @@ Summary: A network traffic monitoring tool Name: tcpdump Epoch: 14 Version: 4.4.0 -Release: 2%{?dist} +Release: 3%{?dist} License: BSD with advertising URL: http://www.tcpdump.org Group: Applications/Internet @@ -95,6 +95,9 @@ exit 0 %{_mandir}/man8/tcpdump.8* %changelog +* Mon Oct 7 2013 Michal Sekletar - 14:4.4.0-3 +- don't try to change ownership of stdout (#1015767) + * Sun Aug 04 2013 Fedora Release Engineering - 14:4.4.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild