summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoritz Jodeit <moritz@cvs.openbsd.org>2006-04-22 17:24:34 +0000
committerMoritz Jodeit <moritz@cvs.openbsd.org>2006-04-22 17:24:34 +0000
commit48b19b698528d9bb201adff4a7b41b4811271edb (patch)
tree49d9b74104c6433eb1d81b727a0176b614174eaa
parentbd568ff8cf76139da9dfe1e0e5efe3067124edac (diff)
Remove remaining stuff from state QUIT, adjust some comments
and close a fd leak in read_infile(). ok deraadt@
-rw-r--r--usr.sbin/tcpdump/privsep.c10
-rw-r--r--usr.sbin/tcpdump/tcpdump.c6
-rw-r--r--usr.sbin/tcpdump/util.c5
3 files changed, 10 insertions, 11 deletions
diff --git a/usr.sbin/tcpdump/privsep.c b/usr.sbin/tcpdump/privsep.c
index 801912de89e..9f27b403c7f 100644
--- a/usr.sbin/tcpdump/privsep.c
+++ b/usr.sbin/tcpdump/privsep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: privsep.c,v 1.23 2006/04/21 23:09:34 cloder Exp $ */
+/* $OpenBSD: privsep.c,v 1.24 2006/04/22 17:24:33 moritz Exp $ */
/*
* Copyright (c) 2003 Can Erkin Acar
@@ -60,7 +60,7 @@ enum priv_state {
STATE_INIT, /* initial state */
STATE_BPF, /* input file/device opened */
STATE_FILTER, /* filter applied */
- STATE_RUN, /* running and accepting network traffic */
+ STATE_RUN /* running and accepting network traffic */
};
#define ALLOW(action) (1 << (action))
@@ -77,8 +77,7 @@ static const int allowed_max[] = {
ALLOW(PRIV_ETHER_NTOHOST) | ALLOW(PRIV_INIT_DONE),
/* RUN */ ALLOW(PRIV_GETHOSTBYADDR) | ALLOW(PRIV_ETHER_NTOHOST) |
ALLOW(PRIV_GETRPCBYNUMBER) | ALLOW(PRIV_GETLINES) |
- ALLOW(PRIV_LOCALTIME),
- /* QUIT */ 0
+ ALLOW(PRIV_LOCALTIME)
};
/*
@@ -89,8 +88,7 @@ static int allowed_ext[] = {
/* INIT */ ALLOW(PRIV_SETFILTER),
/* BPF */ ALLOW(PRIV_SETFILTER),
/* FILTER */ ALLOW(PRIV_GETSERVENTRIES),
- /* RUN */ ALLOW(PRIV_GETLINES) | ALLOW(PRIV_LOCALTIME),
- /* QUIT */ 0
+ /* RUN */ ALLOW(PRIV_GETLINES) | ALLOW(PRIV_LOCALTIME)
};
struct ftab {
diff --git a/usr.sbin/tcpdump/tcpdump.c b/usr.sbin/tcpdump/tcpdump.c
index 7fc30558883..06eb553be10 100644
--- a/usr.sbin/tcpdump/tcpdump.c
+++ b/usr.sbin/tcpdump/tcpdump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcpdump.c,v 1.52 2006/04/21 23:09:34 cloder Exp $ */
+/* $OpenBSD: tcpdump.c,v 1.53 2006/04/22 17:24:33 moritz Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997
@@ -26,7 +26,7 @@ static const char copyright[] =
"@(#) Copyright (c) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997\n\
The Regents of the University of California. All rights reserved.\n";
static const char rcsid[] =
- "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/tcpdump.c,v 1.52 2006/04/21 23:09:34 cloder Exp $ (LBL)";
+ "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/tcpdump.c,v 1.53 2006/04/22 17:24:33 moritz Exp $ (LBL)";
#endif
/*
@@ -223,7 +223,6 @@ main(int argc, char **argv)
u_char *pcap_userdata;
u_int dlt = (u_int) -1;
- /* state: STATE_INIT */
if ((cp = strrchr(argv[0], '/')) != NULL)
program_name = cp + 1;
else
@@ -232,6 +231,7 @@ main(int argc, char **argv)
if (priv_init(argc, argv))
error("Failed to setup privsep");
+ /* state: STATE_INIT */
if (abort_on_misalignment(ebuf, sizeof(ebuf)) < 0)
error("%s", ebuf);
diff --git a/usr.sbin/tcpdump/util.c b/usr.sbin/tcpdump/util.c
index 5348fd1e85e..71b64ee1bca 100644
--- a/usr.sbin/tcpdump/util.c
+++ b/usr.sbin/tcpdump/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.20 2006/03/13 19:05:56 moritz Exp $ */
+/* $OpenBSD: util.c,v 1.21 2006/04/22 17:24:33 moritz Exp $ */
/*
* Copyright (c) 1990, 1991, 1993, 1994, 1995, 1996, 1997
@@ -23,7 +23,7 @@
#ifndef lint
static const char rcsid[] =
- "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/util.c,v 1.20 2006/03/13 19:05:56 moritz Exp $ (LBL)";
+ "@(#) $Header: /cvs/OpenBSD/src/usr.sbin/tcpdump/util.c,v 1.21 2006/04/22 17:24:33 moritz Exp $ (LBL)";
#endif
#include <sys/types.h>
@@ -295,6 +295,7 @@ read_infile(char *fname)
error("short read %s (%ld != %lu)", fname, (long)cc,
(unsigned long)bs);
cp[bs] = '\0';
+ close(fd);
return (cp);
}