Module Name:    src
Committed By:   martin
Date:           Sun Apr 17 11:45:40 UTC 2011

Modified Files:
        src/external/bsd/tcpdump/dist: tcpdump.c

Log Message:
Hint from dsl: make sure to have the /etc/protocols file already open
before doing a chroot() if run as root. Easily done by a setprotoent(1)
call. This is a better (less intrusive) fix for PR bin/44721.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/tcpdump/dist/tcpdump.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/tcpdump/dist/tcpdump.c
diff -u src/external/bsd/tcpdump/dist/tcpdump.c:1.2 src/external/bsd/tcpdump/dist/tcpdump.c:1.3
--- src/external/bsd/tcpdump/dist/tcpdump.c:1.2	Sun Dec  5 05:11:31 2010
+++ src/external/bsd/tcpdump/dist/tcpdump.c	Sun Apr 17 11:45:40 2011
@@ -34,7 +34,7 @@
 static const char rcsid[] _U_ =
     "@(#) Header: /tcpdump/master/tcpdump/tcpdump.c,v 1.283 2008-09-25 21:45:50 guy Exp (LBL)";
 #else
-__RCSID("$NetBSD: tcpdump.c,v 1.2 2010/12/05 05:11:31 christos Exp $");
+__RCSID("$NetBSD: tcpdump.c,v 1.3 2011/04/17 11:45:40 martin Exp $");
 #endif
 #endif
 
@@ -469,6 +469,7 @@
 	pw = getpwnam(username);
 	if (pw) {
 		if (chroot_dir) {
+			setprotoent(1);
 			if (chroot(chroot_dir) != 0 || chdir ("/") != 0) {
 				fprintf(stderr, "tcpdump: Couldn't chroot/chdir to '%.64s': %s\n",
 				    chroot_dir, pcap_strerror(errno));

Reply via email to