]> granicus.if.org Git - sudo/commitdiff
Add test for empty runas user list.
authorTodd C. Miller <Todd.Miller@sudo.ws>
Tue, 6 Mar 2018 21:39:11 +0000 (14:39 -0700)
committerTodd C. Miller <Todd.Miller@sudo.ws>
Tue, 6 Mar 2018 21:39:11 +0000 (14:39 -0700)
MANIFEST
plugins/sudoers/regress/sudoers/test22.in [new file with mode: 0644]
plugins/sudoers/regress/sudoers/test22.json.ok [new file with mode: 0644]
plugins/sudoers/regress/sudoers/test22.ldif.ok [new file with mode: 0644]
plugins/sudoers/regress/sudoers/test22.ldif2sudo.ok [new file with mode: 0644]
plugins/sudoers/regress/sudoers/test22.out.ok [new file with mode: 0644]
plugins/sudoers/regress/sudoers/test22.sudo.ok [new file with mode: 0644]
plugins/sudoers/regress/sudoers/test22.toke.ok [new file with mode: 0644]

index b8ddce75ad4ca80900257448e9b1fd6c36bcff00..2e6060e6b29fe18a054220b1527e8ebf668e2b9c 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -483,6 +483,13 @@ plugins/sudoers/regress/sudoers/test21.ldif.ok
 plugins/sudoers/regress/sudoers/test21.ldif2sudo.ok
 plugins/sudoers/regress/sudoers/test21.out.ok
 plugins/sudoers/regress/sudoers/test21.toke.ok
+plugins/sudoers/regress/sudoers/test22.in
+plugins/sudoers/regress/sudoers/test22.json.ok
+plugins/sudoers/regress/sudoers/test22.ldif.ok
+plugins/sudoers/regress/sudoers/test22.ldif2sudo.ok
+plugins/sudoers/regress/sudoers/test22.out.ok
+plugins/sudoers/regress/sudoers/test22.sudo.ok
+plugins/sudoers/regress/sudoers/test22.toke.ok
 plugins/sudoers/regress/sudoers/test3.in
 plugins/sudoers/regress/sudoers/test3.json.ok
 plugins/sudoers/regress/sudoers/test3.ldif.ok
