2 #*********************************************************************
3 # Copyright (c) International Business Machines Corp., 2000
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
13 # the GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this pronram; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # PURPOSE: Test a bad (negative) cron job
22 # - try to edit the crontab of root
23 # - try to set illegal or nondefined execution times
24 # Here the script uses file illegal_cron_lines which contains two
25 # fields per line: the cron line to be tested (without script name),
26 # and the description of this test. The description is written to
27 # stdout during execution of the test.
28 # - try to do things you aren't allowed as non-root (cron runs as root)
37 TEST_USER_GROUP
="users"
38 TEST_USER_HOMEDIR
="/home/$TEST_USER"
40 #-----------------------------------------------------------------------
42 #-----------------------------------------------------------------------
46 #erase user if he may exist , so we can have a clean env
47 rm -rf /home
/$TEST_USER
51 useradd
-m -g $TEST_USER_GROUP $TEST_USER
54 echo "Could not add test user $TEST_USER to system $RHOST."
59 # Red Hat uses crond, SuSE/Other uses cron.
60 if [ -f /etc
/init.d
/crond
]; then
61 /etc
/init.d
/crond restart
63 /etc
/init.d
/cron restart
67 #-----------------------------------------------------------------------
68 # FUNCTION: do_cleanup
69 #-----------------------------------------------------------------------
72 rm -rf /home
/$TEST_USER
76 #-----------------------------------------------------------------------
78 #-----------------------------------------------------------------------
80 cron_neg_tests.sh
$TEST_USER