aboutsummaryrefslogtreecommitdiffstats
path: root/packages/spamd_whitelist.xml
diff options
context:
space:
mode:
Diffstat (limited to 'packages/spamd_whitelist.xml')
-rw-r--r--packages/spamd_whitelist.xml29
1 files changed, 16 insertions, 13 deletions
diff --git a/packages/spamd_whitelist.xml b/packages/spamd_whitelist.xml
index 67b5e233..0bd787cd 100644
--- a/packages/spamd_whitelist.xml
+++ b/packages/spamd_whitelist.xml
@@ -64,19 +64,22 @@
</fields>
<custom_php_command_before_form>
function sync_package_spamd_whitelist() {
- global $config;
- conf_mount_rw();
- config_lock();
- $fd = fopen("/var/db/whitelist.txt","w");
- if($config['installedpackages']['spamdwhitelist']['config'] != "")
- foreach($config['installedpackages']['spamdwhitelist']['config'] as $spamd) {
- fwrite($fd, $spamd['ip'] . "\n");
- }
- fclose($fd);
- /* signal a reload of all files */
- mwexec("killall -HUP spamlogd");
- conf_mount_ro();
- config_unlock();
+ global $config;
+ conf_mount_rw();
+ config_lock();
+ /* write out ip to the whitelist db */
+ $fd = fopen("/var/db/whitelist.txt","w");
+ if($config['installedpackages']['spamdwhitelist']['config'] != "") {
+ foreach($config['installedpackages']['spamdwhitelist']['config'] as $spamd) {
+ fwrite($fd, $spamd['ip'] . "\n");
+ }
+ }
+ fclose($fd);
+ /* signal a reload of all files */
+ mwexec("/usr/bin/killall -HUP spamlogd");
+ mwexec("/sbin/pfctl -t spamd-white -T add {$spamd['ip']}");
+ conf_mount_ro();
+ config_unlock();
}
</custom_php_command_before_form>
<custom_delete_php_command>