]> granicus.if.org Git - sudo/commitdiff
There's no need to escape forward slashes in JSON output. While
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 23 May 2016 17:29:17 +0000 (11:29 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 23 May 2016 17:29:17 +0000 (11:29 -0600)
it is legal to escape a forward slash, it is not required.

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/test2.json.ok
plugins/sudoers/visudo_json.c

index 58875dcee8cedea40cc0776a9c012cf263d705e5..e4ecaabc8dde96f0d6cda49cb16a9e3d700dfac1 100644 (file)
@@ -14,7 +14,7 @@
                         { "log_output": true }
                     ],
                     "Commands": [
-                        { "command": "\/usr\/bin\/su -" }
+                        { "command": "/usr/bin/su -" }
                     ]
                 }
             ]
@@ -33,7 +33,7 @@
                         { "log_output": false }
                     ],
                     "Commands": [
-                        { "command": "\/usr\/bin\/id" }
+                        { "command": "/usr/bin/id" }
                     ]
                 }
             ]
@@ -53,7 +53,7 @@
                         { "setenv": true }
                     ],
                     "Commands": [
-                        { "command": "\/usr\/bin\/vi" }
+                        { "command": "/usr/bin/vi" }
                     ]
                 }
             ]
@@ -73,7 +73,7 @@
                         { "setenv": false }
                     ],
                     "Commands": [
-                        { "command": "\/usr\/bin\/echo" }
+                        { "command": "/usr/bin/echo" }
                     ]
                 }
             ]
@@ -91,7 +91,7 @@
                         { "send_mail": true }
                     ],
                     "Commands": [
-                        { "command": "\/bin\/sh" }
+                        { "command": "/bin/sh" }
                     ]
                 }
             ]
                         { "send_mail": false }
                     ],
                     "Commands": [
-                        { "command": "\/usr\/bin\/id" }
+                        { "command": "/usr/bin/id" }
                     ]
                 }
             ]
                         { "sudoedit_follow": true }
                     ],
                     "Commands": [
-                        { "command": "sudoedit \/etc\/motd" }
+                        { "command": "sudoedit /etc/motd" }
                     ]
                 }
             ]
                         { "sudoedit_follow": false }
                     ],
                     "Commands": [
-                        { "command": "sudoedit \/home\/*\/*" }
+                        { "command": "sudoedit /home/*/*" }
                     ]
                 }
             ]
index 3bebcafcc7fa68886519f17a161c817737b4fd16..2cc3f56897b3ddec6ab36ae7ec132776011697f5 100644 (file)
@@ -2,14 +2,14 @@
     "Command_Aliases": {
         "LS": [
             {
-                "command": "\/bin\/ls",
+                "command": "/bin/ls",
                 "sha224": "d06a2617c98d377c250edd470fd5e576327748d82915d6e33b5f8db1"
             }
         ],
         "SH": [
             {
-                "command": "\/bin\/sh",
-                "sha256": "hOtoe\/iK6SlGg7w4BfZBBdSsXjUmTJ5+ts51yjh7vkM="
+                "command": "/bin/sh",
+                "sha256": "hOtoe/iK6SlGg7w4BfZBBdSsXjUmTJ5+ts51yjh7vkM="
             }
         ]
     },
@@ -27,7 +27,7 @@
                         { "cmndalias": "LS" },
                         { "cmndalias": "SH" },
                         {
-                            "command": "\/bin\/kill",
+                            "command": "/bin/kill",
                             "sha512": "srzYEQ2aqzm+it3f74opTMkIImZRLxBARVpb0g9RSouJYdLt7DTRMEY4Ry9NyaOiDoUIplpNjqYH0JMYPVdFnw"
                         }
                     ]
index da0e9e540e47cdd586c819ac635a3c4c28911c99..4f9a6fd19675f1017647c552296722ddace1a616 100644 (file)
@@ -10,7 +10,7 @@
             "Cmnd_Specs": [
                 {
                     "Commands": [
-                        { "command": "sudoedit \/etc\/motd" }
+                        { "command": "sudoedit /etc/motd" }
                     ]
                 }
             ]
index 2f7ecda82dea889170820ad3f8ac421a59f9e97f..9a0f1833164ecf6d30145fbd42d1d8fc716ff63e 100644 (file)
@@ -1,7 +1,7 @@
 {
     "Command_Aliases": {
         "EDIT": [
-            { "command": "sudoedit \/etc\/motd" }
+            { "command": "sudoedit /etc/motd" }
         ]
     },
     "User_Specs": [
index 773cd7edbb04da4d31326c3deb6b97a43db5e973..0e3ceee442cb75c5451a8320540c516b4ca9ba96 100644 (file)
             { "username": "foo" }
         ],
         "UA10": [
-            { "nonunixgroup": "C\/non\"UNIX\"0 c" }
+            { "nonunixgroup": "C/non\"UNIX\"0 c" }
         ],
         "UA11": [
-            { "nonunixgroup": "C\/non_UNIX_0 c" }
+            { "nonunixgroup": "C/non_UNIX_0 c" }
         ],
         "UA12": [
-            { "nonunixgroup": "C\/non\\'UNIX_3 c" }
+            { "nonunixgroup": "C/non\\'UNIX_3 c" }
         ],
         "UA2": [
             { "username": "foo.bar" }
             { "usergroup": "baz.biz" }
         ],
         "UA8": [
-            { "nonunixgroup": "C\/non UNIX 0 c" }
+            { "nonunixgroup": "C/non UNIX 0 c" }
         ],
         "UA9": [
-            { "nonunixgroup": "C\/non\\'UNIX\\'1 c" }
+            { "nonunixgroup": "C/non\\'UNIX\\'1 c" }
         ]
     },
     "Runas_Aliases": {
         },
         {
             "User_List": [
-                { "nonunixgroup": "C\/non UNIX 0 c" }
+                { "nonunixgroup": "C/non UNIX 0 c" }
             ],
             "Host_List": [
                 { "hostname": "hostc" }
         },
         {
             "User_List": [
-                { "nonunixgroup": "C\/non\\'UNIX\\'1 c" }
+                { "nonunixgroup": "C/non\\'UNIX\\'1 c" }
             ],
             "Host_List": [
                 { "hostname": "hostd" }
         },
         {
             "User_List": [
-                { "nonunixgroup": "C\/non\"UNIX\"0 c" }
+                { "nonunixgroup": "C/non\"UNIX\"0 c" }
             ],
             "Host_List": [
                 { "hostname": "hoste" }
         },
         {
             "User_List": [
-                { "nonunixgroup": "C\/non_UNIX_0 c" }
+                { "nonunixgroup": "C/non_UNIX_0 c" }
             ],
             "Host_List": [
                 { "hostname": "hostf" }
         },
         {
             "User_List": [
-                { "nonunixgroup": "C\/non\\'UNIX_3 c" }
+                { "nonunixgroup": "C/non\\'UNIX_3 c" }
             ],
             "Host_List": [
                 { "hostname": "hostg" }
index 3f8118602a4039bdd96f1395d91e19c627ba8039..5e83ccf8055c16b183eff971537b49ed467906fc 100644 (file)
@@ -106,7 +106,6 @@ print_string_json_unquoted(FILE *fp, const char *str)
        switch (ch) {
        case '"':
        case '\\':
-       case '/':
            putc('\\', fp);
            break;
        case '\b':