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...
This commit is contained in:
Paul Traina 1997-04-30 18:40:12 +00:00
parent 3e75bb9be1
commit 0f4b7baa2d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=25318
2 changed files with 10 additions and 12 deletions

View File

@ -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 {

View File

@ -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 {