diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1999-02-24 21:26:04 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1999-02-24 21:26:04 +0000 |
commit | a749aa65fee78a433f5e634c838eb3f40037679a (patch) | |
tree | f3ebedb8196916f942d123e053e0e78f9ef1f5bb /sbin/ifconfig/ifconfig.c | |
parent | 03432e9be38c2fb37df63c25437fb179344e028b (diff) |
only allow src, dst address, not things like "ifconfig xx0 1 2 3 4 5 6"
Diffstat (limited to 'sbin/ifconfig/ifconfig.c')
-rw-r--r-- | sbin/ifconfig/ifconfig.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 98557e860e5..0742e23b3e9 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ifconfig.c,v 1.21 1999/02/24 21:24:47 deraadt Exp $ */ +/* $OpenBSD: ifconfig.c,v 1.22 1999/02/24 21:26:03 deraadt Exp $ */ /* $NetBSD: ifconfig.c,v 1.40 1997/10/01 02:19:43 enami Exp $ */ /* @@ -81,7 +81,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94"; #else -static char rcsid[] = "$OpenBSD: ifconfig.c,v 1.21 1999/02/24 21:24:47 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ifconfig.c,v 1.22 1999/02/24 21:26:03 deraadt Exp $"; #endif #endif /* not lint */ @@ -228,8 +228,9 @@ struct cmd { { "-mediaopt", NEXTARG, A_MEDIAOPTCLR, unsetmediaopt }, { "instance", NEXTARG, A_MEDIAINST, setmediainst }, { "inst", NEXTARG, A_MEDIAINST, setmediainst }, - { 0, 0, 0, setifaddr }, - { 0, 0, 0, setifdstaddr }, + { 0, /*src*/ 0, 0, setifaddr }, + { 0, /*dst*/ 0, 0, setifdstaddr }, + { 0, /*illegal*/0, 0, NULL }, }; void adjust_nsellength(); @@ -302,6 +303,7 @@ main(argc, argv) register struct afswtch *rafp; int aflag = 0; int ifaliases = 0; + int i; if (argc < 2) usage(); @@ -360,7 +362,11 @@ main(argc, argv) if (strcmp(*argv, p->c_name) == 0) break; if (p->c_name == 0 && setaddr) - p++; /* got src, do dst */ + for (i = setaddr; i > 0; i--) { + p++; + if (p->c_func == NULL) + errx(1, "extra address not accepted"); + } if (p->c_func) { if (p->c_parameter == NEXTARG) { if (argv[1] == NULL) @@ -620,6 +626,7 @@ setifdstaddr(addr, param) char *addr; int param; { + setaddr++; (*afp->af_getaddr)(addr, DSTADDR); } |