]> granicus.if.org Git - sudo/commitdiff
Add regress test for bug #853
authorTodd C. Miller <Todd.Miller@sudo.ws>
Thu, 20 Sep 2018 21:10:15 +0000 (15:10 -0600)
committerTodd C. Miller <Todd.Miller@sudo.ws>
Thu, 20 Sep 2018 21:10:15 +0000 (15:10 -0600)
MANIFEST
plugins/sudoers/regress/cvtsudoers/test30.out.ok [new file with mode: 0644]
plugins/sudoers/regress/cvtsudoers/test30.sh [new file with mode: 0755]

index cd6f510ccf11bbea437ea78ec8713d02dcec6de1..82070142a345c1feced95b8711ef5985658308f9 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -452,6 +452,8 @@ plugins/sudoers/regress/cvtsudoers/test29.out.ok
 plugins/sudoers/regress/cvtsudoers/test29.sh
 plugins/sudoers/regress/cvtsudoers/test3.out.ok
 plugins/sudoers/regress/cvtsudoers/test3.sh
+plugins/sudoers/regress/cvtsudoers/test30.out.ok
+plugins/sudoers/regress/cvtsudoers/test30.sh
 plugins/sudoers/regress/cvtsudoers/test4.out.ok
 plugins/sudoers/regress/cvtsudoers/test4.sh
 plugins/sudoers/regress/cvtsudoers/test5.out.ok
diff --git a/plugins/sudoers/regress/cvtsudoers/test30.out.ok b/plugins/sudoers/regress/cvtsudoers/test30.out.ok
new file mode 100644 (file)
index 0000000..009a54e
--- /dev/null
@@ -0,0 +1,26 @@
+{
+    "User_Specs": [
+        {
+            "User_List": [
+                { "username": "user1" },
+                { "username": "user2" },
+                { "username": "user3" }
+            ],
+            "Host_List": [
+                { "hostname": "ALL" }
+            ],
+            "Cmnd_Specs": [
+                {
+                    "Commands": [
+                        { "command": "/path/to/cmda" },
+                        {
+                            "command": "/path/to/cmdb",
+                            "negated": true
+                        },
+                        { "command": "/path/to/cmdc" }
+                    ]
+                }
+            ]
+        }
+    ]
+}
diff --git a/plugins/sudoers/regress/cvtsudoers/test30.sh b/plugins/sudoers/regress/cvtsudoers/test30.sh
new file mode 100755 (executable)
index 0000000..80b08a5
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh
+#
+# Test alias expasion when converting to JSON.
+# See https://bugzilla.sudo.ws/show_bug.cgi?id=853
+#
+
+exec 2>&1
+./cvtsudoers -c "" -e -f json <<EOF
+Cmnd_Alias     CMDA=/path/to/cmda
+Cmnd_Alias     CMDB=/path/to/cmdb
+Cmnd_Alias     CMDC=/path/to/cmdc
+User_Alias     USERS=user1,user2,user3
+USERS          ALL=CMDA,!CMDB,CMDC
+EOF