summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-01-07 00:04:49 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-01-07 00:04:49 +0000
commitf56df94d448441650adcbba06f82aea81b0d246d (patch)
tree0b6277a6eb14447907e5253c656af901a8d87f17
parent5524baf6b6a7ca4e2975e0b682eee60b76261eb8 (diff)
Better fix for sudoers files w/o a newline before EOF. It looks
like the issue is that yyrestart() does not reset the start condition to INITIAL which is an issue since we parse sudoers multiple times. This is a cleaner fix for that problem and what will go in sudo 1.6.7.
-rw-r--r--usr.bin/sudo/parse.lex15
1 files changed, 9 insertions, 6 deletions
diff --git a/usr.bin/sudo/parse.lex b/usr.bin/sudo/parse.lex
index 43941ac318e..2c08c32de73 100644
--- a/usr.bin/sudo/parse.lex
+++ b/usr.bin/sudo/parse.lex
@@ -339,17 +339,20 @@ PASSWD[[:blank:]]*: {
return(COMMENT);
} /* return comments */
-<GOTRUNAS,GOTDEFS,GOTCMND,STARTDEFS,INDEFS><<EOF>> {
- BEGIN INITIAL;
- LEXTRACE("EOF ");
- return(ERROR);
- } /* premature EOF */
-
<*>. {
LEXTRACE("ERROR ");
return(ERROR);
} /* parse error */
+<*><<EOF>> {
+ if (YY_START != INITIAL) {
+ BEGIN INITIAL;
+ LEXTRACE("ERROR ");
+ return(ERROR);
+ }
+ yyterminate();
+ }
+
%%
static void
fill(s, len)