mirror of
https://github.com/sudo-project/sudo.git
synced 2025-08-22 01:49:11 +00:00
Add test for syntax error when defining an alias using a reserved word.
This commit is contained in:
parent
e826705b62
commit
7a36d70fc1
2
MANIFEST
2
MANIFEST
@ -829,6 +829,8 @@ plugins/sudoers/regress/testsudoers/test11.out.ok
|
|||||||
plugins/sudoers/regress/testsudoers/test11.sh
|
plugins/sudoers/regress/testsudoers/test11.sh
|
||||||
plugins/sudoers/regress/testsudoers/test12.out.ok
|
plugins/sudoers/regress/testsudoers/test12.out.ok
|
||||||
plugins/sudoers/regress/testsudoers/test12.sh
|
plugins/sudoers/regress/testsudoers/test12.sh
|
||||||
|
plugins/sudoers/regress/testsudoers/test13.out.ok
|
||||||
|
plugins/sudoers/regress/testsudoers/test13.sh
|
||||||
plugins/sudoers/regress/testsudoers/test2.inc
|
plugins/sudoers/regress/testsudoers/test2.inc
|
||||||
plugins/sudoers/regress/testsudoers/test2.out.ok
|
plugins/sudoers/regress/testsudoers/test2.out.ok
|
||||||
plugins/sudoers/regress/testsudoers/test2.sh
|
plugins/sudoers/regress/testsudoers/test2.sh
|
||||||
|
22
plugins/sudoers/regress/testsudoers/test13.out.ok
Normal file
22
plugins/sudoers/regress/testsudoers/test13.out.ok
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
Testing alias definitions using reserved words
|
||||||
|
|
||||||
|
sudoers:1: syntax error, reserved word used as an alias name
|
||||||
|
Cmnd_Alias ALL=ALL
|
||||||
|
^~~
|
||||||
|
sudoers:2: syntax error, reserved word used as an alias name
|
||||||
|
Cmnd_Alias CHROOT=foo
|
||||||
|
^~~~~~
|
||||||
|
sudoers:3: syntax error, reserved word used as an alias name
|
||||||
|
User_Alias TIMEOUT=foo
|
||||||
|
^~~~~~~
|
||||||
|
sudoers:4: syntax error, reserved word used as an alias name
|
||||||
|
Runas_Alias CWD=bar
|
||||||
|
^~~
|
||||||
|
sudoers:5: syntax error, reserved word used as an alias name
|
||||||
|
Host_Alias NOTBEFORE=baz
|
||||||
|
^~~~~~~~~
|
||||||
|
sudoers:6: syntax error, reserved word used as an alias name
|
||||||
|
Host_Alias NOTAFTER=biff
|
||||||
|
^~~~~~~~
|
||||||
|
|
||||||
|
root ALL = ALL
|
23
plugins/sudoers/regress/testsudoers/test13.sh
Executable file
23
plugins/sudoers/regress/testsudoers/test13.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Test sudoers file with reserved words as alias names.
|
||||||
|
# The standard error output is dup'd to the standard output.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Avoid warnings about memory leaks when there is a syntax error
|
||||||
|
ASAN_OPTIONS=detect_leaks=0; export ASAN_OPTIONS
|
||||||
|
|
||||||
|
echo "Testing alias definitions using reserved words"
|
||||||
|
echo ""
|
||||||
|
./testsudoers -d <<EOF 2>&1
|
||||||
|
Cmnd_Alias ALL=ALL
|
||||||
|
Cmnd_Alias CHROOT=foo
|
||||||
|
User_Alias TIMEOUT=foo
|
||||||
|
Runas_Alias CWD=bar
|
||||||
|
Host_Alias NOTBEFORE=baz
|
||||||
|
Host_Alias NOTAFTER=biff
|
||||||
|
|
||||||
|
root ALL = ALL
|
||||||
|
EOF
|
||||||
|
|
||||||
|
exit 0
|
Loading…
x
Reference in New Issue
Block a user