diff options
author | marcelloc <marcellocoutinho@gmail.com> | 2011-08-24 04:53:57 -0300 |
---|---|---|
committer | marcelloc <marcellocoutinho@gmail.com> | 2011-08-24 04:53:57 -0300 |
commit | be44ab21a31c79f7a61f9e497ccaa3ff53c9d8dd (patch) | |
tree | fb7d668e601e16119f976a47f0d934f1804310ad | |
parent | 6c21524dd28774dda03ecdee1fb25858bfb3d449 (diff) | |
download | pfsense-packages-be44ab21a31c79f7a61f9e497ccaa3ff53c9d8dd.tar.gz pfsense-packages-be44ab21a31c79f7a61f9e497ccaa3ff53c9d8dd.tar.bz2 pfsense-packages-be44ab21a31c79f7a61f9e497ccaa3ff53c9d8dd.zip |
fix managment post validation
-rw-r--r-- | config/varnish64/varnish.inc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/config/varnish64/varnish.inc b/config/varnish64/varnish.inc index 4729ab7f..50d804fb 100644 --- a/config/varnish64/varnish.inc +++ b/config/varnish64/varnish.inc @@ -43,8 +43,11 @@ function varnish_settings_post_validate($post, $input_errors) { $input_errors[] = "A valid number is required for the field 'Maximum worker threads'"; if($post['timeoutworkers'] && !is_numeric($post['timeoutworkers'])) $input_errors[] = "A valid number is required for the field 'Worker thread timeout'"; - if($post['managment'] && !preg_match("/^\w+:\d+$/",$post['managment'])) - $input_errors[] = "A valid host/ip:port is required for the field 'managment'"; + if($post['managment']){ + $mgm= explode(":",$post['managment']); + if(!is_ipaddr($mgm[0]) || !is_numeric($mgm[1])) + $input_errors[] = "A valid ip:port is required for the field 'managment'"; + } if($post['grace'] && ! preg_match("/^\d+(h|m|s)$/",$post['grace'])) $input_errors[] = "A valid number with a time reference is required for the field 'Fetch grace'"; if($post['saint'] && ! preg_match("/^\d+(h|m|s)$/",$post['saint'])) |