From 93627c7dfc5af6dfd9a0175800aa0fdd6986fbe3 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Tue, 12 Aug 2008 13:08:22 +0000 Subject: input validation for: checkin 24421 --- packages/squid/squid.inc | 20 +++++++++++++++++++- packages/squid/squid.xml | 4 ++-- 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'packages') diff --git a/packages/squid/squid.inc b/packages/squid/squid.inc index 05eb144e..674f38cd 100644 --- a/packages/squid/squid.inc +++ b/packages/squid/squid.inc @@ -312,6 +312,15 @@ function squid_validate_general($post, $input_errors) { $input_errors[] = "You can not enable forwarding traffic to private subnets to the proxy server without using the transparent proxy."; } + if(!empty($post['dns_nameservers'])) { + $altdns = explode(";", ($post['dns_nameservers'])); +// $conf .= "# Custom options\n"; + foreach ($altdns as $dnssrv) { +// $conf .= $custopt."\n"; + if (!is_ipaddr($dnssrv)) + $input_errors[] = 'You must enter a valid IP address in the \'Alternate DNS servers\' field'; + }} + } function squid_validate_upstream($post, $input_errors) { @@ -533,7 +542,16 @@ EOD; if ($settings['disable_xforward']) $conf .= "forwarded_for off\n"; if ($settings['disable_via']) $conf .= "via off\n"; $conf .= "uri_whitespace {$settings['uri_whitespace']}\n"; - if (!empty($settings['dns_nameservers'])) $conf .= "dns_nameservers {$settings['dns_nameservers']}\n"; + + if(!empty($settings['dns_nameservers'])) { + $altdns = explode(";", ($settings['dns_nameservers'])); + $conf .= "dns_nameservers "; + foreach ($altdns as $dnssrv) { + $conf .= $dnssrv." "; + } +// $conf .= "\n"; + } + return $conf; } diff --git a/packages/squid/squid.xml b/packages/squid/squid.xml index 9f138ed9..6bba018f 100644 --- a/packages/squid/squid.xml +++ b/packages/squid/squid.xml @@ -271,9 +271,9 @@ - Use different DNS-servers for the proxy-server + Use alternate DNS-servers for the proxy-server dns_nameservers - If you want to use other DNS-servers than the DNS-forwarder, enter the IPs here separated by spaces. + If you want to use other DNS-servers than the DNS-forwarder, enter the IPs here, separated by semi-colons (;). input 60 -- cgit v1.2.3