From 8d2bcb1c7668ce8533f87289795646e47b90cb4b Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Fri, 30 Sep 2011 14:58:45 +0200 Subject: add some checks --- config/squid-reverse/squid.inc | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'config/squid-reverse') diff --git a/config/squid-reverse/squid.inc b/config/squid-reverse/squid.inc index 03b60f30..7e6acd3a 100644 --- a/config/squid-reverse/squid.inc +++ b/config/squid-reverse/squid.inc @@ -1011,11 +1011,12 @@ function squid_resync_reverse() { $defs = explode("\r\n", ($contents)); foreach ($defs as $def) { $cfg = explode(";",($def)); - $conf .= "cache_peer {$cfg[1]} parent {$cfg[2]} 0 proxy-only no-query originserver "; - if($cfg[3] == 'HTTPS') - $conf .= "login=PASS ssl sslflags=DONT_VERIFY_PEER front-end-https=auto "; - $conf .= "name={$cfg[0]}\n"; - }} + if (($cfg[0]) != '' && ($cfg[1]) != '' && ($cfg[2]) != ''){ + $conf .= "cache_peer {$cfg[1]} parent {$cfg[2]} 0 proxy-only no-query originserver "; + if($cfg[3] == 'HTTPS') + $conf .= "login=PASS ssl sslflags=DONT_VERIFY_PEER front-end-https=auto "; + $conf .= "name={$cfg[0]}\n"; + }}} //ACLs if (($settings['reverse_owa'] == 'on') && (!empty($settings['reverse_owa_ip']))) { @@ -1032,19 +1033,18 @@ function squid_resync_reverse() { $conf .= "extension_methods RPC_IN_DATA RPC_OUT_DATA\n"; } - $contents = base64_decode($settings['revrse_uri']); if(!empty($contents)) { $conf .= "# -= TESTING AREA =-\n"; $defs = explode("\r\n", ($contents)); foreach ($defs as $def) { - if (($cfg[0]) != '' && ($cfg[1]) != '') - $cfg = explode(";",($def)); + $cfg = explode(";",($def)); + if (($cfg[0]) != '' && ($cfg[1]) != ''){ $conf .= "# acl {$cfg[0]} url_regex -i {$settings['reverse_external_fqdn']} {$cfg[1]}.*$\n"; // if($cfg[3] == 'HTTPS') // $conf .= "login=PASS ssl sslflags=DONT_VERIFY_PEER front-end-https=auto "; // $conf .= "name={$cfg[0]}\n"; - }} + }}} //ACCESS @@ -1062,11 +1062,12 @@ $conf .= "# -= TESTING AREA =-\n"; $defs = explode("\r\n", ($contents)); foreach ($defs as $def) { $cfg = explode(";",($def)); - $conf .= "# cache_peer_access {$cfg[0]} allow {$cfg[1]}\n"; - $conf .= "# cache_peer_access {$cfg[0]} deny all\n"; - $conf .= "# never direct allow {$cfg[1]}\n"; - $conf .= "# http_access allow {$cfg[1]}\n"; - }} + if (($cfg[0]) != '' && ($cfg[1]) != ''){ + $conf .= "# cache_peer_access {$cfg[0]} allow {$cfg[1]}\n"; + $conf .= "# cache_peer_access {$cfg[0]} deny all\n"; + $conf .= "# never direct allow {$cfg[1]}\n"; + $conf .= "# http_access allow {$cfg[1]}\n"; + }}} $conf .= "\n"; -- cgit v1.2.3