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

Test cvtsudoers stdout and stderr separately.

Fixes a test failure on systems with musl libc.  Bug #873
This commit is contained in:
Todd C. Miller 2019-03-08 06:58:30 -07:00
parent 0766e0c647
commit 0c31cf15fe
38 changed files with 6 additions and 37 deletions

View File

@ -450,6 +450,7 @@ plugins/sudoers/regress/cvtsudoers/test24.out.ok
plugins/sudoers/regress/cvtsudoers/test24.sh plugins/sudoers/regress/cvtsudoers/test24.sh
plugins/sudoers/regress/cvtsudoers/test25.out.ok plugins/sudoers/regress/cvtsudoers/test25.out.ok
plugins/sudoers/regress/cvtsudoers/test25.sh plugins/sudoers/regress/cvtsudoers/test25.sh
plugins/sudoers/regress/cvtsudoers/test26.err.ok
plugins/sudoers/regress/cvtsudoers/test26.out.ok plugins/sudoers/regress/cvtsudoers/test26.out.ok
plugins/sudoers/regress/cvtsudoers/test26.sh plugins/sudoers/regress/cvtsudoers/test26.sh
plugins/sudoers/regress/cvtsudoers/test27.out.ok plugins/sudoers/regress/cvtsudoers/test27.out.ok
@ -465,6 +466,7 @@ plugins/sudoers/regress/cvtsudoers/test30.sh
plugins/sudoers/regress/cvtsudoers/test31.conf plugins/sudoers/regress/cvtsudoers/test31.conf
plugins/sudoers/regress/cvtsudoers/test31.out.ok plugins/sudoers/regress/cvtsudoers/test31.out.ok
plugins/sudoers/regress/cvtsudoers/test31.sh plugins/sudoers/regress/cvtsudoers/test31.sh
plugins/sudoers/regress/cvtsudoers/test32.err.ok
plugins/sudoers/regress/cvtsudoers/test32.out.ok plugins/sudoers/regress/cvtsudoers/test32.out.ok
plugins/sudoers/regress/cvtsudoers/test32.sh plugins/sudoers/regress/cvtsudoers/test32.sh
plugins/sudoers/regress/cvtsudoers/test33.out.ok plugins/sudoers/regress/cvtsudoers/test33.out.ok

View File

@ -3,7 +3,6 @@
# Test user and host filters # Test user and host filters
# #
exec 2>&1
./cvtsudoers -c "" -f sudoers -m user=millert,host=hercules $TESTDIR/sudoers ./cvtsudoers -c "" -f sudoers -m user=millert,host=hercules $TESTDIR/sudoers
exit 0 exit 0

View File

@ -3,7 +3,6 @@
# Test command defaults filtering # Test command defaults filtering
# #
exec 2>&1
./cvtsudoers -c "" -f sudoers -s aliases,privileges -d command $TESTDIR/sudoers ./cvtsudoers -c "" -f sudoers -s aliases,privileges -d command $TESTDIR/sudoers
exit 0 exit 0

View File

@ -3,5 +3,4 @@
# Test that Aliases are removed when filtering by defaults type # Test that Aliases are removed when filtering by defaults type
# #
exec 2>&1
./cvtsudoers -c "" -f sudoers -d command $TESTDIR/sudoers.defs ./cvtsudoers -c "" -f sudoers -d command $TESTDIR/sudoers.defs

View File

@ -3,5 +3,4 @@
# Test that Aliases are removed when filtering by defaults type # Test that Aliases are removed when filtering by defaults type
# #
exec 2>&1
./cvtsudoers -c "" -f sudoers -d user $TESTDIR/sudoers.defs ./cvtsudoers -c "" -f sudoers -d user $TESTDIR/sudoers.defs

View File

@ -3,5 +3,4 @@
# Test that Aliases are removed when filtering by defaults type # Test that Aliases are removed when filtering by defaults type
# #
exec 2>&1
./cvtsudoers -c "" -f sudoers -d host $TESTDIR/sudoers.defs ./cvtsudoers -c "" -f sudoers -d host $TESTDIR/sudoers.defs

View File

@ -3,5 +3,4 @@
# Test that Aliases are removed when filtering by defaults type # Test that Aliases are removed when filtering by defaults type
# #
exec 2>&1
./cvtsudoers -c "" -f sudoers -d runas $TESTDIR/sudoers.defs ./cvtsudoers -c "" -f sudoers -d runas $TESTDIR/sudoers.defs

View File

@ -3,7 +3,6 @@
# Test filters and pruning # Test filters and pruning
# #
exec 2>&1
./cvtsudoers -c "" -f sudoers -p -m user=user1 <<EOF ./cvtsudoers -c "" -f sudoers -p -m user=user1 <<EOF
user1, user2, user3, %group1 host1, host2, host3 = ALL user1, user2, user3, %group1 host1, host2, host3 = ALL
EOF EOF

