Add tests for entries without a newline.
This commit is contained in:
4
MANIFEST
4
MANIFEST
@@ -831,6 +831,10 @@ plugins/sudoers/regress/testsudoers/test12.out.ok
|
||||
plugins/sudoers/regress/testsudoers/test12.sh
|
||||
plugins/sudoers/regress/testsudoers/test13.out.ok
|
||||
plugins/sudoers/regress/testsudoers/test13.sh
|
||||
plugins/sudoers/regress/testsudoers/test14.out.ok
|
||||
plugins/sudoers/regress/testsudoers/test14.sh
|
||||
plugins/sudoers/regress/testsudoers/test15.out.ok
|
||||
plugins/sudoers/regress/testsudoers/test15.sh
|
||||
plugins/sudoers/regress/testsudoers/test2.inc
|
||||
plugins/sudoers/regress/testsudoers/test2.out.ok
|
||||
plugins/sudoers/regress/testsudoers/test2.sh
|
||||
|
18
plugins/sudoers/regress/testsudoers/test14.out.ok
Normal file
18
plugins/sudoers/regress/testsudoers/test14.out.ok
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
Testing user privilege without a newline
|
||||
|
||||
Parses OK
|
||||
|
||||
millert ALL = ALL
|
||||
|
||||
Testing alias without a newline
|
||||
|
||||
Parses OK
|
||||
|
||||
Cmnd_Alias FOO = /bin/bar
|
||||
|
||||
Testing Defaults without a newline
|
||||
|
||||
Parses OK
|
||||
|
||||
Defaults log_output
|
23
plugins/sudoers/regress/testsudoers/test14.sh
Executable file
23
plugins/sudoers/regress/testsudoers/test14.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Test entries with no trailing newline.
|
||||
#
|
||||
|
||||
exec 2>&1
|
||||
|
||||
echo ""
|
||||
echo "Testing user privilege without a newline"
|
||||
echo ""
|
||||
printf "millert ALL = ALL" | ./testsudoers -d
|
||||
|
||||
echo ""
|
||||
echo "Testing alias without a newline"
|
||||
echo ""
|
||||
printf "Cmnd_Alias FOO=/bin/bar" | ./testsudoers -d
|
||||
|
||||
echo ""
|
||||
echo "Testing Defaults without a newline"
|
||||
echo ""
|
||||
printf "Defaults log_output" | ./testsudoers -d
|
||||
|
||||
exit 0
|
17
plugins/sudoers/regress/testsudoers/test15.out.ok
Normal file
17
plugins/sudoers/regress/testsudoers/test15.out.ok
Normal file
@@ -0,0 +1,17 @@
|
||||
Testing @include of a file with a missing newline
|
||||
|
||||
Parses OK
|
||||
|
||||
Entries for user root:
|
||||
|
||||
ALL = /usr/bin/id
|
||||
host matched
|
||||
runas matched
|
||||
cmnd unmatched
|
||||
|
||||
ALL = ALL
|
||||
host matched
|
||||
runas matched
|
||||
cmnd allowed
|
||||
|
||||
Command allowed
|
22
plugins/sudoers/regress/testsudoers/test15.sh
Executable file
22
plugins/sudoers/regress/testsudoers/test15.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Test @include of a file with a missing newline
|
||||
#
|
||||
|
||||
# Create test file
|
||||
TESTDIR="`pwd`/regress/testsudoers"
|
||||
printf "root ALL = ALL" >"$TESTDIR/test15.inc"
|
||||
|
||||
MYUID=`\ls -lnd "$TESTDIR/test15.inc" | awk '{print $3}'`
|
||||
MYGID=`\ls -lnd "$TESTDIR/test15.inc" | awk '{print $4}'`
|
||||
exec 2>&1
|
||||
|
||||
echo "Testing @include of a file with a missing newline"
|
||||
echo ""
|
||||
./testsudoers -U $MYUID -G $MYGID root id <<-EOF
|
||||
@include $TESTDIR/test15.inc
|
||||
ALL ALL = /usr/bin/id
|
||||
EOF
|
||||
|
||||
rm -f "$TESTDIR/test15.inc"
|
||||
exit 0
|
Reference in New Issue
Block a user