]> granicus.if.org Git - sudo/commitdiff
Fix conversion of "ALL" in the JSON output format, which was being
authorTodd C. Miller <Todd.Miller@sudo.ws>
Mon, 19 Feb 2018 20:39:11 +0000 (13:39 -0700)
committerTodd C. Miller <Todd.Miller@sudo.ws>
Mon, 19 Feb 2018 20:39:11 +0000 (13:39 -0700)
printed as an alias.

plugins/sudoers/cvtsudoers_json.c
plugins/sudoers/regress/sudoers/test1.json.ok
plugins/sudoers/regress/sudoers/test14.json.ok
plugins/sudoers/regress/sudoers/test15.json.ok
plugins/sudoers/regress/sudoers/test16.json.ok
plugins/sudoers/regress/sudoers/test17.json.ok
plugins/sudoers/regress/sudoers/test19.json.ok
plugins/sudoers/regress/sudoers/test2.json.ok
plugins/sudoers/regress/sudoers/test6.json.ok

index e1556f32090b07281da129b60cee5243ffa59a0a..0460cb69175b793a870d8054391479435edd613f 100644 (file)
@@ -385,8 +385,14 @@ print_member_json(FILE *fp, struct member *m, enum word_type word_type,
     case COMMAND:
        print_command_json(fp, m, indent, last_one);
        debug_return;
+    case ALL:
+       value.u.string = "ALL";
+       /* FALLTHROUGH */
     case WORD:
        switch (word_type) {
+       case TYPE_COMMAND:
+           typestr = "command";
+           break;
        case TYPE_HOSTNAME:
            typestr = "hostname";
            break;
@@ -412,9 +418,6 @@ print_member_json(FILE *fp, struct member *m, enum word_type word_type,
            sudo_fatalx("unexpected word type %d", word_type);
        }
        break;
-    case ALL:
-       value.u.string = "ALL";
-       /* FALLTHROUGH */
     case ALIAS:
        switch (word_type) {
        case TYPE_COMMAND:
index e4ecaabc8dde96f0d6cda49cb16a9e3d700dfac1..9523e4aaa0451cf197214b0924faa60811a6d091 100644 (file)
@@ -5,7 +5,7 @@
                 { "username": "user1" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
@@ -24,7 +24,7 @@
                 { "username": "user1" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
@@ -43,7 +43,7 @@
                 { "username": "user2" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
@@ -63,7 +63,7 @@
                 { "username": "user2" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
@@ -83,7 +83,7 @@
                 { "username": "user3" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
                 { "username": "user3" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
                 { "username": "user4" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
                 { "username": "user4" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
index 2cc3f56897b3ddec6ab36ae7ec132776011697f5..46f8b21ffacda9d4e79eb10cd63a4732dc4a0e56 100644 (file)
@@ -19,7 +19,7 @@
                 { "username": "millert" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
index 4f9a6fd19675f1017647c552296722ddace1a616..ff1795a87efbdf6a4e1a04a73547b780c9bc1c8b 100644 (file)
@@ -5,7 +5,7 @@
                 { "username": "user" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
index 9a0f1833164ecf6d30145fbd42d1d8fc716ff63e..7c42654c64b6f4f0d90feda72eb57bf573516daf 100644 (file)
@@ -10,7 +10,7 @@
                 { "username": "user" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
index bd599f0ac55cf79fbd8fb45514c19d4a8d2344f4..2f39a37c3b75d86e9710cb53666adb67f21d367e 100644 (file)
@@ -12,7 +12,7 @@
                 { "username": "user0" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
@@ -32,7 +32,7 @@
                 { "username": "user1" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
@@ -50,7 +50,7 @@
                 { "username": "user2" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
@@ -68,7 +68,7 @@
                 { "username": "user3" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
@@ -86,7 +86,7 @@
                 { "username": "user4" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
                 { "username": "user5" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
                 { "username": "user6" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
                 { "username": "user7" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
                 { "username": "user8" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
index 1da8df4b0cec60258bedb15458ab4142711d73f8..c9a1bfdd3cac38a520f4935415a2230d013150e0 100644 (file)
@@ -5,7 +5,7 @@
                 { "username": "user0" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
@@ -25,7 +25,7 @@
                 { "username": "user1" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
@@ -44,7 +44,7 @@
                 { "username": "user2" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
@@ -62,7 +62,7 @@
                 { "username": "user3" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
@@ -80,7 +80,7 @@
                 { "username": "user4" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
@@ -98,7 +98,7 @@
                 { "username": "user5" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
                 { "username": "user6" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
                 { "username": "user7" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
                 { "username": "user8" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
                 { "username": "user9" }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
index 0e3ceee442cb75c5451a8320540c516b4ca9ba96..8e6656e402727e2e46cedcb97544c3930ce58bad 100644 (file)
                         { "setenv": true }
                     ],
                     "Commands": [
-                        { "cmndalias": "ALL" }
+                        { "command": "ALL" }
                     ]
                 }
             ]
                         { "setenv": true }
                     ],
                     "Commands": [
-                        { "cmndalias": "ALL" }
+                        { "command": "ALL" }
                     ]
                 }
             ]
                         { "setenv": true }
                     ],
                     "Commands": [
-                        { "cmndalias": "ALL" }
+                        { "command": "ALL" }
                     ]
                 }
             ]
                         { "setenv": true }
                     ],
                     "Commands": [
-                        { "cmndalias": "ALL" }
+                        { "command": "ALL" }
                     ]
                 }
             ]
                         { "setenv": true }
                     ],
                     "Commands": [
-                        { "cmndalias": "ALL" }
+                        { "command": "ALL" }
                     ]
                 }
             ]
                         { "setenv": true }
                     ],
                     "Commands": [
-                        { "cmndalias": "ALL" }
+                        { "command": "ALL" }
                     ]
                 }
             ]
                         { "setenv": true }
                     ],
                     "Commands": [
-                        { "cmndalias": "ALL" }
+                        { "command": "ALL" }
                     ]
                 }
             ]
                         { "setenv": true }
                     ],
                     "Commands": [
-                        { "cmndalias": "ALL" }
+                        { "command": "ALL" }
                     ]
                 }
             ]
                         { "setenv": true }
                     ],
                     "Commands": [
-                        { "cmndalias": "ALL" }
+                        { "command": "ALL" }
                     ]
                 }
             ]
                         { "setenv": true }
                     ],
                     "Commands": [
-                        { "cmndalias": "ALL" }
+                        { "command": "ALL" }
                     ]
                 }
             ]
                         { "setenv": true }
                     ],
                     "Commands": [
-                        { "cmndalias": "ALL" }
+                        { "command": "ALL" }
                     ]
                 }
             ]
                         { "setenv": true }
                     ],
                     "Commands": [
-                        { "cmndalias": "ALL" }
+                        { "command": "ALL" }
                     ]
                 }
             ]
                         { "setenv": true }
                     ],
                     "Commands": [
-                        { "cmndalias": "ALL" }
+                        { "command": "ALL" }
                     ]
                 }
             ]
