aboutsummaryrefslogtreecommitdiffstats
path: root/packages/spamd_db_ext.php
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2006-06-02 17:16:39 +0000
committerScott Ullrich <sullrich@pfsense.org>2006-06-02 17:16:39 +0000
commita493fed52d1075ccaf629a0ee7aa012855b7be7a (patch)
treea8873a137d2cde0d8057bb487269c0c77a89bf55 /packages/spamd_db_ext.php
parentf14370090e067ae878690b3886dbb13a1f22f52e (diff)
downloadpfsense-packages-a493fed52d1075ccaf629a0ee7aa012855b7be7a.tar.gz
pfsense-packages-a493fed52d1075ccaf629a0ee7aa012855b7be7a.tar.bz2
pfsense-packages-a493fed52d1075ccaf629a0ee7aa012855b7be7a.zip
Reall delete from blacklist.
Diffstat (limited to 'packages/spamd_db_ext.php')
-rw-r--r--packages/spamd_db_ext.php30
1 files changed, 5 insertions, 25 deletions
diff --git a/packages/spamd_db_ext.php b/packages/spamd_db_ext.php
index ae6c51fb..b7d30589 100644
--- a/packages/spamd_db_ext.php
+++ b/packages/spamd_db_ext.php
@@ -73,7 +73,7 @@ if($_GET['action'] or $_POST['action']) {
usleep(100);
exec("/usr/local/sbin/spamdb -a {$srcip}");
mwexec("/sbin/pfctl -q -t blacklist -T replace -f /var/db/blacklist.txt");
- delete_from_spamd_bl($srcip);
+ delete_from_blacklist($srcip);
log_error("spamd: {$srcip} has been whitelisted by {$_SERVER['REMOTE_ADDR']} {$loginname}");
hup_spamd();
exit;
@@ -83,7 +83,7 @@ if($_GET['action'] or $_POST['action']) {
hup_spamd();
mwexec("/sbin/pfctl -q -t spamd -T delete $srcip");
mwexec("/sbin/pfctl -q -t blacklist -T replace -f /var/db/blacklist.txt");
- delete_from_spamd_bl($srcip);
+ delete_from_blacklist($srcip);
log_error("spamd: {$srcip} has been deleted by {$_SERVER['REMOTE_ADDR']} {$loginname}");
exit;
} else if($action == "spamtrap") {
@@ -156,27 +156,6 @@ if($_GET['whitelist'] <> "") {
exit;
}
-function delete_from_spamd_bl($ip) {
- config_lock();
- if(!file_exists("/var/db/blacklist.txt"))
- return;
- $blacklist = file("/var/db/blacklist.txt");
- $new_blacklist = array();
- foreach($blacklist as $bl) {
- if(stristr($bl, $ip)) {
- /* don't add item */
- } else {
- $new_blacklist[] = $bl;
- }
- }
- $fd = fopen("/var/db/blacklist.txt", "w");
- foreach($new_blacklist as $bl)
- fwrite($fd, $bl . "\n");
- flose($fd);
- mwexec("/sbin/pfctl -q -t blacklist -T replace -f /var/db/blacklist.txt");
- config_unlock();
-}
-
function delete_from_spamd_db($srcip) {
config_lock();
$fd = fopen("/tmp/execcmds", "w");
@@ -216,8 +195,9 @@ function delete_from_blacklist($srcip) {
$blacklist = split("\n", file_get_contents("/var/db/blacklist.txt"));
$fd = fopen("/var/db/blacklist.txt", "w");
foreach($blacklist as $bl) {
- if($blacklist <> $srcip)
- fwrite($fd, "{$srcip}\n");
+ if($bl <> "")
+ if(!stristr($bl, $srcip))
+ fwrite($fd, "{$bl}\n");
}
fclose($fd);
mwexec("/sbin/pfctl -q -t spamd -T delete $srcip");