]> granicus.if.org Git - sudo/commitdiff
Better fix for sudoers files w/o a newline before EOF. It looks
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 7 Jan 2003 00:02:33 +0000 (00:02 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 7 Jan 2003 00:02:33 +0000 (00:02 +0000)
like the issue is that yyrestart() does not reset the start condition
to INITIAL which is an issue since we parse sudoers multiple times.

parse.lex

index 0f997d8d8838266b1786d997377966ef7ebad2d0..96481ce189673b79bbd9f8a63b788ee494eb0309 100644 (file)
--- a/parse.lex
+++ b/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)