summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorpst <pst@FreeBSD.org>1997-04-30 18:40:12 +0000
committerpst <pst@FreeBSD.org>1997-04-30 18:40:12 +0000
commitd189b0dfd03c7b8f1ca08b8f762418be013ad7c0 (patch)
tree7fe2c42bcc99e21ad0a3d3d399c4cf8829d60033 /sbin
parent68962748a62c84f65a1ae9237ef08348c6f49f6a (diff)
downloadFreeBSD-src-d189b0dfd03c7b8f1ca08b8f762418be013ad7c0.zip
FreeBSD-src-d189b0dfd03c7b8f1ca08b8f762418be013ad7c0.tar.gz
Back out msmith's recent commit which breaks using symbolic names for netmasks.
Instead, reverse the order of the testing, so if a symbolic name starts with a digit, we'll see if we can make a network address out of it first. If that fails, then we'll call getnet...
Diffstat (limited to 'sbin')
-rw-r--r--sbin/mountd/mountd.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c
index 10c43a1..b670303 100644
--- a/sbin/mountd/mountd.c
+++ b/sbin/mountd/mountd.c
@@ -43,7 +43,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "@(#)mountd.c 8.15 (Berkeley) 5/1/95"; */
static const char rcsid[] =
- "$Id: mountd.c,v 1.19 1997/04/22 10:37:27 dfr Exp $";
+ "$Id: mountd.c,v 1.20 1997/04/23 11:03:10 msmith Exp $";
#endif /*not lint*/
#include <sys/param.h>
@@ -1707,11 +1707,7 @@ get_net(cp, net, maskflg)
struct in_addr inetaddr, inetaddr2;
char *name;
- if (!maskflg && (np = getnetbyname(cp)))
- inetaddr = inet_makeaddr(np->n_net, 0);
- else if (isdigit(*cp)) {
- if ((netaddr = inet_network(cp)) == -1)
- return (1);
+ if (isdigit(*cp) && ((netaddr = inet_network(cp)) != -1)) {
inetaddr = inet_makeaddr(netaddr, 0);
/*
* Due to arbritrary subnet masks, you don't know how many
@@ -1729,8 +1725,11 @@ get_net(cp, net, maskflg)
}
endnetent();
}
+ } else if ((np = getnetbyname(cp)) != NULL) {
+ inetaddr = inet_makeaddr(np->n_net, 0);
} else
return (1);
+
if (maskflg)
net->nt_mask = inetaddr.s_addr;
else {
OpenPOWER on IntegriCloud