/*
* 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
#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);
}
/*
*/
int addr_matches __P((char *));
int command_matches __P((char *, char *, char *, char *));
-int netgr_matches __P((char *, char *, char *));
+int netgr_matches __P((char *, char *, char *, char *));
int usergr_matches __P((char *, char *));
#endif /* _SUDO_PARSE_H */
free($1);
}
| NETGROUP {
- if (netgr_matches($1, user_host, NULL))
+ if (netgr_matches($1, user_host, user_shost, NULL))
$$ = TRUE;
else
$$ = -1;
user_matches == TRUE)
append_runas($1, ", ");
}
- if (netgr_matches($1, NULL, *user_runas))
+ if (netgr_matches($1, NULL, NULL, *user_runas))
$$ = TRUE;
else
$$ = -1;
free($1);
}
| NETGROUP {
- if (netgr_matches($1, NULL, user_name))
+ if (netgr_matches($1, NULL, NULL, user_name))
$$ = TRUE;
else
$$ = -1;
case 30:
#line 356 "parse.yacc"
{
- if (netgr_matches(yyvsp[0].string, user_host, NULL))
+ if (netgr_matches(yyvsp[0].string, user_host, user_shost, NULL))
yyval.BOOLEAN = TRUE;
else
yyval.BOOLEAN = -1;
user_matches == TRUE)
append_runas(yyvsp[0].string, ", ");
}
- if (netgr_matches(yyvsp[0].string, NULL, *user_runas))
+ if (netgr_matches(yyvsp[0].string, NULL, NULL, *user_runas))
yyval.BOOLEAN = TRUE;
else
yyval.BOOLEAN = -1;
case 84:
#line 791 "parse.yacc"
{
- if (netgr_matches(yyvsp[0].string, NULL, user_name))
+ if (netgr_matches(yyvsp[0].string, NULL, NULL, user_name))
yyval.BOOLEAN = TRUE;
else
yyval.BOOLEAN = -1;
}
int
-netgr_matches(netgr, host, user)
+netgr_matches(netgr, host, shost, user)
char *netgr;
char *host;
+ char *shost;
char *user;
{
#ifdef HAVE_GETDOMAINNAME
#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);
}
void
static void setup_signals __P((void));
int command_matches __P((char *, char *, char *, char *));
int addr_matches __P((char *));
-int netgr_matches __P((char *, char *, char *));
+int netgr_matches __P((char *, char *, char *, char *));
int usergr_matches __P((char *, char *));
void init_parser __P((void));
void yyrestart __P((FILE *));
}
int
-netgr_matches(n, h, u)
- char *n, *h, *u;
+netgr_matches(n, h, sh, u)
+ char *n, *h, *sh, *u;
{
return(TRUE);
}