aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/spamd.inc34
1 files changed, 20 insertions, 14 deletions
diff --git a/packages/spamd.inc b/packages/spamd.inc
index e7f6a780..4dc11cbf 100644
--- a/packages/spamd.inc
+++ b/packages/spamd.inc
@@ -34,34 +34,34 @@ function sync_package_spamd() {
config_lock();
$fd = fopen("/usr/local/etc/spamd.conf","w");
/* all header */
- fwrite($fd, "# this file was automatically generated by the pfSense\n");
- fwrite($fd, "# package management system\n\n");
- fwrite($fd, "all:\\\n\t:blacklist:whitelist");
+ fwrite($fd, "all:\\\n\t:whitelist:blacklist");
foreach($config['installedpackages']['spamdsources']['config'] as $spamd) {
- fwrite($fd, ":" . rtrim($spamd['providername']));
+ fwrite($fd, ":" . remove_spaces($spamd['providername']));
}
- fwrite($fd, ":\n\n# begin of whitelist\n");
+ fwrite($fd, ":\n\n");
fwrite($fd, "whitelist:\\\n");
fwrite($fd, "\t:method=file:\\\n");
fwrite($fd, "\t:white:\\\n");
fwrite($fd, "\t:file=/var/db/whitelist.txt:\n");
- fwrite($fd, ":\n\n# begin of blacklist\n");
+ fwrite($fd, "\n");
fwrite($fd, "blacklist:\\\n");
fwrite($fd, "\t:black:\\\n");
fwrite($fd, "\t:msg=\"Sorry, you spammed us before.\":\\\n");
fwrite($fd, "\t:method=file:\\\n");
- fwrite($fd, "\t:file=/var/db/blacklist.txt:\n");
+ fwrite($fd, "\t:file=/var/db/blacklist.txt:\n\n");
/* loop through each item and write out its configuration */
- fwrite($fd, "\n# begin of user created entries\n");
if($config['installedpackages']['spamdsources']['config'] != "") {
foreach($config['installedpackages']['spamdsources']['config'] as $spamd) {
- if(rtrim($spamd['providername'])) {
- fwrite($fd, rtrim($spamd['providername']) . ":\\\n");
- fwrite($fd, "\t:" . rtrim($spamd['providertype']) . ":\\\n");
+ if(remove_spaces($spamd['providername'])) {
+ fwrite($fd, remove_spaces($spamd['providername']) . ":\\\n");
+ fwrite($fd, "\t:" . remove_spaces($spamd['providertype']) . ":\\\n");
fwrite($fd, "\t:msg=\"" . rtrim($spamd['rejectmessage']) . "\":\\\n");
- fwrite($fd, "\t:method=" . rtrim($spamd['providermethod']) . ":\\\n");
- fwrite($fd, "\t:" . rtrim($spamd['providermethod']) . ":\\\n");
- fwrite($fd, "\t:file=" . rtrim($spamd['providerurl']) . ":\n\n");
+ fwrite($fd, "\t:method=" . remove_spaces($spamd['providermethod']) . ":\\\n");
+ fwrite($fd, "\t:" . remove_spaces($spamd['providermethod']) . ":\\\n");
+ $providerurl = $spamd['providerurl'];
+ $providerurl = str_replace("http://", "", $providerurl);
+ $providerurl = str_replace("https://", "", $providerurl);
+ fwrite($fd, "\t:file=" . remove_spaces($providerurl) . ":\n\n");
}
}
}
@@ -130,10 +130,16 @@ function sync_package_spamd() {
);
conf_mount_ro();
config_unlock();
+ mwexec("ln -s /etc/spamd.conf /usr/local/etc/spamd.conf");
mwexec("/usr/local/etc/rc.d/spamd.sh stop");
mwexec("/usr/local/etc/rc.d/spamd.sh start");
}
+function remove_spaces($string) {
+ $string = str_replace(" ", "", $string);
+ return $string;
+}
+
function sync_spamd_config_to_backup() {
global $g, $config;
if(is_array($config['installedpackages']['carpsettings']['config'])) {