On Sun, May 24, 2020 at 03:17:31PM +0200, Klemens Nanni wrote:
> schwarze neutered the *netent(3) family as well as networks(5) in 2018,
> mountd(8) remains the only user of these functions in base.
>
> setnetent() and endnetent() are empty functions now, getnetent() always
> returns NULL unconditionally so the while loop is never entered, the
> entire if block is code that does nothing and inetaddr2 eventually
> becomes unused alltogether.
>
> See lib/libc/net/getnetent.c or getnetent(3).
>
> get_net()'s maskflg parameter is still used, so nothing to be removed
> there.
>
> Feedback? OK?
Ping.
Index: mountd.c
===================================================================
RCS file: /cvs/src/sbin/mountd/mountd.c,v
retrieving revision 1.88
diff -u -p -r1.88 mountd.c
--- mountd.c 24 Jan 2020 18:51:45 -0000 1.88
+++ mountd.c 5 Jun 2020 21:05:06 -0000
@@ -2052,29 +2052,13 @@ do_mount(struct exportlist *ep, struct g
int
get_net(char *cp, struct netmsk *net, int maskflg)
{
- struct in_addr inetaddr, inetaddr2;
+ struct in_addr inetaddr;
in_addr_t netaddr;
struct netent *np;
char *name;
if ((netaddr = inet_network(cp)) != INADDR_NONE) {
inetaddr = inet_makeaddr(netaddr, 0);
- /*
- * Due to arbitrary subnet masks, you don't know how many
- * bits to shift the address to make it into a network,
- * however you do know how to make a network address into
- * a host with host == 0 and then compare them.
- * (What a pest)
- */
- if (!maskflg) {
- setnetent(0);
- while ((np = getnetent())) {
- inetaddr2 = inet_makeaddr(np->n_net, 0);
- if (inetaddr2.s_addr == inetaddr.s_addr)
- break;
- }
- endnetent();
- }
} else {
if ((np = getnetbyname(cp)))
inetaddr = inet_makeaddr(np->n_net, 0);