index b965114f3b4332cadab8887001a35802cef74c78..be1f80f58911c0eaed662b82efa5bcd831c478c6 100644 (file)
@@ -39,7 +39,7 @@
                 { "userid": 0 }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
@@ -47,7 +47,7 @@
                         { "setenv": true }
                     ],
                     "Commands": [
-                        { "cmndalias": "ALL" }
+                        { "command": "ALL" }
                     ]
                 }
             ]
@@ -57,7 +57,7 @@
                 { "userid": 0 }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
@@ -71,7 +71,7 @@
                         { "setenv": true }
                     ],
                     "Commands": [
-                        { "cmndalias": "ALL" }
+                        { "command": "ALL" }
                     ]
                 }
             ]
@@ -81,7 +81,7 @@
                 { "userid": 0 }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
@@ -89,7 +89,7 @@
                         { "setenv": true }
                     ],
                     "Commands": [
-                        { "cmndalias": "ALL" }
+                        { "command": "ALL" }
                     ]
                 }
             ]
@@ -99,7 +99,7 @@
                 { "userid": 0 }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
                         { "setenv": true }
                     ],
                     "Commands": [
-                        { "cmndalias": "ALL" }
+                        { "command": "ALL" }
                     ]
                 }
             ]
                 { "usergid": 0 }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
                         { "setenv": true }
                     ],
                     "Commands": [
-                        { "cmndalias": "ALL" }
+                        { "command": "ALL" }
                     ]
                 }
             ]
                 { "usergid": 0 }
             ],
             "Host_List": [
-                { "hostalias": "ALL" }
+                { "hostname": "ALL" }
             ],
             "Cmnd_Specs": [
                 {
                         { "setenv": true }
                     ],
                     "Commands": [
-                        { "cmndalias": "ALL" }
+                        { "command": "ALL" }
                     ]
                 }
             ]