diff options
author | Todd C. Miller <Todd.Miller@sudo.ws> | 2023-02-28 08:56:44 -0700 |
---|---|---|
committer | Todd C. Miller <Todd.Miller@sudo.ws> | 2023-02-28 08:56:44 -0700 |
commit | 09fbb8828cdf1d1b0b745f7d05f2ec24fb306279 (patch) | |
tree | 933695d916f7422c74e54099775c4b44557af286 | |
parent | a1ecc4006052c50c47c817f89be060bcaaa792e6 (diff) | |
download | sudo-09fbb8828cdf1d1b0b745f7d05f2ec24fb306279.tar.gz |
Add test for using "list" as user, runas and host.
-rw-r--r-- | MANIFEST | 7 | ||||
-rw-r--r-- | plugins/sudoers/regress/sudoers/test30.in | 10 | ||||
-rw-r--r-- | plugins/sudoers/regress/sudoers/test30.json.ok | 79 | ||||
-rw-r--r-- | plugins/sudoers/regress/sudoers/test30.ldif.ok | 38 | ||||
-rw-r--r-- | plugins/sudoers/regress/sudoers/test30.ldif2sudo.ok | 11 | ||||
-rw-r--r-- | plugins/sudoers/regress/sudoers/test30.out.ok | 6 | ||||
-rw-r--r-- | plugins/sudoers/regress/sudoers/test30.sudo.ok | 7 | ||||
-rw-r--r-- | plugins/sudoers/regress/sudoers/test30.toke.ok | 10 |
8 files changed, 168 insertions, 0 deletions
@@ -995,6 +995,13 @@ plugins/sudoers/regress/sudoers/test3.ldif.ok plugins/sudoers/regress/sudoers/test3.ldif2sudo.ok plugins/sudoers/regress/sudoers/test3.out.ok plugins/sudoers/regress/sudoers/test3.toke.ok +plugins/sudoers/regress/sudoers/test30.in +plugins/sudoers/regress/sudoers/test30.json.ok +plugins/sudoers/regress/sudoers/test30.ldif.ok +plugins/sudoers/regress/sudoers/test30.ldif2sudo.ok +plugins/sudoers/regress/sudoers/test30.out.ok +plugins/sudoers/regress/sudoers/test30.sudo.ok +plugins/sudoers/regress/sudoers/test30.toke.ok plugins/sudoers/regress/sudoers/test4.in plugins/sudoers/regress/sudoers/test4.json.ok plugins/sudoers/regress/sudoers/test4.ldif.ok diff --git a/plugins/sudoers/regress/sudoers/test30.in b/plugins/sudoers/regress/sudoers/test30.in new file mode 100644 index 000000000..c89d73905 --- /dev/null +++ b/plugins/sudoers/regress/sudoers/test30.in @@ -0,0 +1,10 @@ +# Test parsing of "list" pseudo-command. +# It should be allowed as a command but also as a user or host. + +user1 ALL = list + +list ALL = ALL + +user2 ALL = (list : list) ALL + +user3 list = ALL diff --git a/plugins/sudoers/regress/sudoers/test30.json.ok b/plugins/sudoers/regress/sudoers/test30.json.ok new file mode 100644 index 000000000..e95f2c6f8 --- /dev/null +++ b/plugins/sudoers/regress/sudoers/test30.json.ok @@ -0,0 +1,79 @@ +{ + "User_Specs": [ + { + "User_List": [ + { "username": "user1" } + ], + "Host_List": [ + { "hostname": "ALL" } + ], + "Cmnd_Specs": [ + { + "Commands": [ + { "command": "list" } + ] + } + ] + }, + { + "User_List": [ + { "username": "list" } + ], + "Host_List": [ + { "hostname": "ALL" } + ], + "Cmnd_Specs": [ + { + "Options": [ + { "setenv": true } + ], + "Commands": [ + { "command": "ALL" } + ] + } + ] + }, + { + "User_List": [ + { "username": "user2" } + ], + "Host_List": [ + { "hostname": "ALL" } + ], + "Cmnd_Specs": [ + { + "runasusers": [ + { "username": "list" } + ], + "runasgroups": [ + { "usergroup": "list" } + ], + "Options": [ + { "setenv": true } + ], + "Commands": [ + { "command": "ALL" } + ] + } + ] + }, + { + "User_List": [ + { "username": "user3" } + ], + "Host_List": [ + { "hostname": "list" } + ], + "Cmnd_Specs": [ + { + "Options": [ + { "setenv": true } + ], + "Commands": [ + { "command": "ALL" } + ] + } + ] + } + ] +} diff --git a/plugins/sudoers/regress/sudoers/test30.ldif.ok b/plugins/sudoers/regress/sudoers/test30.ldif.ok new file mode 100644 index 000000000..2c1913f33 --- /dev/null +++ b/plugins/sudoers/regress/sudoers/test30.ldif.ok @@ -0,0 +1,38 @@ +dn: cn=user1,ou=SUDOers,dc=sudo,dc=ws +objectClass: top +objectClass: sudoRole +cn: user1 +sudoUser: user1 +sudoHost: ALL +sudoCommand: list +sudoOrder: 1 + +dn: cn=list,ou=SUDOers,dc=sudo,dc=ws +objectClass: top +objectClass: sudoRole +cn: list +sudoUser: list +sudoHost: ALL +sudoCommand: ALL +sudoOrder: 2 + +dn: cn=user2,ou=SUDOers,dc=sudo,dc=ws +objectClass: top +objectClass: sudoRole +cn: user2 +sudoUser: user2 +sudoHost: ALL +sudoRunAsUser: list +sudoRunAsGroup: list +sudoCommand: ALL +sudoOrder: 3 + +dn: cn=user3,ou=SUDOers,dc=sudo,dc=ws +objectClass: top +objectClass: sudoRole +cn: user3 +sudoUser: user3 +sudoHost: list +sudoCommand: ALL +sudoOrder: 4 + diff --git a/plugins/sudoers/regress/sudoers/test30.ldif2sudo.ok b/plugins/sudoers/regress/sudoers/test30.ldif2sudo.ok new file mode 100644 index 000000000..8e7b68e17 --- /dev/null +++ b/plugins/sudoers/regress/sudoers/test30.ldif2sudo.ok @@ -0,0 +1,11 @@ +# sudoRole user1 +user1 ALL = list + +# sudoRole list +list ALL = ALL + +# sudoRole user2 +user2 ALL = (list : list) ALL + +# sudoRole user3 +user3 list = ALL diff --git a/plugins/sudoers/regress/sudoers/test30.out.ok b/plugins/sudoers/regress/sudoers/test30.out.ok new file mode 100644 index 000000000..95fc8ff2c --- /dev/null +++ b/plugins/sudoers/regress/sudoers/test30.out.ok @@ -0,0 +1,6 @@ +Parses OK + +user1 ALL = list +list ALL = ALL +user2 ALL = (list : list) ALL +user3 list = ALL diff --git a/plugins/sudoers/regress/sudoers/test30.sudo.ok b/plugins/sudoers/regress/sudoers/test30.sudo.ok new file mode 100644 index 000000000..1f34b03a2 --- /dev/null +++ b/plugins/sudoers/regress/sudoers/test30.sudo.ok @@ -0,0 +1,7 @@ +user1 ALL = list + +list ALL = ALL + +user2 ALL = (list : list) ALL + +user3 list = ALL diff --git a/plugins/sudoers/regress/sudoers/test30.toke.ok b/plugins/sudoers/regress/sudoers/test30.toke.ok new file mode 100644 index 000000000..a6a05efad --- /dev/null +++ b/plugins/sudoers/regress/sudoers/test30.toke.ok @@ -0,0 +1,10 @@ +# +# + +WORD(6) ALL = WORD(6) + +WORD(6) ALL = ALL + +WORD(6) ALL = ( WORD(6) : WORD(6) ) ALL + +WORD(6) WORD(6) = ALL |