From 0940a74e6f446cdb150976403a0b21f4e273fc2f Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 22 Aug 2007 22:28:20 +0000 Subject: [PATCH] Require that the first character after a comment not be a digit or a dash. This allows us to remove the GOTRUNAS state and treat uid/gids similar to other words. It also means that we can now specify uids in User_Lists and a User_Spec may now contain a uid. --- toke.l | 44 +++++++++++++------------------------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/toke.l b/toke.l index 0f306aa3d..cdf64e806 100644 --- a/toke.l +++ b/toke.l @@ -102,8 +102,6 @@ DEFVAR [a-z_]+ %option nounput %option noyywrap -/* XXX - convert GOTRUNAS to exclusive state (GOTDEFS cannot be) */ -%s GOTRUNAS %s GOTDEFS %x GOTCMND %x STARTDEFS @@ -213,6 +211,7 @@ DEFVAR [a-z_]+ } ^#include[[:blank:]]+\/.*\n { + /* XXX - handle include lines in grammar */ char *cp, *ep; ++sudolineno; /* pull out path from #include line */ @@ -277,7 +276,6 @@ DEFVAR [a-z_]+ return(USERALIAS); case 'R': LEXTRACE("RUNASALIAS "); - BEGIN GOTRUNAS; return(RUNASALIAS); } } @@ -358,12 +356,6 @@ NOSETENV[[:blank:]]*: { return(NTWKADDR); } -\( { - BEGIN GOTRUNAS; - LEXTRACE("( "); - return (RUNAS); - } - [[:upper:]][[:upper:][:digit:]_]* { if (strcmp(yytext, "ALL") == 0) { LEXTRACE("ALL "); @@ -376,26 +368,6 @@ NOSETENV[[:blank:]]*: { } } -({ID}|{WORD}) { - /* username/uid that user can run command as */ - if (!fill(yytext, yyleng)) - yyterminate(); - LEXTRACE("WORD(3) "); - return(WORD); - } - -#[^0-9-].*\n { - BEGIN INITIAL; - ++sudolineno; - LEXTRACE("\n"); - return(COMMENT); - } - -\) { - BEGIN INITIAL; - LEXTRACE(") "); - } - ({PATH}|sudoedit) { /* no command args allowed for Defaults!/path */ if (!fill_cmnd(yytext, yyleng)) @@ -426,7 +398,7 @@ sudoedit { } } /* a pathname */ -{WORD} { +({ID}|{WORD}) { /* a word */ if (!fill(yytext, yyleng)) yyterminate(); @@ -434,6 +406,16 @@ sudoedit { return(WORD); } +\( { + LEXTRACE("( "); + return ('('); + } + +\) { + LEXTRACE(") "); + return(')'); + } + , { LEXTRACE(", "); return(','); @@ -471,7 +453,7 @@ sudoedit { LEXTRACE("\n\t"); } /* throw away EOL after \ */ -#.*\n { +#[^0-9-].*\n { BEGIN INITIAL; ++sudolineno; LEXTRACE("\n"); -- 2.40.0