diff options
author | pyr <pyr@openbsd.org> | 2008-05-12 19:15:02 +0000 |
---|---|---|
committer | pyr <pyr@openbsd.org> | 2008-05-12 19:15:02 +0000 |
commit | fde55bc4cd8a3e2076c1c7ff399834cadba6abf9 (patch) | |
tree | 90f446aa0b0d4ae4c388f55034862a5e587ab4c2 /usr.sbin | |
parent | Remove clauses 3 and 4 from the license to match the license on (diff) | |
download | wireguard-openbsd-fde55bc4cd8a3e2076c1c7ff399834cadba6abf9.tar.xz wireguard-openbsd-fde55bc4cd8a3e2076c1c7ff399834cadba6abf9.zip |
Error out with usage line if additional arguments are given after the
option parsing. Found out the hard way by jdixon on ifstated.
ok sobrado@, jdixon@, millert@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/bgpd/bgpd.c | 7 | ||||
-rw-r--r-- | usr.sbin/dvmrpd/dvmrpd.c | 7 | ||||
-rw-r--r-- | usr.sbin/hostapd/hostapd.c | 7 | ||||
-rw-r--r-- | usr.sbin/hotplugd/hotplugd.c | 7 | ||||
-rw-r--r-- | usr.sbin/ifstated/ifstated.c | 7 | ||||
-rw-r--r-- | usr.sbin/ospf6d/ospf6d.c | 7 | ||||
-rw-r--r-- | usr.sbin/ospfd/ospfd.c | 7 | ||||
-rw-r--r-- | usr.sbin/relayd/relayd.c | 7 | ||||
-rw-r--r-- | usr.sbin/ripd/ripd.c | 7 | ||||
-rw-r--r-- | usr.sbin/sensorsd/sensorsd.c | 7 | ||||
-rw-r--r-- | usr.sbin/snmpd/snmpd.c | 7 | ||||
-rw-r--r-- | usr.sbin/watchdogd/watchdogd.c | 7 |
12 files changed, 72 insertions, 12 deletions
diff --git a/usr.sbin/bgpd/bgpd.c b/usr.sbin/bgpd/bgpd.c index 167365f0c8d..1ebdb298aba 100644 --- a/usr.sbin/bgpd/bgpd.c +++ b/usr.sbin/bgpd/bgpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bgpd.c,v 1.144 2007/05/11 11:27:59 claudio Exp $ */ +/* $OpenBSD: bgpd.c,v 1.145 2008/05/12 19:15:02 pyr Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -169,6 +169,11 @@ main(int argc, char *argv[]) } } + argc -= optind; + argv += optind; + if (argc > 0) + usage(); + if (parse_config(conffile, &conf, &mrt_l, &peer_l, &net_l, rules_l)) { free(rules_l); exit(1); diff --git a/usr.sbin/dvmrpd/dvmrpd.c b/usr.sbin/dvmrpd/dvmrpd.c index ec8ae5ad63a..bf134b9f148 100644 --- a/usr.sbin/dvmrpd/dvmrpd.c +++ b/usr.sbin/dvmrpd/dvmrpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dvmrpd.c,v 1.5 2007/10/20 13:26:50 pyr Exp $ */ +/* $OpenBSD: dvmrpd.c,v 1.6 2008/05/12 19:15:02 pyr Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -152,6 +152,11 @@ main(int argc, char *argv[]) } } + argc -= optind; + argv += optind; + if (argc > 0) + usage(); + log_init(debug); /* multicast IP forwarding must be enabled */ diff --git a/usr.sbin/hostapd/hostapd.c b/usr.sbin/hostapd/hostapd.c index 36239ec5830..45a8587a647 100644 --- a/usr.sbin/hostapd/hostapd.c +++ b/usr.sbin/hostapd/hostapd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hostapd.c,v 1.32 2007/05/02 09:09:29 claudio Exp $ */ +/* $OpenBSD: hostapd.c,v 1.33 2008/05/12 19:15:02 pyr Exp $ */ /* * Copyright (c) 2004, 2005 Reyk Floeter <reyk@openbsd.org> @@ -420,6 +420,11 @@ main(int argc, char *argv[]) } } + argc -= optind; + argv += optind; + if (argc > 0) + usage(); + if (config == NULL) ret = strlcpy(cfg->c_config, HOSTAPD_CONFIG, sizeof(cfg->c_config)); else diff --git a/usr.sbin/hotplugd/hotplugd.c b/usr.sbin/hotplugd/hotplugd.c index 064d77600d4..546372e686e 100644 --- a/usr.sbin/hotplugd/hotplugd.c +++ b/usr.sbin/hotplugd/hotplugd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hotplugd.c,v 1.7 2006/05/28 16:44:52 mk Exp $ */ +/* $OpenBSD: hotplugd.c,v 1.8 2008/05/12 19:15:02 pyr Exp $ */ /* * Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org> * @@ -72,6 +72,11 @@ main(int argc, char *argv[]) /* NOTREACHED */ } + argc -= optind; + argv += optind; + if (argc > 0) + usage(); + if ((devfd = open(device, O_RDONLY)) == -1) err(1, "%s", device); diff --git a/usr.sbin/ifstated/ifstated.c b/usr.sbin/ifstated/ifstated.c index f13cff951b9..fd26017ddec 100644 --- a/usr.sbin/ifstated/ifstated.c +++ b/usr.sbin/ifstated/ifstated.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifstated.c,v 1.32 2007/11/27 18:50:00 stevesk Exp $ */ +/* $OpenBSD: ifstated.c,v 1.33 2008/05/12 19:15:02 pyr Exp $ */ /* * Copyright (c) 2004 Marco Pfatschbacher <mpf@openbsd.org> @@ -122,6 +122,11 @@ main(int argc, char *argv[]) } } + argc -= optind; + argv += optind; + if (argc > 0) + usage(); + if (opts & IFSD_OPT_NOACTION) { if ((newconf = parse_config(configfile, opts)) == NULL) exit(1); diff --git a/usr.sbin/ospf6d/ospf6d.c b/usr.sbin/ospf6d/ospf6d.c index 8aa87b3f003..db752762b43 100644 --- a/usr.sbin/ospf6d/ospf6d.c +++ b/usr.sbin/ospf6d/ospf6d.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ospf6d.c,v 1.8 2007/12/13 08:54:05 claudio Exp $ */ +/* $OpenBSD: ospf6d.c,v 1.9 2008/05/12 19:15:02 pyr Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -169,6 +169,11 @@ main(int argc, char *argv[]) } } + argc -= optind; + argv += optind; + if (argc > 0) + usage(); + mib[0] = CTL_NET; mib[1] = PF_INET6; mib[2] = IPPROTO_IPV6; diff --git a/usr.sbin/ospfd/ospfd.c b/usr.sbin/ospfd/ospfd.c index be69cab999f..cf9de3de988 100644 --- a/usr.sbin/ospfd/ospfd.c +++ b/usr.sbin/ospfd/ospfd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfd.c,v 1.56 2007/10/25 12:06:30 claudio Exp $ */ +/* $OpenBSD: ospfd.c,v 1.57 2008/05/12 19:15:02 pyr Exp $ */ /* * Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org> @@ -170,6 +170,11 @@ main(int argc, char *argv[]) } } + argc -= optind; + argv += optind; + if (argc > 0) + usage(); + mib[0] = CTL_NET; mib[1] = PF_INET; mib[2] = IPPROTO_IP; diff --git a/usr.sbin/relayd/relayd.c b/usr.sbin/relayd/relayd.c index f5f78270b52..ac6e133b05c 100644 --- a/usr.sbin/relayd/relayd.c +++ b/usr.sbin/relayd/relayd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relayd.c,v 1.74 2008/05/06 09:52:47 pyr Exp $ */ +/* $OpenBSD: relayd.c,v 1.75 2008/05/12 19:15:02 pyr Exp $ */ /* * Copyright (c) 2007, 2008 Reyk Floeter <reyk@openbsd.org> @@ -163,6 +163,11 @@ main(int argc, char *argv[]) } } + argc -= optind; + argv += optind; + if (argc > 0) + usage(); + if ((env = parse_config(conffile, opts)) == NULL) exit(1); relayd_env = env; diff --git a/usr.sbin/ripd/ripd.c b/usr.sbin/ripd/ripd.c index 5c91167ce68..cdba3cca94a 100644 --- a/usr.sbin/ripd/ripd.c +++ b/usr.sbin/ripd/ripd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ripd.c,v 1.8 2007/10/24 20:23:09 claudio Exp $ */ +/* $OpenBSD: ripd.c,v 1.9 2008/05/12 19:15:02 pyr Exp $ */ /* * Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it> @@ -158,6 +158,11 @@ main(int argc, char *argv[]) } } + argc -= optind; + argv += optind; + if (argc > 0) + usage(); + mib[0] = CTL_NET; mib[1] = PF_INET; mib[2] = IPPROTO_IP; diff --git a/usr.sbin/sensorsd/sensorsd.c b/usr.sbin/sensorsd/sensorsd.c index 1cd8a772532..1501c9a0f6a 100644 --- a/usr.sbin/sensorsd/sensorsd.c +++ b/usr.sbin/sensorsd/sensorsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sensorsd.c,v 1.41 2008/03/16 23:54:01 cnst Exp $ */ +/* $OpenBSD: sensorsd.c,v 1.42 2008/05/12 19:15:02 pyr Exp $ */ /* * Copyright (c) 2003 Henning Brauer <henning@openbsd.org> @@ -127,6 +127,11 @@ main(int argc, char *argv[]) } } + argc -= optind; + argv += optind; + if (argc > 0) + usage(); + mib[0] = CTL_HW; mib[1] = HW_SENSORS; diff --git a/usr.sbin/snmpd/snmpd.c b/usr.sbin/snmpd/snmpd.c index 909b327a3fb..4835b92a6f1 100644 --- a/usr.sbin/snmpd/snmpd.c +++ b/usr.sbin/snmpd/snmpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: snmpd.c,v 1.6 2008/03/16 00:14:47 dlg Exp $ */ +/* $OpenBSD: snmpd.c,v 1.7 2008/05/12 19:15:02 pyr Exp $ */ /* * Copyright (c) 2007, 2008 Reyk Floeter <reyk@vantronix.net> @@ -134,6 +134,11 @@ main(int argc, char *argv[]) } } + argc -= optind; + argv += optind; + if (argc > 0) + usage(); + if ((env = parse_config(conffile, flags)) == NULL) exit(1); snmpd_env = env; diff --git a/usr.sbin/watchdogd/watchdogd.c b/usr.sbin/watchdogd/watchdogd.c index 02549b89fdf..48457ce0d01 100644 --- a/usr.sbin/watchdogd/watchdogd.c +++ b/usr.sbin/watchdogd/watchdogd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: watchdogd.c,v 1.11 2007/01/02 22:46:37 mbalmer Exp $ */ +/* $OpenBSD: watchdogd.c,v 1.12 2008/05/12 19:15:02 pyr Exp $ */ /* * Copyright (c) 2005 Marc Balmer <mbalmer@openbsd.org> @@ -86,6 +86,11 @@ main(int argc, char *argv[]) } } + argc -= optind; + argv += optind; + if (argc > 0) + usage(); + if (interval == 0 && (interval = period / 3) == 0) interval = 1; |