Hello,

this patch cleans up the crontabs after the cron tests.

 When the crontab was not deleted, after deletion of the test user, it
 became a file with bogus permissions (owned by a nonexistent
 user). This caused subsequent crontab creation for a user of the same
 name (but different ID) to fail.

Regards
    Jiri Palecek

Signed-off-by: Jiri Palecek <[email protected]>
---
 testcases/commands/cron/cron_allow01 |    4 ++++
 testcases/commands/cron/cron_deny01  |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/testcases/commands/cron/cron_allow01 
b/testcases/commands/cron/cron_allow01
index 501f6c4..839ad81 100755
--- a/testcases/commands/cron/cron_allow01
+++ b/testcases/commands/cron/cron_allow01
@@ -52,6 +52,8 @@ do_setup() {
        mv $CRON_ALLOW $CRON_ALLOW.old &> /dev/null
 
        #remove users for clean enviroment
+    su $TEST_USER1 -c "crontab -r"
+    su $TEST_USER2 -c "crontab -r"
         rm -rf /home/$TEST_USER1
         rm -rf /home/$TEST_USER2
        userdel $TEST_USER1
@@ -81,6 +83,8 @@ do_setup() {
 # FUNCTION:  do_cleanup
 #-----------------------------------------------------------------------
 do_cleanup(){
+    su $TEST_USER1 -c "crontab -r"
+    su $TEST_USER2 -c "crontab -r"
         rm -rf /home/$TEST_USER1
         rm -rf /home/$TEST_USER2
        userdel $TEST_USER1
diff --git a/testcases/commands/cron/cron_deny01 
b/testcases/commands/cron/cron_deny01
index 0cd75fd..f7f8fd4 100755
--- a/testcases/commands/cron/cron_deny01
+++ b/testcases/commands/cron/cron_deny01
@@ -56,6 +56,8 @@ do_setup() {
        mv $CRON_ALLOW $CRON_ALLOW.old &> /dev/null
 
        #remove users for clean enviroment
+    su $TEST_USER1 -c "crontab -r"
+    su $TEST_USER2 -c "crontab -r"
         rm -rf /home/$TEST_USER1
         rm -rf /home/$TEST_USER2
        userdel $TEST_USER1 
@@ -85,6 +87,8 @@ do_setup() {
 # FUNCTION:  do_cleanup
 #-----------------------------------------------------------------------
 do_cleanup(){
+    su $TEST_USER1 -c "crontab -r"
+    su $TEST_USER2 -c "crontab -r"
         rm -rf /home/$TEST_USER1
         rm -rf /home/$TEST_USER2
        userdel $TEST_USER1
-- 
1.6.2.rc1




------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to