diff options
author | 2011-05-01 14:42:06 +0000 | |
---|---|---|
committer | 2011-05-01 14:42:06 +0000 | |
commit | 2f249f17f8e4af325c68c259120f999af00df38c (patch) | |
tree | 7b728cde09a32cff9dcdc73a72c2dd5ff243b027 | |
parent | the smtpd env is meant to be global, so do not pass it all around. (diff) | |
download | wireguard-openbsd-2f249f17f8e4af325c68c259120f999af00df38c.tar.xz wireguard-openbsd-2f249f17f8e4af325c68c259120f999af00df38c.zip |
Split ALL, ROLE and TYPE into their own actions. Since you can
only have #ifdefs inside of braces, ROLE and TYPE use a naughty
goto in the non-SELinux case. This is safe because the actions are
in one big switch() statement. Prodded by and with help from espie@
-rw-r--r-- | usr.bin/sudo/toke.l | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/usr.bin/sudo/toke.l b/usr.bin/sudo/toke.l index 5429f5a8200..d1d4a33f8ac 100644 --- a/usr.bin/sudo/toke.l +++ b/usr.bin/sudo/toke.l @@ -391,22 +391,32 @@ NOSETENV[[:blank:]]*: { return(NTWKADDR); } -[[:upper:]][[:upper:][:digit:]_]* { - if (strcmp(yytext, "ALL") == 0) { - LEXTRACE("ALL "); - return(ALL); - } +ALL { + LEXTRACE("ALL "); + return(ALL); + + } + +<INITIAL>ROLE { #ifdef HAVE_SELINUX - /* XXX - restrict type/role to initial state */ - if (strcmp(yytext, "TYPE") == 0) { - LEXTRACE("TYPE "); - return(TYPE); - } - if (strcmp(yytext, "ROLE") == 0) { - LEXTRACE("ROLE "); - return(ROLE); - } -#endif /* HAVE_SELINUX */ + LEXTRACE("ROLE "); + return(ROLE); +#else + goto got_alias; +#endif + } + +<INITIAL>TYPE { +#ifdef HAVE_SELINUX + LEXTRACE("TYPE "); + return(TYPE); +#else + goto got_alias; +#endif + } + +[[:upper:]][[:upper:][:digit:]_]* { + got_alias: if (!fill(yytext, yyleng)) yyterminate(); LEXTRACE("ALIAS "); |