aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2010-11-26 11:30:55 -0500
committerjim-p <jimp@pfsense.org>2010-11-26 11:30:55 -0500
commite4cad7c450d1300a3f35eacdbef72f62cea5447a (patch)
tree53ee9faeeae01b293ec00cb2c2414ad7b890bebb /config
parent7af1159c01ef441f1a451df51ba23efdab64a623 (diff)
downloadpfsense-packages-e4cad7c450d1300a3f35eacdbef72f62cea5447a.tar.gz
pfsense-packages-e4cad7c450d1300a3f35eacdbef72f62cea5447a.tar.bz2
pfsense-packages-e4cad7c450d1300a3f35eacdbef72f62cea5447a.zip
Add input validation to siproxd
Diffstat (limited to 'config')
-rw-r--r--config/siproxd.inc19
-rw-r--r--config/siproxd.xml3
2 files changed, 22 insertions, 0 deletions
diff --git a/config/siproxd.inc b/config/siproxd.inc
index 93bdf203..e8bfb4f7 100644
--- a/config/siproxd.inc
+++ b/config/siproxd.inc
@@ -205,4 +205,23 @@ function sync_package_siproxd() {
}
+function validate_form_siproxd($post, $input_errors) {
+ if ($post['port'] && !is_port($post['port']))
+ $input_errors[] = 'Invalid port entered for "Listening Port"';
+ if ($post['rtplower'] && !is_port($post['rtplower']))
+ $input_errors[] = 'Invalid port entered for "RTP port range (lower)".';
+ if ($post['rtpupper'] && !is_port($post['rtpupper']))
+ $input_errors[] = 'Invalid port entered for "RTP port range (upper)".';
+ if ($post['rtplower'] && $post['rtpupper'] && ($post['rtplower'] >= $post['rtpupper']))
+ $input_errors[] = 'RTP lower port cannot be equal to or higher than the RTP upper port.';
+ if ($post['rtptimeout'] && (!is_numeric($post['rtptimeout']) || ($post['rtptimeout'] < 0)))
+ $input_errors[] = '"RTP stream timeout" must be numeric and greater than 0.';
+ if ($post['defaulttimeout'] && (!is_numeric($post['defaulttimeout']) || ($post['defaulttimeout'] < 0)))
+ $input_errors[] = '"Default expiration timeout" must be numeric and greater than 0.';
+ if ($post['outboundproxyhost'] && (!is_hostname($post['outboundproxyhost']) && !is_ipaddr($post['outboundproxyhost'])))
+ $input_errors[] = 'Invalid hostname or IP address entered for "Outbound Proxy Host".';
+ if ($post['outboundproxyport'] && !is_port($post['outboundproxyport']))
+ $input_errors[] = 'Invalid port entered for "Outbound Proxy Port".';
+}
+
?>
diff --git a/config/siproxd.xml b/config/siproxd.xml
index 7feb4d0f..cabb5341 100644
--- a/config/siproxd.xml
+++ b/config/siproxd.xml
@@ -172,4 +172,7 @@
sync_package_siproxd();
</custom_php_resync_config_command>
<filter_rules_needed>siproxd_generate_rules</filter_rules_needed>
+ <custom_php_validation_command>
+ validate_form_siproxd($_POST, &amp;$input_errors);
+ </custom_php_validation_command>
</packagegui>