]> granicus.if.org Git - sudo/commitdiff
Fix parsing of double-quoted Defaults bindings that start with % or +.
authorTodd C. Miller <Todd.Miller@sudo.ws>
Tue, 20 Aug 2019 16:25:38 +0000 (10:25 -0600)
committerTodd C. Miller <Todd.Miller@sudo.ws>
Tue, 20 Aug 2019 16:25:38 +0000 (10:25 -0600)
From sudo-1.8.23-fix-double-quote-parsing-for-Defaults-values.patch in RHEL 7.

plugins/sudoers/regress/sudoers/test2.json.ok
plugins/sudoers/regress/sudoers/test2.toke.ok
plugins/sudoers/toke.c
plugins/sudoers/toke.l

index 8e6656e402727e2e46cedcb97544c3930ce58bad..769c3fd0891699218c121cf9968ff8c9cd9cb18a 100644 (file)
@@ -34,7 +34,7 @@
         },
         {
             "Binding": [
-                { "username": "%them" }
+                { "usergroup": "them" }
             ],
             "Options": [
                 { "set_home": true }
@@ -42,7 +42,7 @@
         },
         {
             "Binding": [
-                { "username": "%: non UNIX 0 c" }
+                { "nonunixgroup": " non UNIX 0 c" }
             ],
             "Options": [
                 { "set_home": true }
@@ -50,7 +50,7 @@
         },
         {
             "Binding": [
-                { "username": "+net" }
+                { "netgroup": "net" }
             ],
             "Options": [
                 { "set_home": true }
index fcd7b73e3132e18735903204ab645e91e060ae09..63e164821124f41f28c493bc5a1904bba956f5b4 100644 (file)
@@ -29,9 +29,9 @@ DEFAULTS_HOST BEGINSTR STRBODY ENDSTR WORD(4) DEFVAR
 #
 DEFAULTS_USER BEGINSTR STRBODY ENDSTR WORD(4) DEFVAR 
 DEFAULTS_USER BEGINSTR STRBODY ENDSTR WORD(4) DEFVAR 
-DEFAULTS_USER BEGINSTR STRBODY ENDSTR WORD(4) DEFVAR 
-DEFAULTS_USER BEGINSTR STRBODY ENDSTR WORD(4) DEFVAR 
-DEFAULTS_USER BEGINSTR STRBODY ENDSTR WORD(4) DEFVAR 
+DEFAULTS_USER BEGINSTR STRBODY ENDSTR USERGROUP DEFVAR 
+DEFAULTS_USER BEGINSTR STRBODY ENDSTR USERGROUP DEFVAR 
+DEFAULTS_USER BEGINSTR STRBODY ENDSTR NETGROUP DEFVAR 
 
 #
 DEFAULTS_RUNAS BEGINSTR STRBODY ENDSTR WORD(4) DEFVAR 
index 679c0d54d904c608dd721d04de9e16859f76b1b9..f7425a12fd2b47efb46e455a09ae10e4be0335e0 100644 (file)
@@ -2656,7 +2656,7 @@ YY_RULE_SETUP
                                LEXTRACE("ERROR "); /* empty string */
                                LEXRETURN(ERROR);
                            }
-                           if (prev_state == INITIAL) {
+                           if (prev_state == INITIAL || prev_state == GOTDEFS) {
                                switch (sudoerslval.string[0]) {
                                case '%':
                                    if (sudoerslval.string[1] == '\0' ||
index 204b61d11dea460ae10e49cf7884354c1b6dfdbf..1fb7eb8f1ba8c20c6808d6d2aa1bedc9894a3326 100644 (file)
@@ -180,7 +180,7 @@ DEFVAR                      [a-z_]+
                                LEXTRACE("ERROR "); /* empty string */
                                LEXRETURN(ERROR);
                            }
-                           if (prev_state == INITIAL) {
+                           if (prev_state == INITIAL || prev_state == GOTDEFS) {
                                switch (sudoerslval.string[0]) {
                                case '%':
                                    if (sudoerslval.string[1] == '\0' ||