[vhffs-dev] [1627] fixed bug when script is o+w, improved detection of missing users database in chroot |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1627
Author: gradator
Date: 2010-10-06 16:57:36 +0200 (Wed, 06 Oct 2010)
Log Message:
-----------
fixed bug when script is o+w, improved detection of missing users database in chroot
Modified Paths:
--------------
trunk/vhffs-cron/src/vhffscron.pl
Modified: trunk/vhffs-cron/src/vhffscron.pl
===================================================================
--- trunk/vhffs-cron/src/vhffscron.pl 2010-09-18 15:24:33 UTC (rev 1626)
+++ trunk/vhffs-cron/src/vhffscron.pl 2010-10-06 14:57:36 UTC (rev 1627)
@@ -301,12 +301,14 @@
}
my ($username,undef,undef,undef,undef,undef,undef,$homedir,undef,undef) = getpwuid( $cron->get_owner_uid );
- $ENV{'PATH'} = '/usr/bin:/bin';
- $ENV{'HOME'} = $homedir;
- $ENV{'LOGNAME'} = $username;
- chdir $homedir;
+ if( $username and $homedir ) {
+ $ENV{'PATH'} = '/usr/bin:/bin';
+ $ENV{'HOME'} = $homedir;
+ $ENV{'LOGNAME'} = $username;
+ chdir $homedir;
+ }
- if( $ENV{'PWD'} ne $homedir ) {
+ unless( $username and $homedir and $ENV{'PWD'} eq $homedir ) {
print $son "CRITICAL: Cannot chdir() to home directory\n";
_exit(FAIL_TO_RUN_PROCESS_EXIT_CODE);
}
@@ -337,7 +339,7 @@
if( $mode & S_IWOTH ) {
print $son "CRITICAL: File is writeable by others, I am not going to execute that\n";
- exit(FAIL_TO_RUN_PROCESS_EXIT_CODE);
+ _exit(FAIL_TO_RUN_PROCESS_EXIT_CODE);
}
exec $cron->get_cronpath;