aboutsummaryrefslogtreecommitdiffstats
path: root/config/spamd
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2015-09-04 15:45:58 +0200
committerdoktornotor <notordoktor@gmail.com>2015-09-04 15:45:58 +0200
commit5bac2b3205e6549d85093ee102ce684571ef091f (patch)
tree9b296595738b2ae7ac7fc80357532fda002cd71d /config/spamd
parent4db5174b2842821226e4dc91a3c5e9b3c78d0084 (diff)
downloadpfsense-packages-5bac2b3205e6549d85093ee102ce684571ef091f.tar.gz
pfsense-packages-5bac2b3205e6549d85093ee102ce684571ef091f.tar.bz2
pfsense-packages-5bac2b3205e6549d85093ee102ce684571ef091f.zip
spamd - code style cleanup and multiple fixes
- Fix input validation for NextMTA and require IPv4, no aliases allowed since it was producing broken firewall rules and is generally pointless for a single IP.
Diffstat (limited to 'config/spamd')
-rw-r--r--config/spamd/spamd.inc23
1 files changed, 6 insertions, 17 deletions
diff --git a/config/spamd/spamd.inc b/config/spamd/spamd.inc
index 98cdc561..f481da54 100644
--- a/config/spamd/spamd.inc
+++ b/config/spamd/spamd.inc
@@ -103,8 +103,8 @@ function sync_package_spamd() {
log_error("[spamd] Looping through spamdsettings");
if ($config['installedpackages']['spamdsettings']['config']) {
foreach ($config['installedpackages']['spamdsettings']['config'] as $ss) {
- if ($ss['nextmta'] != "") {
- $nextmta = $ss['nextmta'];
+ if ($ss['next_mta'] != "") {
+ $nextmta = $ss['next_mta'];
}
if ($ss['greylistingparms'] != "") {
$passtime = " -G " . $ss['greylistingparms'];
@@ -213,7 +213,7 @@ function spamd_generate_rules($type) {
}
if ($spamdconfig) {
- $nextmta = $spamdconfig['nextmta'];
+ $nextmta = $spamdconfig['next_mta'];
$spamdbinds = explode(',', $spamdconfig['spamdbinds_array']);
if (is_array($spamdbinds)) {
foreach ($spamdbinds as $interface) {
@@ -312,21 +312,10 @@ function custom_php_deinstall_command() {
}
function spamd_validate_input($post, &$input_errors) {
- global $config;
- $nextmta = str_replace("$", "", $post['nextmta']);
- if (stristr($nextmta, "{")) {
- /* item is an alias, make sure the name exists */
- $nextmta = str_replace("$", "", $nextmta);
- $found = false;
- if ($config['aliases']['alias']) {
- foreach ($config['aliases']['alias'] as $alias) {
- if ($alias['name'] == $nextmta) {
- $found = true;
- }
- }
+ if (!empty($post["next_mta"])) {
+ if (!is_ipaddrv4($post['next_mta'])) {
+ $input_errors[] = "NextMTA is not a valid IPv4 address";
}
- if ($found == false)
- $input_errors[] = "Could not locate alias named " . htmlentities($nextmta);
}
}