aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorMarcello Coutinho <marcellocoutinho@gmail.com>2012-04-16 22:59:34 -0300
committermarcelloc <marcellocoutinho@gmail.com>2012-04-16 22:59:34 -0300
commit55943f5f937e906d87ae1827025e3abce9b08ce0 (patch)
tree6f5ac8bf059c4a5cf5838082266e3c484c712b20 /config
parent4edb9dc9c97827cf30f836068a6e8a7f8fc690ef (diff)
downloadpfsense-packages-55943f5f937e906d87ae1827025e3abce9b08ce0.tar.gz
pfsense-packages-55943f5f937e906d87ae1827025e3abce9b08ce0.tar.bz2
pfsense-packages-55943f5f937e906d87ae1827025e3abce9b08ce0.zip
postfix - avoid duplications on ldap fetch and improve folder check
Diffstat (limited to 'config')
-rw-r--r--config/postfix/postfix.inc11
1 files changed, 7 insertions, 4 deletions
diff --git a/config/postfix/postfix.inc b/config/postfix/postfix.inc
index 29d1efc0..f76b523a 100644
--- a/config/postfix/postfix.inc
+++ b/config/postfix/postfix.inc
@@ -108,15 +108,18 @@ function sync_relay_recipients($via_cron="cron"){
$ldap_unique=array_unique($ldap_all);
print "Total ldap recipients:".count($ldap_all)."\tunique:".count($ldap_unique)."\n";
foreach($ldap_unique as $recipient)
- $relay_ldap_recipients.=($recipient != ""?$recipient." OK\n":"");
+ $relay_ldap_recipients.=($recipient != ""?preg_replace("/\s+/","",$recipient)." OK\n":"");
#save ldap relay recipients
file_put_contents("/usr/local/etc/postfix/relay_ldap_recipients.txt",$relay_ldap_recipients, LOCK_EX);
}
}
}
- #save all relay recipients and reload postfix
- file_put_contents("/usr/local/etc/postfix/relay_recipients",$relay_ldap_recipients."\n".$relay_recipients, LOCK_EX);
+ #save all relay recipients, remove duplicates and reload postfix
+ $recipients_file="/usr/local/etc/postfix/relay_recipients";
+ file_put_contents($recipients_file.".unsort",$relay_ldap_recipients."\n".$relay_recipients, LOCK_EX);
+ exec('/usr/bin/sort -u '.$recipients_file.'.unsort > '.$recipients_file);
+ unlink_if_exists($recipients_file.'.unsort');
exec("/usr/local/sbin/postmap /usr/local/etc/postfix/relay_recipients");
mwexec("/usr/local/sbin/postfix reload");
}
@@ -662,7 +665,7 @@ MASTEREOF2;
#check postix dirs
$dirs=array("/var/spool/postfix","/etc/mail","/var/db/postfix","/var/mail/postfix");
foreach ($dirs as $dir)
- if (!is_dir($dir))
+ if (!is_dir($dir) && !file_exists($dir))
mkdir($dir, 0755,TRUE);
#check postfix owners