| 1 |
#!/bin/sh |
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
TESTNR="03" |
| 6 |
BASEDIR="$(pwd)/debian/tests" |
| 7 |
COMMONDIR="${BASEDIR}/common" |
| 8 |
DIR="${BASEDIR}/${TESTNR}" |
| 9 |
PATH="/bin:/usr/bin:/sbin:/usr/sbin" |
| 10 |
FILES="$(find $DIR/sudoersd/ -type f)" |
| 11 |
echo $FILES |
| 12 |
DSTFILES="$(echo $FILES | sed "s|${DIR}/sudoersd|/etc/sudoers.d|g")" |
| 13 |
echo $DSTFILES |
| 14 |
|
| 15 |
trap ' |
| 16 |
true |
| 17 |
' 0 INT QUIT ABRT PIPE TERM |
| 18 |
|
| 19 |
printf "copy files to sudoers ... " |
| 20 |
cp $FILES /etc/sudoers.d/ |
| 21 |
printf "collect sudo -l output ... " |
| 22 |
OUTPUT="$(sudo -l | grep -- ----marker----)" |
| 23 |
EXPECTED=" (ALL : ALL) /usr/bin/----marker----/this-is-the-sudoersd-10_dsa\:\:util\:\:sudo[dfsg-team-role]-file |
| 24 |
(ALL : ALL) /usr/bin/----marker----/this-is-the-sudoersd-root-file" |
| 25 |
if [ "$OUTPUT" != "$EXPECTED" ]; then |
| 26 |
printf "sudo -l output not as expected, Test failed\n" |
| 27 |
exit 1 |
| 28 |
fi |
| 29 |
|
| 30 |
printf "test series sucessful, exit 0\n" |
| 31 |
exit 0 |
| 32 |
|