Blame SOURCES/nfs-utils-1.3.0-mountd-netgroups.patch

e19a30
diff -up nfs-utils-1.3.0/support/export/client.c.save nfs-utils-1.3.0/support/export/client.c
e19a30
--- nfs-utils-1.3.0/support/export/client.c.save	2016-06-07 14:02:11.244677000 -0400
e19a30
+++ nfs-utils-1.3.0/support/export/client.c	2016-06-07 14:03:11.380193000 -0400
e19a30
@@ -635,7 +635,7 @@ check_netgroup(const nfs_client *clp, co
e19a30
 	const char *netgroup = clp->m_hostname + 1;
e19a30
 	struct addrinfo *tmp = NULL;
e19a30
 	struct hostent *hp;
e19a30
-	char *dot, *hname;
e19a30
+	char *dot, *hname, *ip;
e19a30
 	int i, match;
e19a30
 
e19a30
 	match = 0;
e19a30
@@ -682,6 +682,18 @@ check_netgroup(const nfs_client *clp, co
e19a30
 		}
e19a30
 	}
e19a30
 
e19a30
+	/* check whether the IP itself is in the netgroup */
e19a30
+	ip = calloc(INET6_ADDRSTRLEN, 1);
e19a30
+	if (inet_ntop(ai->ai_family, &(((struct sockaddr_in *)ai->ai_addr)->sin_addr), ip, INET6_ADDRSTRLEN) == ip) {
e19a30
+		if (innetgr(netgroup, ip, NULL, NULL)) {
e19a30
+			free(hname);
e19a30
+			hname = ip;
e19a30
+			match = 1;
e19a30
+			goto out;
e19a30
+		}
e19a30
+	}
e19a30
+	free(ip);
e19a30
+
e19a30
 	/* Okay, strip off the domain (if we have one) */
e19a30
 	dot = strchr(hname, '.');
e19a30
 	if (dot == NULL)