Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/bsd/tcpdump/dist Hint from dsl: make sure to have t...



details:   https://anonhg.NetBSD.org/src/rev/f86b56d09907
branches:  trunk
changeset: 764346:f86b56d09907
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Apr 17 11:45:40 2011 +0000

description:
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.

diffstat:

 external/bsd/tcpdump/dist/tcpdump.c |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diffs (20 lines):

diff -r 919945f0969e -r f86b56d09907 external/bsd/tcpdump/dist/tcpdump.c
--- a/external/bsd/tcpdump/dist/tcpdump.c       Sun Apr 17 10:06:49 2011 +0000
+++ b/external/bsd/tcpdump/dist/tcpdump.c       Sun Apr 17 11:45:40 2011 +0000
@@ -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));



Home | Main Index | Thread Index | Old Index