View File

@ -3,7 +3,6 @@
# Test filters and pruning # Test filters and pruning
# #
exec 2>&1
./cvtsudoers -c "" -f sudoers -p -m user=user2,host=host2 <<EOF ./cvtsudoers -c "" -f sudoers -p -m user=user2,host=host2 <<EOF
user1, user2, user3, %group1 host1, host2, host3 = ALL user1, user2, user3, %group1 host1, host2, host3 = ALL
EOF EOF

View File

@ -3,7 +3,6 @@
# Test filters and pruning # Test filters and pruning
# #
exec 2>&1
./cvtsudoers -c "" -f sudoers -p -m group=group1,host=host1 <<EOF ./cvtsudoers -c "" -f sudoers -p -m group=group1,host=host1 <<EOF
user1, user2, user3, %group1 host1, host2, host3 = ALL user1, user2, user3, %group1 host1, host2, host3 = ALL
EOF EOF

View File

@ -3,7 +3,6 @@
# Test filters and pruning # Test filters and pruning
# #
exec 2>&1
./cvtsudoers -c "" -f sudoers -p -m group=group1,host=somehost <<EOF ./cvtsudoers -c "" -f sudoers -p -m group=group1,host=somehost <<EOF
user1, user2, user3, %group1 ALL = ALL user1, user2, user3, %group1 ALL = ALL
EOF EOF

View File

@ -3,5 +3,4 @@
# Test filters and pruning; alias contents don't get pruned # Test filters and pruning; alias contents don't get pruned
# #
exec 2>&1
./cvtsudoers -c "" -f sudoers -p -m user=FULLTIMERS,host=SERVERS $TESTDIR/sudoers ./cvtsudoers -c "" -f sudoers -p -m user=FULLTIMERS,host=SERVERS $TESTDIR/sudoers

View File

@ -3,7 +3,6 @@
# Test user and host filters, expanding aliases # Test user and host filters, expanding aliases
# #
exec 2>&1
./cvtsudoers -c "" -f sudoers -e -m user=millert,host=hercules $TESTDIR/sudoers ./cvtsudoers -c "" -f sudoers -e -m user=millert,host=hercules $TESTDIR/sudoers
exit 0 exit 0

View File

@ -3,7 +3,6 @@
# Test cvtsudoers.conf # Test cvtsudoers.conf
# #
exec 2>&1
./cvtsudoers -c $TESTDIR/test20.conf <<EOF ./cvtsudoers -c $TESTDIR/test20.conf <<EOF
Defaults:SOMEUSERS authenticate, timestamp_timeout=0 Defaults:SOMEUSERS authenticate, timestamp_timeout=0
User_Alias SOMEUSERS = user1, user2, user3 User_Alias SOMEUSERS = user1, user2, user3

View File

@ -3,7 +3,6 @@
# Test cvtsudoers.conf # Test cvtsudoers.conf
# #
exec 2>&1
./cvtsudoers -c $TESTDIR/test21.conf <<EOF ./cvtsudoers -c $TESTDIR/test21.conf <<EOF
Defaults authenticate, timestamp_timeout=0 Defaults authenticate, timestamp_timeout=0
User_Alias FULLTIMERS = user1, user2, user3 User_Alias FULLTIMERS = user1, user2, user3

View File

@ -3,7 +3,6 @@
# Test LDAP base filtering. # Test LDAP base filtering.
# #
exec 2>&1
./cvtsudoers -c "" -i ldif -b "ou=SUDOers,dc=sudo,dc=ws" -I 10 -O 10 <<EOF ./cvtsudoers -c "" -i ldif -b "ou=SUDOers,dc=sudo,dc=ws" -I 10 -O 10 <<EOF
dn: dc=sudo,dc=ws dn: dc=sudo,dc=ws
objectClass: dcObject objectClass: dcObject

View File

@ -3,6 +3,5 @@
# Test round-tripping of sudoers -> LDIF -> sudoers # Test round-tripping of sudoers -> LDIF -> sudoers
# #
exec 2>&1
./cvtsudoers -c "" -b "ou=SUDOers,dc=sudo,dc=ws" $TESTDIR/test23.out.ok | \ ./cvtsudoers -c "" -b "ou=SUDOers,dc=sudo,dc=ws" $TESTDIR/test23.out.ok | \
./cvtsudoers -c "" -i LDIF -f sudoers | grep -v '^#' ./cvtsudoers -c "" -i LDIF -f sudoers | grep -v '^#'

View File

