aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2010-04-27 21:54:42 -0400
committerScott Ullrich <sullrich@pfsense.org>2010-04-27 21:54:42 -0400
commitb3879db49f2473f56894aeb22eb5391a29489d34 (patch)
treef95557b246409153be79f6b1bedf3ffe4f9f14a4 /config
parentd998c5cf12d1bfa4da7b3e0c21555b230d989bca (diff)
downloadpfsense-packages-b3879db49f2473f56894aeb22eb5391a29489d34.tar.gz
pfsense-packages-b3879db49f2473f56894aeb22eb5391a29489d34.tar.bz2
pfsense-packages-b3879db49f2473f56894aeb22eb5391a29489d34.zip
Add input validation for the LB directors form
Diffstat (limited to 'config')
-rw-r--r--config/varnish64/varnish.inc9
-rw-r--r--config/varnish64/varnish_lb_directors.xml3
2 files changed, 11 insertions, 1 deletions
diff --git a/config/varnish64/varnish.inc b/config/varnish64/varnish.inc
index 735152f7..295533b9 100644
--- a/config/varnish64/varnish.inc
+++ b/config/varnish64/varnish.inc
@@ -31,8 +31,15 @@
*/
/* ========================================================================== */
+function varnish_lb_directors_post_validate($post, $input_errors) {
+ if (preg_match("/[^a-zA-Z0-9]/", $post['directorname']))
+ $input_errors[] = "The directorname name must only contain the characters a-Z or 0-9";
+ if(stristr($post['directorurl'], 'http'))
+ $input_errors[] = "You do not need to include the http:// string in the director URL";
+}
+
function varnish_backends_post_validate($post, $input_errors) {
- if (preg_match("/[^a-zA-Z0-9\.\-_]/", $post['backendname']))
+ if (preg_match("/[^a-zA-Z0-9]/", $post['backendname']))
$input_errors[] = "The backend name must only contain the characters a-Z or 0-9";
if(!is_ipaddr($post['ipaddress']))
$input_errors[] = "A valid IP address is required for the field 'IPAddress'";
diff --git a/config/varnish64/varnish_lb_directors.xml b/config/varnish64/varnish_lb_directors.xml
index ae596227..38431414 100644
--- a/config/varnish64/varnish_lb_directors.xml
+++ b/config/varnish64/varnish_lb_directors.xml
@@ -161,4 +161,7 @@
sync_package_varnish();
varnish_start();
</custom_php_resync_config_command>
+ <custom_php_validation_command>
+ varnish_lb_directors_post_validate($_POST, &amp;$input_errors);
+ </custom_php_validation_command>
</packagegui> \ No newline at end of file