Add test for using "list" as user, runas and host.

This commit is contained in:
Todd C. Miller
2023-02-28 08:56:44 -07:00
parent 0197491e9c
commit 172515c94d
8 changed files with 168 additions and 0 deletions

View File

@@ -999,6 +999,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

View File

@@ -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

View File

@@ -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" }
]
}
]
}
]
}

View File

@@ -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

View File

@@ -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

View File

@@ -0,0 +1,6 @@
Parses OK
user1 ALL = list
list ALL = ALL
user2 ALL = (list : list) ALL
user3 list = ALL

View File

@@ -0,0 +1,7 @@
user1 ALL = list
list ALL = ALL
user2 ALL = (list : list) ALL
user3 list = ALL

View File

@@ -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