2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 01:49:11 +00:00

Add test for matching a literal "" command line argument as "" in sudoers.

GitHub issue #182.
This commit is contained in:
Todd C. Miller 2022-10-05 10:10:31 -06:00
parent fa952bfbb7
commit 2e2dd48bef
3 changed files with 42 additions and 0 deletions

View File

@ -1020,6 +1020,8 @@ plugins/sudoers/regress/testsudoers/test17.out.ok
plugins/sudoers/regress/testsudoers/test17.sh
plugins/sudoers/regress/testsudoers/test18.out.ok
plugins/sudoers/regress/testsudoers/test18.sh
plugins/sudoers/regress/testsudoers/test19.out.ok
plugins/sudoers/regress/testsudoers/test19.sh
plugins/sudoers/regress/testsudoers/test2.inc
plugins/sudoers/regress/testsudoers/test2.out.ok
plugins/sudoers/regress/testsudoers/test2.sh

View File

@ -0,0 +1,20 @@
Parses OK
Entries for user root:
ALL = /bin/ls ""
host matched
runas matched
cmnd allowed
Command allowed
Parses OK
Entries for user root:
ALL = /bin/ls ""
host matched
runas matched
cmnd unmatched
Command unmatched

View File

@ -0,0 +1,20 @@
#!/bin/sh
#
# Verify that "" in sudoers does not match a literal "" on the command line.
#
: ${TESTSUDOERS=testsudoers}
exec 2>&1
# This should succeed
$TESTSUDOERS root /bin/ls <<'EOF'
root ALL = /bin/ls ""
EOF
# This should fail
$TESTSUDOERS root /bin/ls '""' <<'EOF'
root ALL = /bin/ls ""
EOF
exit 0