aboutsummaryrefslogtreecommitdiffstats
path: root/packages/squidGuard/squidguard.inc
diff options
context:
space:
mode:
authorD. V. Serg <dvserg@pfsense.org>2008-01-15 14:10:39 +0000
committerD. V. Serg <dvserg@pfsense.org>2008-01-15 14:10:39 +0000
commita031b26d14d2be697aceaec4a296fd550c97d92e (patch)
tree9bd3e55d91d0d6db4fbe034b8a96ff73d3bbb08e /packages/squidGuard/squidguard.inc
parenta0a3fbe2cfa209bf2f66dcfa1e8fa300f4a2541f (diff)
downloadpfsense-packages-a031b26d14d2be697aceaec4a296fd550c97d92e.tar.gz
pfsense-packages-a031b26d14d2be697aceaec4a296fd550c97d92e.tar.bz2
pfsense-packages-a031b26d14d2be697aceaec4a296fd550c97d92e.zip
Bugfix 1 - url validate
Diffstat (limited to 'packages/squidGuard/squidguard.inc')
-rw-r--r--packages/squidGuard/squidguard.inc26
1 files changed, 25 insertions, 1 deletions
diff --git a/packages/squidGuard/squidguard.inc b/packages/squidGuard/squidguard.inc
index cb7d4938..f7866965 100644
--- a/packages/squidGuard/squidguard.inc
+++ b/packages/squidGuard/squidguard.inc
@@ -103,6 +103,8 @@ define('WEBGUI_HISTORY_LOG', 'on');
define('TEST_LOG', '/var/tmp/sqtest.test');
+define('ERRVALIDATE_REDIRECT', "Redirect must contains valid data. Example: 'http://www.my.com', 'https://my.com', Error_Code<space>Reason, blank, blank_img");
+
# ==============================================================================
# Initialization
# ==============================================================================
@@ -193,6 +195,28 @@ function squidguard_validate_acl($post, $input_errors) {
if (empty($pass_over_val))
$post[FLD_DEST] = "$pass_up_val";
else $post[FLD_DEST] = "$pass_up_val [$pass_over_val]";
+
+ // check redirect
+ $redirect = trim($post[FLD_REDIRECT]);
+ if(!empty($redirect)) {
+ // cut first redirect url, if entered more that one
+ $redirect = explode("\n", $redirect);
+ $redirect = $redirect[0];
+ $post[FLD_REDIRECT] = $redirect;
+ if (is_url($redirect) === false)
+ $input_errors[] = "Redirect '$redirect' error. " . ERRVALIDATE_REDIRECT;
+ }
+
+ // check overredirect
+ $redirect = trim($post[FLD_OVERREDIRECT]);
+ if(!empty($redirect)) {
+ // cut first redirect url, if entered more that one
+ $redirect = explode("\n", $redirect);
+ $redirect = $redirect[0];
+ $post[FLD_OVERREDIRECT] = $redirect;
+ if (is_url($redirect) === false)
+ $input_errors[] = "Overtime redirect '$redirect' error. " . ERRVALIDATE_REDIRECT;
+ }
}
# ------------------------------------------------------------------------------
@@ -282,7 +306,7 @@ function squidguard_validate_destination($post, $input_errors) {
$redirect = $redirect[0];
$post[FLD_REDIRECT] = $redirect;
if (is_url($redirect) === false)
- $input_errors[] = "Redirect must contains valid url. Example: 'http://www.my.com', 'https://my.com', 'ftp://my.com'";
+ $input_errors[] = "Redirect '$redirect' error. " . ERRVALIDATE_REDIRECT;
}
}