2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 06:15:37 +00:00

netgr_matches needs to check shost as well as host since they may be different.

This commit is contained in:
Todd C. Miller
2000-01-11 18:20:41 +00:00
parent 58fb4fc86b
commit 0b59a0974d
6 changed files with 27 additions and 19 deletions

14
parse.c
View File

@@ -426,13 +426,14 @@ usergr_matches(group, user)
/*
* Returns TRUE if "host" and "user" belong to the netgroup "netgr",
* else return FALSE. Either of "host" or "user" may be NULL
* else return FALSE. Either of "host", "shost" or "user" may be NULL
* in which case that argument is not checked...
*/
int
netgr_matches(netgr, host, user)
netgr_matches(netgr, host, shost, user)
char *netgr;
char *host;
char *shost;
char *user;
{
#ifdef HAVE_GETDOMAINNAME
@@ -457,10 +458,13 @@ netgr_matches(netgr, host, user)
#endif /* HAVE_GETDOMAINNAME */
#ifdef HAVE_INNETGR
return(innetgr(netgr, host, user, domain));
#else
return(FALSE);
if (innetgr(netgr, host, user, domain))
return(TRUE);
else if (host != shost && innetgr(netgr, shost, user, domain))
return(TRUE);
#endif /* HAVE_INNETGR */
return(FALSE);
}
/*