In pedantic mode we need to save *all* the aliases, not just those
that match, or we get spurious warnings.
This commit is contained in:
10
parse.yacc
10
parse.yacc
@@ -562,7 +562,7 @@ cmnd : ALL {
|
||||
else {
|
||||
if (pedantic)
|
||||
(void) fprintf(stderr,
|
||||
"Warning: undeclared Cmnd_Alias `%s' referenced near line %d", $1, sudolineno);
|
||||
"Warning: undeclared Cmnd_Alias `%s' referenced near line %d\n", $1, sudolineno);
|
||||
$$ = -1;
|
||||
}
|
||||
free($1);
|
||||
@@ -600,7 +600,7 @@ hostaliases : hostalias
|
||||
;
|
||||
|
||||
hostalias : ALIAS { push; } '=' hostlist {
|
||||
if (host_matches != -1 &&
|
||||
if ((host_matches != -1 || pedantic) &&
|
||||
!add_alias($1, HOST_ALIAS, host_matches))
|
||||
YYERROR;
|
||||
pop;
|
||||
@@ -624,7 +624,7 @@ cmndalias : ALIAS {
|
||||
ga_list[ga_list_len-1].alias = estrdup($1);
|
||||
}
|
||||
} '=' cmndlist {
|
||||
if (cmnd_matches != -1 &&
|
||||
if ((cmnd_matches != -1 || pedantic) &&
|
||||
!add_alias($1, CMND_ALIAS, cmnd_matches))
|
||||
YYERROR;
|
||||
pop;
|
||||
@@ -652,7 +652,7 @@ runasalias : ALIAS {
|
||||
ga_list[ga_list_len-1].alias = estrdup($1);
|
||||
}
|
||||
} '=' runaslist {
|
||||
if (runas_matches != -1 &&
|
||||
if ((runas_matches != -1 || pedantic) &&
|
||||
!add_alias($1, RUNAS_ALIAS, runas_matches))
|
||||
YYERROR;
|
||||
pop;
|
||||
@@ -668,7 +668,7 @@ useraliases : useralias
|
||||
;
|
||||
|
||||
useralias : ALIAS { push; } '=' userlist {
|
||||
if (user_matches != -1 &&
|
||||
if ((user_matches != -1 || pedantic) &&
|
||||
!add_alias($1, USER_ALIAS, user_matches))
|
||||
YYERROR;
|
||||
pop;
|
||||
|
10
sudo.tab.c
10
sudo.tab.c
@@ -1440,7 +1440,7 @@ case 44:
|
||||
else {
|
||||
if (pedantic)
|
||||
(void) fprintf(stderr,
|
||||
"Warning: undeclared Cmnd_Alias `%s' referenced near line %d", yyvsp[0].string, sudolineno);
|
||||
"Warning: undeclared Cmnd_Alias `%s' referenced near line %d\n", yyvsp[0].string, sudolineno);
|
||||
yyval.BOOLEAN = -1;
|
||||
}
|
||||
free(yyvsp[0].string);
|
||||
@@ -1482,7 +1482,7 @@ break;
|
||||
case 49:
|
||||
#line 602 "parse.yacc"
|
||||
{
|
||||
if (host_matches != -1 &&
|
||||
if ((host_matches != -1 || pedantic) &&
|
||||
!add_alias(yyvsp[-3].string, HOST_ALIAS, host_matches))
|
||||
YYERROR;
|
||||
pop;
|
||||
@@ -1503,7 +1503,7 @@ break;
|
||||
case 55:
|
||||
#line 626 "parse.yacc"
|
||||
{
|
||||
if (cmnd_matches != -1 &&
|
||||
if ((cmnd_matches != -1 || pedantic) &&
|
||||
!add_alias(yyvsp[-3].string, CMND_ALIAS, cmnd_matches))
|
||||
YYERROR;
|
||||
pop;
|
||||
@@ -1532,7 +1532,7 @@ break;
|
||||
case 61:
|
||||
#line 654 "parse.yacc"
|
||||
{
|
||||
if (runas_matches != -1 &&
|
||||
if ((runas_matches != -1 || pedantic) &&
|
||||
!add_alias(yyvsp[-3].string, RUNAS_ALIAS, runas_matches))
|
||||
YYERROR;
|
||||
pop;
|
||||
@@ -1549,7 +1549,7 @@ break;
|
||||
case 65:
|
||||
#line 670 "parse.yacc"
|
||||
{
|
||||
if (user_matches != -1 &&
|
||||
if ((user_matches != -1 || pedantic) &&
|
||||
!add_alias(yyvsp[-3].string, USER_ALIAS, user_matches))
|
||||
YYERROR;
|
||||
pop;
|
||||
|
Reference in New Issue
Block a user