Commit 0c4be73f authored by tbrehm's avatar tbrehm
Browse files

Bugfix: Don't remove delete mailbox under home/vmail

parent 93f15ebe
......@@ -53,7 +53,7 @@ class mail_plugin {
//* Mail Domains
//$app->plugins->registerEvent('mail_domain_insert',$this->plugin_name,'domain_insert');
//$app->plugins->registerEvent('mail_domain_update',$this->plugin_name,'domain_update');
//$app->plugins->registerEvent('mail_domain_delete',$this->plugin_name,'domain_delete');
$app->plugins->registerEvent('mail_domain_delete',$this->plugin_name,'domain_delete');
}
......@@ -125,6 +125,22 @@ class mail_plugin {
}
}
function domain_delete($event_name,$data) {
global $app, $conf;
// get the config
$app->uses("getconf");
$mail_config = $app->getconf->get_server_config($conf["server_id"], 'mail');
$old_maildomain_path = escapeshellcmd($mail_config['homedir_path'].'/'.$data['old']['domain']);
if(!stristr($old_maildomain_path,'..') && !stristr($old_maildomain_path,'*') && strlen($old_maildomain_path) >= 10) {
exec('rm -rf '.escapeshellcmd($old_maildomain_path));
$app->log('Deleted the mail domain directory: '.$old_maildomain_path,LOGLEVEL_DEBUG);
} else {
$app->log('Possible security violation when deleting the mail domain directory: '.$old_maildomain_path,LOGLEVEL_ERROR);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment