aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2008-04-17 23:47:39 +0000
committerScott Ullrich <sullrich@pfsense.org>2008-04-17 23:47:39 +0000
commit8304547b4b04bcfb245193f500a2a4f5b5f64626 (patch)
tree58430a539e6f41c2ac63c65d949274869cd38fb5
parent7c8d7f3e55bae12d6d999a09c1bb7cc04d578436 (diff)
downloadpfsense-packages-8304547b4b04bcfb245193f500a2a4f5b5f64626.tar.gz
pfsense-packages-8304547b4b04bcfb245193f500a2a4f5b5f64626.tar.bz2
pfsense-packages-8304547b4b04bcfb245193f500a2a4f5b5f64626.zip
* Add code to ensure alias exists before accepting
-rw-r--r--packages/spamd.inc22
-rw-r--r--packages/spamd_settings.xml3
2 files changed, 23 insertions, 2 deletions
diff --git a/packages/spamd.inc b/packages/spamd.inc
index 1b158414..0a17bb72 100644
--- a/packages/spamd.inc
+++ b/packages/spamd.inc
@@ -104,8 +104,6 @@ function sync_package_spamd() {
$delaysecs = " -s " . $ss['delaysecs'];
if($ss['window'] <> "")
$window = " -w " . $ss['window'];
-// if($ss['replysmtperror'] <> "")
-// $replysmtperror = " -r " . $ss['replysmtperror'];
if($ss['passtime'] <> "")
$passtime = $ss['passtime'];
if($ss['greyexp'] <> "")
@@ -246,4 +244,24 @@ function spamd_install_cron($should_install) {
}
}
+function spamd_validate_input($post, $input_errors) {
+ global $config, $g;
+ $nextmta = $post['nextmta'];
+ if(stristr($nextmta, "{")) {
+ /* item is an alias, make sure the name exists */
+ $nextmta = str_replace("{", "", $nextmta);
+ $nextmta = str_replace("}", "", $nextmta);
+ $found = false;
+ if($config['aliases']['alias']) {
+ foreach($config['aliases']['alias'] as $alias) {
+ if($alias['name'] == $nextmta) {
+ $found = true;
+ }
+ }
+ }
+ if($found == false)
+ $intput_errors = "Could not locate alias named " . htmlentities($nextmta);
+ }
+}
+
?> \ No newline at end of file
diff --git a/packages/spamd_settings.xml b/packages/spamd_settings.xml
index e510b146..c799a34f 100644
--- a/packages/spamd_settings.xml
+++ b/packages/spamd_settings.xml
@@ -183,6 +183,9 @@
<value></value>
</field>
</fields>
+ <custom_php_validation_command>
+ spamd_validate_input($_POST, &amp;$input_errors);
+ </custom_php_validation_command>
<custom_php_resync_config_command>
sync_package_spamd();
</custom_php_resync_config_command>