blob: 8be4ebc8f6784eaa1d8693afa1f777741cfad160 (
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
|
#!/bin/sh
#
# Verify that NOTBEFORE and NOTAFTER work as expected.
#
: ${TESTSUDOERS=testsudoers}
exec 2>&1
retval=0
$TESTSUDOERS -T 20170214083000Z root /bin/ls <<'EOF'
root ALL = NOTBEFORE=20170214083000Z /bin/ls
EOF
if [ $? -ne 0 ]; then
retval=$?
fi
# expect failure
$TESTSUDOERS -T 20170214083000Z root /bin/ls <<'EOF'
root ALL = NOTBEFORE=20170214083001Z /bin/ls
EOF
if [ $? -eq 0 ]; then
retval=1
fi
$TESTSUDOERS -T 20170214083000Z root /bin/ls <<'EOF'
root ALL = NOTAFTER=20170214083000Z /bin/ls
EOF
if [ $? -ne 0 ]; then
retval=$?
fi
# expect failure
$TESTSUDOERS -T 20170214083001Z root /bin/ls <<'EOF'
root ALL = NOTAFTER=20170214083000Z /bin/ls
EOF
if [ $? -eq 0 ]; then
retval=1
fi
exit $retval
|