diff options
Diffstat (limited to 'packages')
-rw-r--r-- | packages/spamd_db.php | 5 | ||||
-rw-r--r-- | packages/spamd_db_ext.php | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/packages/spamd_db.php b/packages/spamd_db.php index 3189f0f5..4ce29cd8 100644 --- a/packages/spamd_db.php +++ b/packages/spamd_db.php @@ -59,13 +59,16 @@ if($_GET['action'] or $_POST['action']) { if($action == "whitelist") { exec("/usr/local/sbin/spamdb -d {$srcip}"); exec("/usr/local/sbin/spamdb -d \"<{$srcip}>\" -T"); - exec("/usr/local/sbin/spamdb -d \"<{$srcip}>\" -t"); + exec("/usr/local/sbin/spamdb -d \"<{$srcip}>\" -t"); + mwexec("/sbin/pfctl -q -t blacklist -T replace -f /var/db/blacklist.txt"); exec("echo spamdb -a {$srcip} > /tmp/tmp"); exec("/usr/local/sbin/spamdb -a {$srcip}"); } else if($action == "delete") { exec("/usr/local/sbin/spamdb -d {$srcip}"); exec("/usr/local/sbin/spamdb -d \"<{$srcip}>\" -T"); exec("/usr/local/sbin/spamdb -d \"<{$srcip}>\" -t"); + mwexec("/sbin/pfctl -q -t spamd -T delete $srcip"); + mwexec("/sbin/pfctl -q -t blacklist -T replace -f /var/db/blacklist.txt"); } else if($action == "spamtrap") { exec("/usr/local/sbin/spamdb -d {$srcip}"); exec("/usr/local/sbin/spamdb -d \"<{$srcip}>\" -T"); diff --git a/packages/spamd_db_ext.php b/packages/spamd_db_ext.php index 0873df7c..ea5eb1d0 100644 --- a/packages/spamd_db_ext.php +++ b/packages/spamd_db_ext.php @@ -70,18 +70,22 @@ if($_GET['action'] or $_POST['action']) { delete_from_spamd_db($srcip); usleep(100); exec("/usr/local/sbin/spamdb -a {$srcip}"); + mwexec("/sbin/pfctl -q -t blacklist -T replace -f /var/db/blacklist.txt"); hup_spamd(); exit; } else if($action == "delete") { delete_from_spamd_db($srcip); usleep(100); hup_spamd(); + mwexec("/sbin/pfctl -q -t spamd -T delete $srcip"); + mwexec("/sbin/pfctl -q -t blacklist -T replace -f /var/db/blacklist.txt"); exit; } else if($action == "spamtrap") { delete_from_spamd_db($email); usleep(100); exec("/usr/local/sbin/spamdb -a \"<{$email}>\" -T"); hup_spamd(); + mwexec("/sbin/pfctl -q -t blacklist -T add -f /var/db/blacklist.txt"); exit; } else if($action == "trapped") { delete_from_spamd_db($srcip); @@ -157,6 +161,7 @@ function delete_from_spamd_db($srcip) { exec("/bin/chmod a+rx /tmp/execcmds"); system("/bin/sh /tmp/execcmds"); mwexec("/usr/bin/killall -HUP spamlogd"); + mwexec("/sbin/pfctl -q -t blacklist -T replace -f /var/db/blacklist.txt"); config_unlock(); } @@ -186,8 +191,8 @@ function delete_from_blacklist($srcip) { fwrite($fd, "{$srcip}\n"); } fclose($fd); - mwexec("/sbin/pfctl -q -t spamd -T add -f /var/db/blacklist.txt"); - mwexec("/sbin/pfctl -q -t blacklist -T add -f /var/db/blacklist.txt"); + mwexec("/sbin/pfctl -q -t spamd -T delete $srcip"); + mwexec("/sbin/pfctl -q -t blacklist -T replace -f /var/db/blacklist.txt"); config_unlock(); } |