summaryrefslogtreecommitdiff
path: root/usr.sbin/snmpd
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-01-16 00:05:14 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-01-16 00:05:14 +0000
commitfc41730ea446ecc9f5d64f7537141d181499f70e (patch)
treec22b2b5bc50ecccb2b18177df3abed825ba90f19 /usr.sbin/snmpd
parent3ac4c762270cc234339783681ac2bb1a6f348783 (diff)
first batch of cleanup to programs based upon the namespace cleanups
in net/pfvar.h sys/proc.h sys/ucred.h arpa/nameser.h change to PATH_MAX, reduce use of MIN() and MAX(), HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc etc ok millert guenther, some review by doug
Diffstat (limited to 'usr.sbin/snmpd')
-rw-r--r--usr.sbin/snmpd/ber.c6
-rw-r--r--usr.sbin/snmpd/control.c3
-rw-r--r--usr.sbin/snmpd/kroute.c3
-rw-r--r--usr.sbin/snmpd/log.c3
-rw-r--r--usr.sbin/snmpd/mib.c5
-rw-r--r--usr.sbin/snmpd/mps.c3
-rw-r--r--usr.sbin/snmpd/pf.c4
-rw-r--r--usr.sbin/snmpd/smi.c8
-rw-r--r--usr.sbin/snmpd/snmpd.c4
-rw-r--r--usr.sbin/snmpd/snmpd.h4
-rw-r--r--usr.sbin/snmpd/snmpe.c4
-rw-r--r--usr.sbin/snmpd/timer.c3
-rw-r--r--usr.sbin/snmpd/trap.c3
-rw-r--r--usr.sbin/snmpd/traphandler.c4
-rw-r--r--usr.sbin/snmpd/usm.c3
-rw-r--r--usr.sbin/snmpd/util.c1
16 files changed, 27 insertions, 34 deletions
diff --git a/usr.sbin/snmpd/ber.c b/usr.sbin/snmpd/ber.c
index 53e801a6514..9bfaa9a0329 100644
--- a/usr.sbin/snmpd/ber.c
+++ b/usr.sbin/snmpd/ber.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ber.c,v 1.27 2014/04/25 06:57:11 blambert Exp $ */
+/* $OpenBSD: ber.c,v 1.28 2015/01/16 00:05:13 deraadt Exp $ */
/*
* Copyright (c) 2007, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -19,7 +19,6 @@
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <errno.h>
#include <limits.h>
@@ -32,6 +31,7 @@
#include "ber.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
#define BER_TYPE_CONSTRUCTED 0x20 /* otherwise primitive */
#define BER_TYPE_SINGLE_MAX 30
@@ -1193,7 +1193,7 @@ ber_readbuf(struct ber *b, void *buf, size_t nbytes)
return -1;
sz = b->br_rend - b->br_rptr;
- len = MIN(nbytes, sz);
+ len = MINIMUM(nbytes, sz);
if (len == 0) {
errno = ECANCELED;
return (-1); /* end of buffer and parser wants more data */
diff --git a/usr.sbin/snmpd/control.c b/usr.sbin/snmpd/control.c
index 323a95d73df..ca47f5ef20c 100644
--- a/usr.sbin/snmpd/control.c
+++ b/usr.sbin/snmpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.27 2014/11/19 10:19:00 blambert Exp $ */
+/* $OpenBSD: control.c,v 1.28 2015/01/16 00:05:13 deraadt Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -18,7 +18,6 @@
*/
#include <sys/queue.h>
-#include <sys/param.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/un.h>
diff --git a/usr.sbin/snmpd/kroute.c b/usr.sbin/snmpd/kroute.c
index a106445ad20..c73be5027a7 100644
--- a/usr.sbin/snmpd/kroute.c
+++ b/usr.sbin/snmpd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.29 2014/10/16 04:05:02 deraadt Exp $ */
+/* $OpenBSD: kroute.c,v 1.30 2015/01/16 00:05:13 deraadt Exp $ */
/*
* Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org>
@@ -18,7 +18,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
diff --git a/usr.sbin/snmpd/log.c b/usr.sbin/snmpd/log.c
index a5ff13832c4..4e82066e843 100644
--- a/usr.sbin/snmpd/log.c
+++ b/usr.sbin/snmpd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.5 2014/10/25 03:23:49 lteo Exp $ */
+/* $OpenBSD: log.c,v 1.6 2015/01/16 00:05:13 deraadt Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -17,7 +17,6 @@
*/
#include <sys/types.h>
-#include <sys/param.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/tree.h>
diff --git a/usr.sbin/snmpd/mib.c b/usr.sbin/snmpd/mib.c
index 73e823e3f14..8276dfc6e32 100644
--- a/usr.sbin/snmpd/mib.c
+++ b/usr.sbin/snmpd/mib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mib.c,v 1.73 2014/11/18 20:54:29 krw Exp $ */
+/* $OpenBSD: mib.c,v 1.74 2015/01/16 00:05:13 deraadt Exp $ */
/*
* Copyright (c) 2012 Joel Knight <joel@openbsd.org>
@@ -17,10 +17,9 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/param.h> /* MAXCOMLEN */
#include <sys/queue.h>
-#include <sys/param.h>
#include <sys/proc.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/un.h>
diff --git a/usr.sbin/snmpd/mps.c b/usr.sbin/snmpd/mps.c
index e52f624b6b2..b122bd542fb 100644
--- a/usr.sbin/snmpd/mps.c
+++ b/usr.sbin/snmpd/mps.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mps.c,v 1.19 2014/11/19 10:19:00 blambert Exp $ */
+/* $OpenBSD: mps.c,v 1.20 2015/01/16 00:05:13 deraadt Exp $ */
/*
* Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -17,7 +17,6 @@
*/
#include <sys/queue.h>
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
diff --git a/usr.sbin/snmpd/pf.c b/usr.sbin/snmpd/pf.c
index b4d162c5531..4cdc82e1164 100644
--- a/usr.sbin/snmpd/pf.c
+++ b/usr.sbin/snmpd/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.7 2014/10/08 05:24:42 deraadt Exp $ */
+/* $OpenBSD: pf.c,v 1.8 2015/01/16 00:05:13 deraadt Exp $ */
/*
* Copyright (c) 2012 Joel Knight <joel@openbsd.org>
@@ -31,7 +31,6 @@
*
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
@@ -47,6 +46,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <event.h>
#include "snmpd.h"
diff --git a/usr.sbin/snmpd/smi.c b/usr.sbin/snmpd/smi.c
index 2eeb802ccff..e41dd37b19f 100644
--- a/usr.sbin/snmpd/smi.c
+++ b/usr.sbin/snmpd/smi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smi.c,v 1.16 2014/11/19 10:19:00 blambert Exp $ */
+
/*
* Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org>
@@ -17,7 +17,6 @@
*/
#include <sys/queue.h>
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
@@ -41,12 +40,15 @@
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <pwd.h>
#include <vis.h>
#include "snmpd.h"
#include "mib.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
extern struct snmpd *env;
RB_HEAD(oidtree, oid);
@@ -565,7 +567,7 @@ smi_oid_cmp(struct oid *a, struct oid *b)
{
size_t i;
- for (i = 0; i < MIN(a->o_oidlen, b->o_oidlen); i++)
+ for (i = 0; i < MINIMUM(a->o_oidlen, b->o_oidlen); i++)
if (a->o_oid[i] != b->o_oid[i])
return (a->o_oid[i] - b->o_oid[i]);
diff --git a/usr.sbin/snmpd/snmpd.c b/usr.sbin/snmpd/snmpd.c
index 96044b4d15d..4c16ec42255 100644
--- a/usr.sbin/snmpd/snmpd.c
+++ b/usr.sbin/snmpd/snmpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: snmpd.c,v 1.24 2014/08/18 13:13:42 reyk Exp $ */
+/* $OpenBSD: snmpd.c,v 1.25 2015/01/16 00:05:13 deraadt Exp $ */
/*
* Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -16,10 +16,10 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/param.h> /* nitems */
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/socket.h>
-#include <sys/param.h>
#include <sys/wait.h>
#include <sys/tree.h>
diff --git a/usr.sbin/snmpd/snmpd.h b/usr.sbin/snmpd/snmpd.h
index 726911a6cd8..759a313ea2f 100644
--- a/usr.sbin/snmpd/snmpd.h
+++ b/usr.sbin/snmpd/snmpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: snmpd.h,v 1.58 2014/11/19 10:19:00 blambert Exp $ */
+/* $OpenBSD: snmpd.h,v 1.59 2015/01/16 00:05:13 deraadt Exp $ */
/*
* Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -384,7 +384,7 @@ struct pfr_buffer {
struct snmp_message {
struct sockaddr_storage sm_ss;
socklen_t sm_slen;
- char sm_host[MAXHOSTNAMELEN];
+ char sm_host[HOST_NAME_MAX+1];
struct ber sm_ber;
struct ber_element *sm_req;
diff --git a/usr.sbin/snmpd/snmpe.c b/usr.sbin/snmpd/snmpe.c
index 79f2436a71d..0096b24f55f 100644
--- a/usr.sbin/snmpd/snmpe.c
+++ b/usr.sbin/snmpd/snmpe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: snmpe.c,v 1.39 2014/11/19 10:19:00 blambert Exp $ */
+/* $OpenBSD: snmpe.c,v 1.40 2015/01/16 00:05:13 deraadt Exp $ */
/*
* Copyright (c) 2007, 2008, 2012 Reyk Floeter <reyk@openbsd.org>
@@ -16,8 +16,8 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <sys/param.h> /* nitems */
#include <sys/queue.h>
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
diff --git a/usr.sbin/snmpd/timer.c b/usr.sbin/snmpd/timer.c
index 6f4091a59bb..6d9778c8451 100644
--- a/usr.sbin/snmpd/timer.c
+++ b/usr.sbin/snmpd/timer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: timer.c,v 1.3 2014/10/25 03:23:49 lteo Exp $ */
+/* $OpenBSD: timer.c,v 1.4 2015/01/16 00:05:13 deraadt Exp $ */
/*
* Copyright (c) 2008 Reyk Floeter <reyk@openbsd.org>
@@ -17,7 +17,6 @@
*/
#include <sys/queue.h>
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/sched.h>
#include <sys/socket.h>
diff --git a/usr.sbin/snmpd/trap.c b/usr.sbin/snmpd/trap.c
index 1420658236d..2a70c323169 100644
--- a/usr.sbin/snmpd/trap.c
+++ b/usr.sbin/snmpd/trap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap.c,v 1.23 2014/11/19 10:19:00 blambert Exp $ */
+/* $OpenBSD: trap.c,v 1.24 2015/01/16 00:05:13 deraadt Exp $ */
/*
* Copyright (c) 2008 Reyk Floeter <reyk@openbsd.org>
@@ -17,7 +17,6 @@
*/
#include <sys/queue.h>
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
diff --git a/usr.sbin/snmpd/traphandler.c b/usr.sbin/snmpd/traphandler.c
index 08be75451e8..2a2f2c94a0b 100644
--- a/usr.sbin/snmpd/traphandler.c
+++ b/usr.sbin/snmpd/traphandler.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: traphandler.c,v 1.1 2014/04/25 06:57:11 blambert Exp $ */
+/* $OpenBSD: traphandler.c,v 1.2 2015/01/16 00:05:13 deraadt Exp $ */
/*
* Copyright (c) 2014 Bret Stephen Lambert <blambert@openbsd.org>
*
@@ -16,7 +16,7 @@
*/
#include <sys/queue.h>
-#include <sys/param.h>
+#include <sys/param.h> /* nitems */
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/stat.h>
diff --git a/usr.sbin/snmpd/usm.c b/usr.sbin/snmpd/usm.c
index 1f440f7bf68..b3343587c1b 100644
--- a/usr.sbin/snmpd/usm.c
+++ b/usr.sbin/snmpd/usm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usm.c,v 1.8 2014/11/19 11:14:06 blambert Exp $ */
+/* $OpenBSD: usm.c,v 1.9 2015/01/16 00:05:13 deraadt Exp $ */
/*
* Copyright (c) 2012 GeNUA mbH
@@ -17,7 +17,6 @@
*/
#include <sys/queue.h>
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
diff --git a/usr.sbin/snmpd/util.c b/usr.sbin/snmpd/util.c
index e744be40a10..cc172953264 100644
--- a/usr.sbin/snmpd/util.c
+++ b/usr.sbin/snmpd/util.c
@@ -15,7 +15,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/param.h>
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/socket.h>