From 61e6d7efaabbefffea06819385266a089b44d86c Mon Sep 17 00:00:00 2001 From: wiz Date: Sat, 10 Mar 2001 18:00:51 +0000 Subject: Since ntop isn't set?id anymore, make it work even if you're not root, but have sufficient permissions on /dev/bpf. Shuffle lines around so that error output in case of insufficient permissions happens before curses are initialized. Install it mode 555 instead of 550. Closes pkg/6761. --- net/ntop/files/patch-sum | 8 ++--- net/ntop/patches/patch-aa | 4 +-- net/ntop/patches/patch-ab | 83 +++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 75 insertions(+), 20 deletions(-) (limited to 'net') diff --git a/net/ntop/files/patch-sum b/net/ntop/files/patch-sum index ac10f62b338..b422aab54c4 100644 --- a/net/ntop/files/patch-sum +++ b/net/ntop/files/patch-sum @@ -1,5 +1,5 @@ -$NetBSD: patch-sum,v 1.4 2001/01/07 02:25:35 wiz Exp $ +$NetBSD: patch-sum,v 1.5 2001/03/10 18:00:51 wiz Exp $ -MD5 (patch-aa) = bc35939bcacdbd55e8c5b6808b634cd3 -MD5 (patch-ab) = 5f341d4a6d156c744269a62d433d1471 -MD5 (patch-ac) = 5d31221bbf026ae27f9b408889082b78 +SHA1 (patch-aa) = 1d9002e962061ddc174cb0f904f868ca91070465 +SHA1 (patch-ab) = f0d6be0bde866803f25da5ace473e244514e3d14 +SHA1 (patch-ac) = 1f32b536470e77bf6e029d0933bb375c1b08aee0 diff --git a/net/ntop/patches/patch-aa b/net/ntop/patches/patch-aa index 7753839abb1..7a4e4c5d877 100644 --- a/net/ntop/patches/patch-aa +++ b/net/ntop/patches/patch-aa @@ -1,4 +1,4 @@ -$NetBSD: patch-aa,v 1.5 2000/10/20 11:03:38 abs Exp $ +$NetBSD: patch-aa,v 1.6 2001/03/10 18:00:51 wiz Exp $ --- Makefile.in.orig Mon May 3 09:03:10 1999 +++ Makefile.in @@ -16,7 +16,7 @@ $NetBSD: patch-aa,v 1.5 2000/10/20 11:03:38 abs Exp $ install: - $(INSTALL) -m 6550 $(PROG) $(DESTDIR)$(BINDEST)/$(PROG) -+ $(INSTALL) -m 550 $(PROG) $(DESTDIR)$(BINDEST)/$(PROG) ++ $(INSTALL) -m 555 $(PROG) $(DESTDIR)$(BINDEST)/$(PROG) install-man: $(INSTALL) -m 444 $(PROG).8 $(DESTDIR)$(MANDEST)/man8/$(PROG).8 diff --git a/net/ntop/patches/patch-ab b/net/ntop/patches/patch-ab index ee2b6c1bbd7..a9c6302487d 100644 --- a/net/ntop/patches/patch-ab +++ b/net/ntop/patches/patch-ab @@ -1,6 +1,6 @@ -$NetBSD: patch-ab,v 1.8 2000/10/20 11:03:38 abs Exp $ +$NetBSD: patch-ab,v 1.9 2001/03/10 18:00:51 wiz Exp $ ---- ntop.c.orig Wed Apr 28 18:49:00 1999 +--- ntop.c.orig Wed Apr 28 19:49:00 1999 +++ ntop.c @@ -254,7 +254,7 @@ initIPServices(); @@ -27,27 +27,82 @@ $NetBSD: patch-ab,v 1.8 2000/10/20 11:03:38 abs Exp $ default: usage(0); -@@ -392,7 +394,7 @@ +@@ -348,11 +350,6 @@ + #endif + + #ifndef WIN32 +- if((rFileName == NULL) && (getuid () && geteuid ()) || setuid (0)) { +- printf("Sorry, you must be superuser in order to run ntop.\n"); +- return(-1); +- } +- + if(daemonMode && (!webMode)) { + printf("WARNING: -d is incompatible with interactive mode.\n"); + } else if(daemonMode) +@@ -392,13 +389,30 @@ #ifndef WIN32 /* Determine the device name if not specified */ if (device == NULL && (device = pcap_lookupdev(ebuf)) == NULL) { - printf(ebuf); -+ printf("%s", ebuf); ++ printf("%s\n", ebuf); return(-1); } -@@ -426,12 +428,12 @@ - } + getLocalHostAddress(&localHostAddress, device); - if (pcapPtr == NULL) { + if(rFileName == NULL) { ++ /* Fire up libpcap */ ++ pcapPtr = pcap_open_live(device, DEFAULT_SNAPLEN, !pflag, 1000, ebuf); ++ } else { ++ pcapPtr = pcap_open_offline(rFileName, ebuf); ++ } ++ ++ if (pcapPtr == NULL) { ++ printf("%s\n", ebuf); ++ return(-1); ++ } ++ ++ if (pcap_lookupnet(device, &localnet, &netmask, ebuf) < 0) { ++ printf("%s\n", ebuf); ++ return(-1); ++ } ++ ++ if(rFileName == NULL) { + if(webMode) { + (void)fprintf(stderr, "ntop v.%s %s [%s]" + #ifndef WIN32 +@@ -418,21 +432,6 @@ + init_curses(); + } + #endif +- +- /* Fire up libpcap */ +- pcapPtr = pcap_open_live(device, DEFAULT_SNAPLEN, !pflag, 1000, ebuf); +- } else { +- pcapPtr = pcap_open_offline(rFileName, ebuf); +- } +- +- if (pcapPtr == NULL) { - printf(ebuf); -+ printf("%s", ebuf); - return(-1); - } - - if (pcap_lookupnet(device, &localnet, &netmask, ebuf) < 0) { +- return(-1); +- } +- +- if (pcap_lookupnet(device, &localnet, &netmask, ebuf) < 0) { - printf(ebuf); -+ printf("%s", ebuf); - return(-1); +- return(-1); } #else /* WIN32 */ + printf("ntop v.%s %s [%s]" +@@ -458,12 +457,6 @@ + free(localAddresses); + localAddresses = NULL; + } +- +-#ifndef WIN32 +- /* Now that the socket is open, throw away potential setuid/setgid */ +- (void)setgid(getgid()); +- (void)setuid(getuid()); +-#endif + + #ifndef WIN32 + /* get datalink type */ -- cgit v1.2.3