securing cron-task #6 (removing user-files)

This commit is contained in:
Michael Kaufmann (d00p)
2010-01-24 14:26:45 +00:00
parent 9a91825f70
commit 688440d62e

View File

@@ -215,13 +215,28 @@ while($row = $db->fetch_array($result_tasks))
/*
* remove homedir
*/
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($settings['system']['documentroot_prefix'] . $row['data']['loginname']));
safe_exec('rm -rf '.escapeshellarg($settings['system']['documentroot_prefix'] . $row['data']['loginname']));
$homedir = makeCorrectDir($settings['system']['documentroot_prefix'] . $row['data']['loginname']);
if($homedir != '/'
&& $homedir != $settings['system']['documentroot_prefix']
&& substr($homedirdir, 0, strlen($settings['system']['documentroot_prefix'])) == $settings['system']['documentroot_prefix'])
{
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($homedir));
safe_exec('rm -rf '.escapeshellarg($homedir));
}
/*
* remove maildir
*/
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($settings['system']['vmail_homedir'] . $row['data']['loginname']));
safe_exec('rm -rf '.escapeshellarg($settings['system']['vmail_homedir'] . $row['data']['loginname']));
$maildir = makeCorrectDir($settings['system']['vmail_homedir'] . $row['data']['loginname']);
if($maildir != '/'
&& $maildir != $settings['system']['vmail_homedir']
&& substr($maildir, 0, strlen($settings['system']['vmail_homedir'])) == $settings['system']['vmail_homedir'])
{
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Running: rm -rf ' . escapeshellarg($maildir));
safe_exec('rm -rf '.escapeshellarg($maildir));
}
}
}
}