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

Add test of multiple syntax errors.

Where possible, the portion of the line before the error should be
still be interpreted.
This commit is contained in:
Todd C. Miller 2020-09-02 12:40:39 -06:00
parent 578789c56f
commit a51d194a73
3 changed files with 35 additions and 0 deletions

View File

@ -827,6 +827,8 @@ plugins/sudoers/regress/testsudoers/test10.out.ok
plugins/sudoers/regress/testsudoers/test10.sh
plugins/sudoers/regress/testsudoers/test11.out.ok
plugins/sudoers/regress/testsudoers/test11.sh
plugins/sudoers/regress/testsudoers/test12.out.ok
plugins/sudoers/regress/testsudoers/test12.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,15 @@
Testing sudoers with multiple syntax errors
sudoers:1: syntax error
User_Alias A1 = u1 u2 : A2 = u3, u4
^~
sudoers:3: syntax error
millert ALL = /fail : foo
^
sudoers:5: syntax error
root ALL = ALL bar
^~~
User_Alias A1 = u1
millert ALL = /fail

View File

@ -0,0 +1,18 @@
#!/bin/sh
#
# Test sudoers file with multiple syntax errors
# 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 sudoers with multiple syntax errors"
echo ""
./testsudoers -d <<EOF 2>&1 | sed 's/\(syntax error\), .*/\1/'
User_Alias A1 = u1 u2 : A2 = u3, u4
millert ALL = /fail : foo
root ALL = ALL bar
EOF