]> granicus.if.org Git - sudo/commitdiff
Allow leading blanks before Defaults and Foo_Alias definitions
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 23 Feb 2005 03:16:06 +0000 (03:16 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 23 Feb 2005 03:16:06 +0000 (03:16 +0000)
toke.l

diff --git a/toke.l b/toke.l
index 4035d209e1c12506118d2cb042d8c93fc259e28d..7abefb7246c944c8de5932a74aeb69db7a159cba 100644 (file)
--- a/toke.l
+++ b/toke.l
@@ -198,23 +198,27 @@ DEFVAR                    [a-z_]+
                            return(COMMENT);
                        }
 
-<INITIAL>^Defaults([:@>\!]{WORD})? {
+<INITIAL>^[[:blank:]]*Defaults([:@>\!]{WORD})? {
+                           int n;
+                           for (n = 0; isblank((unsigned char)yytext[n]); n++)
+                               continue;
+                           n += 8;
                            BEGIN GOTDEFS;
-                           switch (yytext[8]) {
+                           switch (yytext[n++]) {
                                case ':':
-                                   yyless(9);
+                                   yyless(n);
                                    LEXTRACE("DEFAULTS_USER ");
                                    return(DEFAULTS_USER);
                                case '>':
-                                   yyless(9);
+                                   yyless(n);
                                    LEXTRACE("DEFAULTS_RUNAS ");
                                    return(DEFAULTS_RUNAS);
                                case '@':
-                                   yyless(9);
+                                   yyless(n);
                                    LEXTRACE("DEFAULTS_HOST ");
                                    return(DEFAULTS_HOST);
                                case '!':
-                                   yyless(9);
+                                   yyless(n);
                                    LEXTRACE("DEFAULTS_CMND ");
                                    return(DEFAULTS_CMND);
                                default:
@@ -223,10 +227,13 @@ DEFVAR                    [a-z_]+
                            }
                        }
 
-<INITIAL>^(Host|Cmnd|User|Runas)_Alias {
-                           if (!fill(yytext, yyleng))
+<INITIAL>^[[:blank:]]*(Host|Cmnd|User|Runas)_Alias     {
+                           int n;
+                           for (n = 0; isblank((unsigned char)yytext[n]); n++)
+                               continue;
+                           if (!fill(yytext + n, yyleng - n))
                                yyterminate();
-                           switch (*yytext) {
+                           switch (yytext[n]) {
                                case 'H':
                                    LEXTRACE("HOSTALIAS ");
                                    return(HOSTALIAS);