diff --git a/plugins/sudoers/regress/sudoers/test22.in b/plugins/sudoers/regress/sudoers/test22.in
new file mode 100644 (file)
index 0000000..ecf2fd9
--- /dev/null
@@ -0,0 +1,6 @@
+# Test parsing of empty Runas_List
+
+user1 ALL = ( : ) ALL
+user2 ALL = (:) ALL
+user3 ALL = ( ) ALL
+user4 ALL = () ALL
diff --git a/plugins/sudoers/regress/sudoers/test22.json.ok b/plugins/sudoers/regress/sudoers/test22.json.ok
new file mode 100644 (file)
index 0000000..22141a1
--- /dev/null
@@ -0,0 +1,88 @@
+{
+    "User_Specs": [
+        {
+            "User_List": [
+                { "username": "user1" }
+            ],
+            "Host_List": [
+                { "hostname": "ALL" }
+            ],
+            "Cmnd_Specs": [
+                {
+                    "runasusers": [
+                        { "username": "" }
+                    ],
+                    "Options": [
+                        { "setenv": true }
+                    ],
+                    "Commands": [
+                        { "command": "ALL" }
+                    ]
+                }
+            ]
+        },
+        {
+            "User_List": [
+                { "username": "user2" }
+            ],
+            "Host_List": [
+                { "hostname": "ALL" }
+            ],
+            "Cmnd_Specs": [
+                {
+                    "runasusers": [
+                        { "username": "" }
+                    ],
+                    "Options": [
+                        { "setenv": true }
+                    ],
+                    "Commands": [
+                        { "command": "ALL" }
+                    ]
+                }
+            ]
+        },
+        {
+            "User_List": [
+                { "username": "user3" }
+            ],
+            "Host_List": [
+                { "hostname": "ALL" }
+            ],
+            "Cmnd_Specs": [
+                {
+                    "runasusers": [
+                        { "username": "" }
+                    ],
+                    "Options": [
+                        { "setenv": true }
+                    ],
+                    "Commands": [
+                        { "command": "ALL" }
+                    ]
+                }
+            ]
+        },
+        {
+            "User_List": [
+                { "username": "user4" }
+            ],
+            "Host_List": [
+                { "hostname": "ALL" }
+            ],
+            "Cmnd_Specs": [
+                {
+                    "runasusers": [
+                        { "username": "" }
+                    ],
+                    "Options": [
+                        { "setenv": true }
+                    ],
+                    "Commands": [
+                        { "command": "ALL" }
+                    ]
+                }
+            ]
+        }
+    ]
+}
diff --git a/plugins/sudoers/regress/sudoers/test22.ldif.ok b/plugins/sudoers/regress/sudoers/test22.ldif.ok
new file mode 100644 (file)
index 0000000..14c3df4
--- /dev/null
@@ -0,0 +1,40 @@
+dn: cn=user1,ou=SUDOers,dc=sudo,dc=ws
+objectClass: top
+objectClass: sudoRole
+cn: user1
+sudoUser: user1
+sudoHost: ALL
+sudoRunAsUser:
+sudoCommand: ALL
+sudoOrder: 1
+
+dn: cn=user2,ou=SUDOers,dc=sudo,dc=ws
+objectClass: top
+objectClass: sudoRole
+cn: user2
+sudoUser: user2
+sudoHost: ALL
+sudoRunAsUser:
+sudoCommand: ALL
+sudoOrder: 2
+
+dn: cn=user3,ou=SUDOers,dc=sudo,dc=ws
+objectClass: top
+objectClass: sudoRole
+cn: user3
+sudoUser: user3
+sudoHost: ALL
+sudoRunAsUser:
+sudoCommand: ALL
+sudoOrder: 3
+
+dn: cn=user4,ou=SUDOers,dc=sudo,dc=ws
+objectClass: top
+objectClass: sudoRole
+cn: user4
+sudoUser: user4
+sudoHost: ALL
+sudoRunAsUser:
+sudoCommand: ALL
+sudoOrder: 4
+
diff --git a/plugins/sudoers/regress/sudoers/test22.ldif2sudo.ok b/plugins/sudoers/regress/sudoers/test22.ldif2sudo.ok
new file mode 100644 (file)
index 0000000..e0c98e0
--- /dev/null
@@ -0,0 +1,11 @@
+# sudoRole user1
+user1 ALL = () ALL
+
+# sudoRole user2
+user2 ALL = () ALL
+
+# sudoRole user3
+user3 ALL = () ALL
+
+# sudoRole user4
+user4 ALL = () ALL
diff --git a/plugins/sudoers/regress/sudoers/test22.out.ok b/plugins/sudoers/regress/sudoers/test22.out.ok
new file mode 100644 (file)
index 0000000..59b5e10
--- /dev/null
@@ -0,0 +1,8 @@
+Parses OK.
+
+
+
+user1  ALL = () ALL
+user2  ALL = () ALL
+user3  ALL = () ALL
+user4  ALL = () ALL
diff --git a/plugins/sudoers/regress/sudoers/test22.sudo.ok b/plugins/sudoers/regress/sudoers/test22.sudo.ok
new file mode 100644 (file)
index 0000000..879e1bd
--- /dev/null
@@ -0,0 +1,7 @@
+user1 ALL = () ALL
+
+user2 ALL = () ALL
+
+user3 ALL = () ALL
+
+user4 ALL = () ALL
diff --git a/plugins/sudoers/regress/sudoers/test22.toke.ok b/plugins/sudoers/regress/sudoers/test22.toke.ok
new file mode 100644 (file)
index 0000000..baf395b
--- /dev/null
@@ -0,0 +1,6 @@
+#
+
+WORD(5) ALL = ( : ) ALL 
+WORD(5) ALL = ( : ) ALL 
+WORD(5) ALL = ( ) ALL 
+WORD(5) ALL = ( ) ALL