Commit accfcafd authored by Marius Cramer's avatar Marius Cramer
Browse files

Merge branch 'master' into 'master'

fix for writing sieve file during mail account creation

- fixed writing to correct file
- better error handling and logging

See merge request !160
parents 84257582 4845fa07
......@@ -216,18 +216,22 @@ class maildeliver_plugin {
if ( ! is_dir($data["new"]["maildir"].'/sieve/') ) {
$app->system->mkdirpath($data["new"]["maildir"].'/sieve/', 0700, $mail_config['mailuser_name'], $mail_config['mailuser_group']);
}
file_put_contents($sieve_file, $tpl->grab());
exec('chown '.$mail_config['mailuser_name'].':'.$mail_config['mailuser_group'].' '.escapeshellcmd($sieve_file));
chown($sieve_file_isp,$mail_config['mailuser_name']);
chgrp($sieve_file_isp,$mail_config['mailuser_group']);
file_put_contents($sieve_file_isp, $tpl->grab()) or $app->log("Unable to write sieve filter file", LOGLEVEL_WARN);
if ( is_file($sieve_file_isp) ) {
$app->system->chown($sieve_file_isp,$mail_config['mailuser_name'],false);
$app->system->chgrp($sieve_file_isp,$mail_config['mailuser_group'],false);
}
chdir($data["new"]["maildir"]);
//* create symlink to activate sieve script
symlink("sieve/ispconfig.sieve", ".sieve") or $app->log("Unable to create symlink to active sieve filter", LOGLEVEL_WARN);
if (is_link(".sieve")) {
lchown(".sieve",$mail_config['mailuser_name']);
lchgrp(".sieve",$mail_config['mailuser_group']);
$app->system->chown(".sieve",$mail_config['mailuser_name'],true);
$app->system->chgrp(".sieve",$mail_config['mailuser_group'],true);
}
$app->system->chown($sieve_file,$mail_config['mailuser_name'],true);
$app->system->chgrp($sieve_file,$mail_config['mailuser_group'],true);
unset($tpl);
}
......
Markdown is supported
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