]> granicus.if.org Git - cronie/commitdiff
In system tables was hardcoded home directory to "/". This was changed
authorMarcela Mašláňová <mmaslano@redhat.com>
Mon, 22 Mar 2010 09:58:01 +0000 (10:58 +0100)
committerMarcela Mašláňová <mmaslano@redhat.com>
Mon, 22 Mar 2010 09:58:01 +0000 (10:58 +0100)
to switching to "/" only when home for user isn't defined.

Based on rhbz#575419

contrib/0hourly
contrib/dailyjobs
src/security.c

index e4a63dcb17a784894fdeee2d8e9e02c0fb8bb114..09039c16aa0722ee15df8f9e8f1a05a669432751 100644 (file)
@@ -1,5 +1,4 @@
 SHELL=/bin/bash
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 MAILTO=root
-HOME=/
 01 * * * * root run-parts /etc/cron.hourly
index 0101c16620059dfd224487ef43cc270f57538730..ee9af24f07b197df7b7884aede43c53a388385db 100644 (file)
@@ -1,7 +1,6 @@
 SHELL=/bin/bash
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 MAILTO=root
-HOME=/
 
 # run-parts
 02 4 * * * root [ ! -f /etc/cron.hourly/0anacron ] && run-parts /etc/cron.daily
index c3b1463c9baddf7020b325f4719f4018ce43c285..348504a2d302616f1cf4bf2696dd3921d15bc51b 100644 (file)
@@ -218,8 +218,11 @@ int cron_change_user_permanently(struct passwd *pw, char *homedir) {
                return -1;
        }
        if (chdir(homedir) == -1) {
-               log_it("CRON", getpid(), "ERROR chdir failed", homedir, errno);
-               return -1;
+               if (setenv(homedir, "/", 0) == -1) {
+                       log_it("CRON", getpid(), "ERROR chdir failed", homedir, errno);
+                       return -1;
+               }
+               chdir("/");
        }
 
        return 0;