aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorErik Fonnesbeck <efonnes@gmail.com>2011-03-22 22:55:41 -0600
committerErik Fonnesbeck <efonnes@gmail.com>2011-03-22 22:55:41 -0600
commit7ed9e31909834e43582bfaf6263d7337ebc7f25c (patch)
tree8216b2bed9e09bf75d57ccb0c21d2cacb24b9d07 /config
parent0a036c80eef23fd483a6682b4dc0b4a89d0331d5 (diff)
downloadpfsense-packages-7ed9e31909834e43582bfaf6263d7337ebc7f25c.tar.gz
pfsense-packages-7ed9e31909834e43582bfaf6263d7337ebc7f25c.tar.bz2
pfsense-packages-7ed9e31909834e43582bfaf6263d7337ebc7f25c.zip
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
Diffstat (limited to 'config')
-rw-r--r--config/spamd/spamd.inc19
-rw-r--r--config/spamd/spamd_whitelist.xml21
2 files changed, 20 insertions, 20 deletions
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 @@
<name>spamd-whitelist</name>
<version>0.1.0</version>
<title>SpamD: Whitelist</title>
+ <include_file>/usr/local/pkg/spamd.inc</include_file>
<!-- Menu is where this packages menu will appear -->
<menu>
<name>SpamD Whitelist</name>
@@ -103,26 +104,6 @@
<type>input</type>
</field>
</fields>
- <custom_php_command_before_form>
- 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();
- }
- </custom_php_command_before_form>
<custom_delete_php_command>
sync_package_spamd_whitelist();
</custom_delete_php_command>