summaryrefslogtreecommitdiffstats
path: root/plugins/sudoers/regress/testsudoers/test10.sh
blob: c4f0f2d9e9045e13d058cf6ef45e9c1d8c73f582 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
#
# Test @include of a file with embedded white space
#

: ${TESTSUDOERS=testsudoers}

# Create test file
TESTDIR="`pwd`/regress/testsudoers"
cat >"$TESTDIR/test 10.inc" <<EOF
root ALL = ALL
EOF

MYUID=`\ls -lnd "$TESTDIR/test 10.inc" | awk '{print $3}'`
MYGID=`\ls -lnd "$TESTDIR/test 10.inc" | awk '{print $4}'`
exec 2>&1

echo "Testing @include of a path with escaped white space"
echo ""
$TESTSUDOERS -U $MYUID -G $MYGID root id <<-EOF
	@include $TESTDIR/test\ 10.inc
EOF

echo ""
echo "Testing @include of a double-quoted path with white space"
echo ""
$TESTSUDOERS -U $MYUID -G $MYGID root id <<-EOF
	@include "$TESTDIR/test 10.inc"
EOF

echo ""
echo "Testing #include of a path with escaped white space"
echo ""
$TESTSUDOERS -U $MYUID -G $MYGID root id <<-EOF
	#include $TESTDIR/test\ 10.inc
EOF

echo ""
echo "Testing #include of a double-quoted path with white space"
echo ""
$TESTSUDOERS -U $MYUID -G $MYGID root id <<-EOF
	#include "$TESTDIR/test 10.inc"
EOF

rm -f "$TESTDIR/test 10.inc"
exit 0