@ -3,6 +3,5 @@
# Test round-tripping of LDIF -> sudoers -> LDIF # Test round-tripping of LDIF -> sudoers -> LDIF
# #
exec 2>&1
./cvtsudoers -c "" -i LDIF -f sudoers $TESTDIR/test24.out.ok | \ ./cvtsudoers -c "" -i LDIF -f sudoers $TESTDIR/test24.out.ok | \
./cvtsudoers -c "" -b "ou=SUDOers,dc=sudo,dc=ws" ./cvtsudoers -c "" -b "ou=SUDOers,dc=sudo,dc=ws"

View File

@ -3,7 +3,6 @@
# Test LDIF base64 attribute parsing # Test LDIF base64 attribute parsing
# #
exec 2>&1
./cvtsudoers -c "" -i ldif -b "ou=SUDOers,dc=sudo,dc=ws" -I 10 -O 10 <<EOF ./cvtsudoers -c "" -i ldif -b "ou=SUDOers,dc=sudo,dc=ws" -I 10 -O 10 <<EOF
# defaults, SUDOers, sudo.ws # defaults, SUDOers, sudo.ws
dn:: Y249ZGVmYXVsdHMsb3U9U1VET2VycyxkYz1zdWRvLGRjPXdz dn:: Y249ZGVmYXVsdHMsb3U9U1VET2VycyxkYz1zdWRvLGRjPXdz

View File

@ -0,0 +1,3 @@
cvtsudoers: ignoring invalid attribute value: bG9nX29@1dHB1dA==
cvtsudoers: ignoring invalid attribute value: Y249cm9vdCxvdT1TVURPZXJzLGRjPXN1ZG8sZGM9_d3M=
cvtsudoers: ignoring invalid attribute value: Y249JXdoZWVsLG91PVNVRE9lcnMsZGM9c3VkbyxkYz13cw!==

View File

@ -1,3 +0,0 @@
cvtsudoers: ignoring invalid attribute value: bG9nX29@1dHB1dA==
cvtsudoers: ignoring invalid attribute value: Y249cm9vdCxvdT1TVURPZXJzLGRjPXN1ZG8sZGM9_d3M=
cvtsudoers: ignoring invalid attribute value: Y249JXdoZWVsLG91PVNVRE9lcnMsZGM9c3VkbyxkYz13cw!==

View File

@ -3,7 +3,6 @@
# Test LDIF invalid base64 attribute parsing # Test LDIF invalid base64 attribute parsing
# #
exec 2>&1
./cvtsudoers -c "" -i ldif -b "ou=SUDOers,dc=sudo,dc=ws" -I 10 -O 10 <<EOF ./cvtsudoers -c "" -i ldif -b "ou=SUDOers,dc=sudo,dc=ws" -I 10 -O 10 <<EOF
# defaults, SUDOers, sudo.ws # defaults, SUDOers, sudo.ws
dn:: Y249ZGVmYXVsdHMsb3U9U1VET2VycyxkYz1zdWRvLGRjPXdz dn:: Y249ZGVmYXVsdHMsb3U9U1VET2VycyxkYz1zdWRvLGRjPXdz

View File

@ -3,7 +3,6 @@
# Test base64 encoding of non-safe strings # Test base64 encoding of non-safe strings
# #
exec 2>&1
./cvtsudoers -c "" -b "ou=SUDOers©,dc=sudo,dc=ws" <<EOF ./cvtsudoers -c "" -b "ou=SUDOers©,dc=sudo,dc=ws" <<EOF
Defaults badpass_message="Bad password¡" Defaults badpass_message="Bad password¡"

View File

@ -3,7 +3,6 @@
# Test LDAP sudoOrder when converting to sudoers. # Test LDAP sudoOrder when converting to sudoers.
# #
exec 2>&1
./cvtsudoers -c "" -i ldif -f sudoers <<EOF ./cvtsudoers -c "" -i ldif -f sudoers <<EOF
dn: dc=sudo,dc=ws dn: dc=sudo,dc=ws
objectClass: dcObject objectClass: dcObject

View File

@ -3,7 +3,6 @@
# Test LDAP sudoOrder when converting to sudoers. # Test LDAP sudoOrder when converting to sudoers.
# #
exec 2>&1
./cvtsudoers -c "" -i ldif -f sudoers <<EOF ./cvtsudoers -c "" -i ldif -f sudoers <<EOF
dn: dc=sudo,dc=ws dn: dc=sudo,dc=ws
objectClass: dcObject objectClass: dcObject

View File

@ -3,7 +3,6 @@
# Test group and host filters # Test group and host filters
# #
exec 2>&1
./cvtsudoers -c "" -f sudoers -m group=wheel,host=blackhole $TESTDIR/sudoers ./cvtsudoers -c "" -f sudoers -m group=wheel,host=blackhole $TESTDIR/sudoers
exit 0 exit 0

View File

