Skip to contentSkip to conversation

mountd: Check host alias with netgroups

PATCH New Steve Dickson 1 participant 1 message Apr 24, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mountd: Check host alias with netgroups

exportfs and mountd needs check host aliases when checking for hosts in net groups.

See https://bugzilla.redhat.com/show_bug.cgi?id=478952 for details

---------------------------

support/export/client.c +7 -1
index 1cb242f..5fcf355 100644
@@ -371,7 +371,7 @@ client_check(nfs_client *clp, struct hostent *hp)
 #ifdef HAVE_INNETGR
 		{
 			char	*dot;
-			int	match;
+			int	match, i;
 			struct hostent *nhp = NULL;
 			struct sockaddr_in addr;
 
@@ -380,6 +380,12 @@ client_check(nfs_client *clp, struct hostent *hp)
 			if (innetgr(cname+1, hname, NULL, NULL))
 				return 1;
 
+			/* try the aliases as well */
+			for (i = 0; hp->h_aliases[i]; i++) {
+				if (innetgr(cname+1, hp->h_aliases[i], NULL, NULL))
+					return 1;
+			}
+
 			/* If hname is ip address convert to FQDN */
 			if (inet_aton(hname, &addr.sin_addr) &&
 			   (nhp = gethostbyaddr((const char *)&(addr.sin_addr),