From 8304547b4b04bcfb245193f500a2a4f5b5f64626 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Thu, 17 Apr 2008 23:47:39 +0000 Subject: * Add code to ensure alias exists before accepting --- packages/spamd.inc | 22 ++++++++++++++++++++-- packages/spamd_settings.xml | 3 +++ 2 files changed, 23 insertions(+), 2 deletions(-) (limited to 'packages') 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 @@ + + spamd_validate_input($_POST, &$input_errors); + sync_package_spamd(); -- cgit v1.2.3