@ -4,7 +4,6 @@
# See https://bugzilla.sudo.ws/show_bug.cgi?id=853 # See https://bugzilla.sudo.ws/show_bug.cgi?id=853
# #
exec 2>&1
./cvtsudoers -c "" -e -f json <<EOF ./cvtsudoers -c "" -e -f json <<EOF
Cmnd_Alias CMDA=/path/to/cmda Cmnd_Alias CMDA=/path/to/cmda
Cmnd_Alias CMDB=/path/to/cmdb Cmnd_Alias CMDB=/path/to/cmdb

View File

@ -3,7 +3,6 @@
# Test cvtsudoers.conf with padding # Test cvtsudoers.conf with padding
# #
exec 2>&1
./cvtsudoers -c $TESTDIR/test31.conf <<EOF ./cvtsudoers -c $TESTDIR/test31.conf <<EOF
Defaults authenticate, timestamp_timeout=0 Defaults authenticate, timestamp_timeout=0
User_Alias FULLTIMERS = user1, user2, user3 User_Alias FULLTIMERS = user1, user2, user3

View File

@ -0,0 +1 @@
cvtsudoers: too many sudoers entries, maximum 10

View File

@ -1,4 +1,3 @@
cvtsudoers: too many sudoers entries, maximum 10
dn: cn=user0,ou=SUDOers,dc=my-domain,dc=com dn: cn=user0,ou=SUDOers,dc=my-domain,dc=com
objectClass: top objectClass: top
objectClass: sudoRole objectClass: sudoRole

View File

@ -3,7 +3,6 @@
# Test cvtsudoers.conf with invalid padding # Test cvtsudoers.conf with invalid padding
# #
exec 2>&1
./cvtsudoers -c "" -b "ou=SUDOers,dc=my-domain,dc=com" -O 1000 -P 1 <<EOF ./cvtsudoers -c "" -b "ou=SUDOers,dc=my-domain,dc=com" -O 1000 -P 1 <<EOF
user0 ALL = (ALL:ALL) ALL user0 ALL = (ALL:ALL) ALL
user1 ALL = (ALL:ALL) ALL user1 ALL = (ALL:ALL) ALL

View File

@ -3,7 +3,6 @@
# Test LDAP negated sudoRunAsUser and sudoRunAsGroup converted to sudoers. # Test LDAP negated sudoRunAsUser and sudoRunAsGroup converted to sudoers.
# #
exec 2>&1
./cvtsudoers -c "" -i ldif -f sudoers <<EOF ./cvtsudoers -c "" -i ldif -f sudoers <<EOF
dn: dc=sudo,dc=ws dn: dc=sudo,dc=ws
objectClass: dcObject objectClass: dcObject

View File

@ -3,7 +3,6 @@
# Test group and host filters, expanding aliases # Test group and host filters, expanding aliases
# #
exec 2>&1
./cvtsudoers -c "" -f sudoers -e -m group=wheel,host=blackhole $TESTDIR/sudoers ./cvtsudoers -c "" -f sudoers -e -m group=wheel,host=blackhole $TESTDIR/sudoers
exit 0 exit 0

View File

@ -3,7 +3,6 @@
# Test defaults type filtering # Test defaults type filtering
# #
exec 2>&1
./cvtsudoers -c "" -f sudoers -s aliases,privileges -d all $TESTDIR/sudoers ./cvtsudoers -c "" -f sudoers -s aliases,privileges -d all $TESTDIR/sudoers
exit 0 exit 0

View File

@ -3,7 +3,6 @@
# Test global defaults filtering # Test global defaults filtering
# #
exec 2>&1
./cvtsudoers -c "" -f sudoers -s aliases,privileges -d global $TESTDIR/sudoers ./cvtsudoers -c "" -f sudoers -s aliases,privileges -d global $TESTDIR/sudoers
exit 0 exit 0

View File

@ -3,7 +3,6 @@
# Test user defaults filtering # Test user defaults filtering
# #
exec 2>&1
./cvtsudoers -c "" -f sudoers -s aliases,privileges -d user $TESTDIR/sudoers ./cvtsudoers -c "" -f sudoers -s aliases,privileges -d user $TESTDIR/sudoers
exit 0 exit 0

View File

@ -3,7 +3,6 @@
# Test runas defaults filtering # Test runas defaults filtering
# #
exec 2>&1
./cvtsudoers -c "" -f sudoers -s aliases,privileges -d runas $TESTDIR/sudoers ./cvtsudoers -c "" -f sudoers -s aliases,privileges -d runas $TESTDIR/sudoers
exit 0 exit 0

View File

@ -3,7 +3,6 @@
# Test host defaults filtering # Test host defaults filtering
# #
exec 2>&1
./cvtsudoers -c "" -f sudoers -s aliases,privileges -d host $TESTDIR/sudoers ./cvtsudoers -c "" -f sudoers -s aliases,privileges -d host $TESTDIR/sudoers
exit 0 exit 0