From 7ed9e31909834e43582bfaf6263d7337ebc7f25c Mon Sep 17 00:00:00 2001 From: Erik Fonnesbeck Date: Tue, 22 Mar 2011 22:55:41 -0600 Subject: Move sync_package_spamd_whitelist() to spamd.inc and have spamd_whitelist.xml include spamd.inc to prevent an error that says it is undefined. May help with the issue reported for ticket #1363 --- config/spamd/spamd.inc | 19 +++++++++++++++++++ config/spamd/spamd_whitelist.xml | 21 +-------------------- 2 files changed, 20 insertions(+), 20 deletions(-) (limited to 'config/spamd') diff --git a/config/spamd/spamd.inc b/config/spamd/spamd.inc index 256ec08b..18b4e241 100644 --- a/config/spamd/spamd.inc +++ b/config/spamd/spamd.inc @@ -165,6 +165,25 @@ function sync_package_spamd() { log_error("SpamD setup completed"); } +function sync_package_spamd_whitelist() { + 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(); +} + function spamd_generate_rules($type) { global $config; diff --git a/config/spamd/spamd_whitelist.xml b/config/spamd/spamd_whitelist.xml index f7b3f4fe..8a916fb7 100644 --- a/config/spamd/spamd_whitelist.xml +++ b/config/spamd/spamd_whitelist.xml @@ -48,6 +48,7 @@ spamd-whitelist 0.1.0 SpamD: Whitelist + /usr/local/pkg/spamd.inc SpamD Whitelist @@ -103,26 +104,6 @@ input - - function sync_package_spamd_whitelist() { - 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(); - } - sync_package_spamd_whitelist(); -- cgit v1.2.3