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

Replace RUNAS token with '(' and ')' tokens to make the runas

portion of the grammar more natural.
This commit is contained in:
Todd C. Miller
2007-08-22 22:23:59 +00:00
parent 057d10a1e3
commit add2fe0240
2 changed files with 6 additions and 4 deletions

4
gram.y
View File

@@ -122,7 +122,6 @@ yyerror(s)
%token <tok> DEFAULTS_USER /* User-specific defaults entry */
%token <tok> DEFAULTS_RUNAS /* Runas-specific defaults entry */
%token <tok> DEFAULTS_CMND /* Command-specific defaults entry */
%token <tok> RUNAS /* ( runas_list ) */
%token <tok> NOPASSWD /* no passwd req for command */
%token <tok> PASSWD /* passwd req for command (default) */
%token <tok> NOEXEC /* preload dummy execve() for cmnd */
@@ -136,6 +135,7 @@ yyerror(s)
%token <tok> USERALIAS /* User_Alias keyword */
%token <tok> RUNASALIAS /* Runas_Alias keyword */
%token <tok> ':' '=' ',' '!' '+' '-' /* union member tokens */
%token <tok> '(' ')' /* runas tokens */
%token <tok> ERROR
%type <cmndspec> cmndspec
@@ -319,7 +319,7 @@ opcmnd : cmnd {
runasspec : /* empty */ {
$$ = NULL;
}
| RUNAS runaslist {
| '(' runaslist ')' {
$$ = $2;
}
;

6
toke.l
View File

@@ -94,6 +94,7 @@ IPV6ADDR \:\:|({HEXDIGIT}\:){7}{HEXDIGIT}|({HEXDIGIT}\:){5}{HEXDIGIT}\:{DOTTEDQ
HOSTNAME [[:alnum:]_-]+
WORD ([^#>!=:,\(\) \t\n\\]|\\[^\n])+
ID #-?[0-9]+
PATH \/(\\[\,:= \t#]|[^\,:=\\ \t\n#])+
ENVAR ([^#!=, \t\n\\\"]|\\[^\n])([^#=, \t\n\\\"]|\\[^\n])*
DEFVAR [a-z_]+
@@ -359,7 +360,7 @@ NOSETENV[[:blank:]]*: {
<INITIAL>\( {
BEGIN GOTRUNAS;
LEXTRACE("RUNAS ");
LEXTRACE("( ");
return (RUNAS);
}
@@ -375,7 +376,7 @@ NOSETENV[[:blank:]]*: {
}
}
<GOTRUNAS>(#[0-9-]+|{WORD}) {
<GOTRUNAS>({ID}|{WORD}) {
/* username/uid that user can run command as */
if (!fill(yytext, yyleng))
yyterminate();
@@ -392,6 +393,7 @@ NOSETENV[[:blank:]]*: {
<GOTRUNAS>\) {
BEGIN INITIAL;
LEXTRACE(") ");
}
<GOTDEFS>({PATH}|sudoedit) {