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

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