diff options
author | jim-p <jimp@pfsense.org> | 2014-05-09 14:46:24 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2014-05-09 14:46:24 -0400 |
commit | 173c5007b5f863fb642bc86bf906c9eb80ac32e7 (patch) | |
tree | 0e2c2f559168c68407ee8b9a23989bb3451e35cb /config | |
parent | b0edfbc11834ad9f197eb40730660aee84b8f229 (diff) | |
download | pfsense-packages-173c5007b5f863fb642bc86bf906c9eb80ac32e7.tar.gz pfsense-packages-173c5007b5f863fb642bc86bf906c9eb80ac32e7.tar.bz2 pfsense-packages-173c5007b5f863fb642bc86bf906c9eb80ac32e7.zip |
Fix call-time pass-by-reference in Squidguard, bump
Diffstat (limited to 'config')
-rw-r--r-- | config/squidGuard/squidguard.inc | 50 | ||||
-rw-r--r-- | config/squidGuard/squidguard.xml | 6 | ||||
-rw-r--r-- | config/squidGuard/squidguard_acl.xml | 4 | ||||
-rw-r--r-- | config/squidGuard/squidguard_configurator.inc | 50 | ||||
-rw-r--r-- | config/squidGuard/squidguard_default.xml | 4 | ||||
-rw-r--r-- | config/squidGuard/squidguard_dest.xml | 4 | ||||
-rw-r--r-- | config/squidGuard/squidguard_log.php | 8 | ||||
-rw-r--r-- | config/squidGuard/squidguard_rewr.xml | 2 | ||||
-rw-r--r-- | config/squidGuard/squidguard_time.xml | 2 |
9 files changed, 65 insertions, 65 deletions
diff --git a/config/squidGuard/squidguard.inc b/config/squidGuard/squidguard.inc index d58dfb79..0fd450b7 100644 --- a/config/squidGuard/squidguard.inc +++ b/config/squidGuard/squidguard.inc @@ -101,26 +101,26 @@ sg_init(convert_pfxml_to_sgxml()); # ============================================================================== # Validations # ============================================================================== -function squidguard_validate($post, $input_errors) +function squidguard_validate(&$post, &$input_errors) { $submit = isset($_GET['submit']) ? $_GET['submit'] : $_POST['submit']; # check config if 'Apply' - if ($submit === APPLY_BTN) sg_check_config_data(&$input_errors); + if ($submit === APPLY_BTN) sg_check_config_data($input_errors); } # ------------------------------------------------------------------------------ # validate default # ------------------------------------------------------------------------------ -function squidguard_validate_default($post, $input_errors) +function squidguard_validate_default(&$post, &$input_errors) { - squidguard_validate_acl($post, &$input_errors); + squidguard_validate_acl($post, $input_errors); } # ------------------------------------------------------------------------------ # validate acl # ------------------------------------------------------------------------------ -function squidguard_validate_acl($post, $input_errors) +function squidguard_validate_acl(&$post, &$input_errors) { $pass_up = array(); $deny_up = array(); @@ -134,7 +134,7 @@ function squidguard_validate_acl($post, $input_errors) $name = trim($post[F_NAME]); if(!empty($name)) { # validate name format - check_name_format($name, &$input_errors); + check_name_format($name, $input_errors); # check unique name if (!sg_check_unique_name(F_ACLS, $name)) @@ -148,7 +148,7 @@ function squidguard_validate_acl($post, $input_errors) $sgx = array(); $sgx[F_NAME] = $post[F_NAME]; $sgx[F_SOURCE] = $post[F_SOURCE]; - sg_check_src($sgx, &$input_errors); + sg_check_src($sgx, $input_errors); } # store destinations to 'dest' value @@ -192,7 +192,7 @@ function squidguard_validate_acl($post, $input_errors) # check redirect $errmsg = ''; - if (!sg_check_redirect($post[F_RMOD], $post[F_REDIRECT], &$errmsg)) { + if (!sg_check_redirect($post[F_RMOD], $post[F_REDIRECT], $errmsg)) { $input_errors[] = "Redirect info error. $errmsg"; } } @@ -203,14 +203,14 @@ function squidguard_validate_acl($post, $input_errors) # date: <date(or range)><time (or range)> -- days not parsed (reset to *) # weekly: <day or *><time or range> -- dates not parsed (reset to '') # ------------------------------------------------------------------------------ -function squidguard_validate_times($post, $input_errors) +function squidguard_validate_times(&$post, &$input_errors) { $id = get_item_id(); # check name $name = trim($post[F_NAME]); if(!empty($name)) { - check_name_format($name, &$input_errors); + check_name_format($name, $input_errors); # check unique name if (!sg_check_unique_name(F_TIMES, $name)) @@ -246,18 +246,18 @@ function squidguard_validate_times($post, $input_errors) $sgx[F_ITEM][] = $sgx_row; } # - sg_check_time($sgx, &$input_errors); + sg_check_time($sgx, $input_errors); } # ------------------------------------------------------------------------------ # validate destinations # ------------------------------------------------------------------------------ -function squidguard_validate_destination($post, $input_errors) { +function squidguard_validate_destination($post, &$input_errors) { # check name $name = trim($post[F_NAME]); if(!empty($name)) { - check_name_format($name, &$input_errors); + check_name_format($name, $input_errors); # check unique name if (!sg_check_unique_name(F_DESTINATIONS, $name)) @@ -277,18 +277,18 @@ function squidguard_validate_destination($post, $input_errors) { $sgx[F_RMOD] = $post[F_RMOD]; $sgx[F_REDIRECT] = $post[F_REDIRECT]; # - sg_check_dest($sgx, &$input_errors); + sg_check_dest($sgx, $input_errors); } # ------------------------------------------------------------------------------ # validate rewrites # ------------------------------------------------------------------------------ -function squidguard_validate_rewrite($post, $input_errors) { +function squidguard_validate_rewrite($post, &$input_errors) { # check name $name = trim($post[F_NAME]); if(!empty($name)) { # check name format <char><symbols without space> - Ab123 - check_name_format($name, &$input_errors); + check_name_format($name, $input_errors); # check unique name if (!sg_check_unique_name(F_REWRITES, $name)) @@ -447,7 +447,7 @@ function get_sgconf_items_list($data_group, $fieldname) { # ============================================================================== # squidguard_before_form # ------------------------------------------------------------------------------ -function squidguard_before_form($pkg) { +function squidguard_before_form(&$pkg) { $i=0; foreach($pkg['fields']['field'] as $field) { @@ -470,7 +470,7 @@ function squidguard_before_form($pkg) { # ----------------------------------------------------------------------------- # squidguard_before_form_acl # ----------------------------------------------------------------------------- -function squidguard_before_form_acl($pkg, $is_acl=true) { +function squidguard_before_form_acl(&$pkg, $is_acl=true) { global $g; global $squidguard_config; @@ -638,7 +638,7 @@ function squidguard_before_form_acl($pkg, $is_acl=true) { # ----------------------------------------------------------------------------- # squidguard_before_form_dest # ----------------------------------------------------------------------------- -function squidguard_before_form_dest($pkg) { +function squidguard_before_form_dest(&$pkg) { global $g, $squidguard_config; $destination_items = get_sgconf_items_list(F_DESTINATIONS, 'name'); //var_dump($squidguard_config); @@ -1301,12 +1301,12 @@ function squidguard_adt_rewrite_safesrch() $res[F_NAME] = SAFESEARCH; $res[F_DESCRIPTION] = "Google, Yandex safesearch"; $res[F_LOG] = 'on'; - squidguard_adt_safesrch_add(&$res[F_ITEM]); + squidguard_adt_safesrch_add($res[F_ITEM]); return $res; } -function squidguard_adt_safesrch_add($rewrite_item) +function squidguard_adt_safesrch_add(&$rewrite_item) { if (!is_array($rewrite_item)) $rewrite_item = array(); @@ -1331,7 +1331,7 @@ function squidguard_adt_safesrch_add($rewrite_item) } # log dump -function squidguard_logdump($filename, $lnoffset, $lncount, $reverse) +function squidguard_logdump($filename, &$lnoffset, $lncount, $reverse) { define('LOGSHOW_BUFSIZE', '262144'); $cnt = ''; @@ -1374,7 +1374,7 @@ function squidguard_logdump($filename, $lnoffset, $lncount, $reverse) function squidguard_filterdump($lnoffset, $lncount, $reverse) { $res = array(); - $cont = squidguard_logdump(SQUIDGUARD_LOGDIR . '/squidGuard.log', &$lnoffset, $lncount, $reverse); + $cont = squidguard_logdump(SQUIDGUARD_LOGDIR . '/squidGuard.log', $lnoffset, $lncount, $reverse); foreach($cont as $cn) { $cn = explode(" ", trim($cn), 4); @@ -1388,7 +1388,7 @@ function squidguard_filterdump($lnoffset, $lncount, $reverse) function squidguard_guidump($lnoffset, $lncount, $reverse) { $res = array(); - $cont = squidguard_logdump(SQUIDGUARD_LOGDIR . SQUIDGUARD_CONFLOGFILE, &$lnoffset, $lncount, $reverse); + $cont = squidguard_logdump(SQUIDGUARD_LOGDIR . SQUIDGUARD_CONFLOGFILE, $lnoffset, $lncount, $reverse); foreach($cont as $cn) { $cn = explode(" ", trim($cn), 4); @@ -1402,7 +1402,7 @@ function squidguard_guidump($lnoffset, $lncount, $reverse) function squidguard_blockdump($lnoffset, $lncount, $reverse) { $res = array(); - $cont = squidguard_logdump(SQUIDGUARD_LOGDIR . '/' . SQUIDGUARD_LOGFILE, &$lnoffset, $lncount, $reverse); + $cont = squidguard_logdump(SQUIDGUARD_LOGDIR . '/' . SQUIDGUARD_LOGFILE, $lnoffset, $lncount, $reverse); foreach($cont as $cn) { $cn = explode(" ", trim($cn), 9); diff --git a/config/squidGuard/squidguard.xml b/config/squidGuard/squidguard.xml index ee7302f4..62882539 100644 --- a/config/squidGuard/squidguard.xml +++ b/config/squidGuard/squidguard.xml @@ -6,7 +6,7 @@ <requirements>Describe your package requirements here</requirements> <faq>Currently there are no FAQ items provided.</faq> <name>squidguardgeneral</name> - <version>1.4_4 pkg v.1.9.3</version> + <version>1.4_4 pkg v.1.9.6</version> <title>Proxy filter SquidGuard: General settings</title> <include_file>/usr/local/pkg/squidguard.inc</include_file> <!-- Installation --> @@ -239,10 +239,10 @@ </fields> <custom_add_php_command/> <custom_php_validation_command> - squidguard_validate(&$_POST, &$input_errors); + squidguard_validate($_POST, $input_errors); </custom_php_validation_command> <custom_php_command_before_form> - squidguard_before_form(&$pkg); + squidguard_before_form($pkg); </custom_php_command_before_form> <custom_php_after_form_command> squidGuard_print_javascript(); diff --git a/config/squidGuard/squidguard_acl.xml b/config/squidGuard/squidguard_acl.xml index 243576e8..8ddd6c35 100644 --- a/config/squidGuard/squidguard_acl.xml +++ b/config/squidGuard/squidguard_acl.xml @@ -224,10 +224,10 @@ </field> </fields> <custom_php_validation_command> - squidguard_validate_acl(&$_POST, &$input_errors); + squidguard_validate_acl($_POST, $input_errors); </custom_php_validation_command> <custom_php_command_before_form> - squidguard_before_form_acl(&$pkg); + squidguard_before_form_acl($pkg); </custom_php_command_before_form> <custom_php_after_form_command> squidGuard_print_javascript(); diff --git a/config/squidGuard/squidguard_configurator.inc b/config/squidGuard/squidguard_configurator.inc index 5dbfcc43..006cf083 100644 --- a/config/squidGuard/squidguard_configurator.inc +++ b/config/squidGuard/squidguard_configurator.inc @@ -846,7 +846,7 @@ function sg_create_config() } # check configuration data - if (!sg_check_config_data(&$error_res)) { + if (!sg_check_config_data($error_res)) { sg_addlog("sg_create_config", "Bad config data. It's all error_res: $error_res", SQUIDGUARD_ERROR); sg_addlog("sg_create_config", "Terminated.", SQUIDGUARD_ERROR); return sg_create_simple_config('', '', "Error! Check squidGuard configuration data." . " (sg_create_config: [2])."); @@ -1071,8 +1071,8 @@ function sg_create_config() # delete blacklist entries from 'pass' if blacklist disabled if ($squidguard_config[F_BLACKLISTENABLED] !== 'on') { - acl_remove_blacklist_items(&$acl[F_DESTINATIONNAME]); - acl_remove_blacklist_items(&$acl[F_OVERDESTINATIONNAME]); + acl_remove_blacklist_items($acl[F_DESTINATIONNAME]); + acl_remove_blacklist_items($acl[F_OVERDESTINATIONNAME]); } # not allowing IP in URL @@ -1128,7 +1128,7 @@ function sg_create_config() # delete blacklist entries from 'pass' if blacklist disabled if ($squidguard_config[F_BLACKLISTENABLED] !== 'on') - acl_remove_blacklist_items(&$def[F_DESTINATIONNAME]); + acl_remove_blacklist_items($def[F_DESTINATIONNAME]); # not allowing IP in URL if ($def[F_NOTALLOWINGIP]) @@ -1254,7 +1254,7 @@ function sg_redirector_base_url($rdr_info, $redirect_mode) # check redirect $errmsg = ''; - if (!sg_check_redirect($redirect_mode, $rdr_info, &$errmsg)) { + if (!sg_check_redirect($redirect_mode, $rdr_info, $errmsg)) { $redirect_mode = RMOD_INT_ERRORPAGE; $rdr_info = "Bad redirect settings. $errmsg Check you configuration."; sg_addlog("sg_redirector_base_url", "$errmsg", SQUIDGUARD_ERROR); @@ -1310,7 +1310,7 @@ function sg_aclpass_reorder($pass) # ------------------------------------------------------------ # sg_check_config_data # ------------------------------------------------------------ -function sg_check_config_data ($input_errors) +function sg_check_config_data (&$input_errors) { global $squidguard_config; $elog = array(); @@ -1327,14 +1327,14 @@ function sg_check_config_data ($input_errors) # check name as unique and name format $tm_name = $tm[F_NAME]; $err_s = ''; - if (!check_name_format($tm_name, &$err_s)) + if (!check_name_format($tm_name, $err_s)) $elog[] = "(T1) TIME '$tm_name' error: >>> $err_s"; if ($key_tm[$tm_name] > 1) $elog[] = "(T2) TIME '$tm_name' error: duplicate time name '$tm_name'"; # check time items format - sg_check_time($tm, &$elog); + sg_check_time($tm, $elog); } } @@ -1345,7 +1345,7 @@ function sg_check_config_data ($input_errors) # check name as unique and name format $src_name = $src[F_NAME]; $err_s = ''; - if (!check_name_format($src_name, &$err_s)) + if (!check_name_format($src_name, $err_s)) $elog[] = "(A1) ACL '$src_name'error: $err_s"; if ($key_src[$src_name] > 1) @@ -1362,13 +1362,13 @@ function sg_check_config_data ($input_errors) # check name as unique and name format $dst_name = $dst[F_NAME]; $err_s = ''; - if (!check_name_format($dst_name, &$err_s)) + if (!check_name_format($dst_name, $err_s)) $elog[] = "(D1) DEST '$dst_name' error: $err_s"; if ($key_dst[$dst_name] > 1) $elog[] = "(D2) DEST '$dst_name' error: duplicate destination name '$dst_name'"; # - sg_check_dest($dst, &$elog); + sg_check_dest($dst, $elog); } } @@ -1396,7 +1396,7 @@ function sg_check_config_data ($input_errors) # check check name as unique and name format $rw_name = $rw[F_NAME]; $err_s = ''; - if (!check_name_format($rw_name, &$err_s)) + if (!check_name_format($rw_name, $err_s)) $elog[] = "(R1) REWRITE '$rw_name' error: $err_s"; if ($key_rw[$rw_name] > 1) @@ -1674,7 +1674,7 @@ function is_username($username) # ------------------------------------------------------------------------------ # check name # ------------------------------------------------------------------------------ -function check_name_format ($name, $input_errors) +function check_name_format ($name, &$input_errors) { $elog = array(); $val = trim($name); @@ -1698,7 +1698,7 @@ function check_name_format ($name, $input_errors) # ****************************************************************************** # check redirect # ------------------------------------------------------------------------------ -function sg_check_redirect($rdr_mode, $rdr_info, $err_msg) +function sg_check_redirect($rdr_mode, $rdr_info, &$err_msg) { $res = true; switch($rdr_mode) { @@ -1720,7 +1720,7 @@ function sg_check_redirect($rdr_mode, $rdr_info, $err_msg) # ------------------------------------------------------------------------------ # sg_check_time # ------------------------------------------------------------------------------ -function sg_check_time($sgtime, $input_errors) +function sg_check_time($sgtime, &$input_errors) { $err = ''; $days = array("*", "mon", "tue", "wed", "thu", "fri", "sat", "sun"); @@ -1746,14 +1746,14 @@ function sg_check_time($sgtime, $input_errors) # ------------------------------------------------------------------------------ # sg_check_dest # ------------------------------------------------------------------------------ -function sg_check_dest($sgx, $input_errors) +function sg_check_dest($sgx, &$input_errors) { $elog = array(); $dm = explode(" ", $sgx[F_DOMAINS]); # $ex = explode(" ", $sgx[F_EXPRESSIONS]); $ur = explode(" ", $sgx[F_URLS]); - array_packitems(&$dm); - array_packitems(&$ur); + array_packitems($dm); + array_packitems($ur); # domain or ip foreach ($dm as $d_it) { @@ -1765,7 +1765,7 @@ function sg_check_dest($sgx, $input_errors) if ($u_it && !is_dest_url($u_it)) $elog[] = "Item '$u_it' is not a url."; # check redirect - sg_check_redirect($sgx[F_RMOD], $sgx[F_REDIRECT], &$elog); + sg_check_redirect($sgx[F_RMOD], $sgx[F_REDIRECT], $elog); # update log if (!empty($elog)) { @@ -1780,7 +1780,7 @@ function sg_check_dest($sgx, $input_errors) # ------------------------------------------------------------------------------ # sg_check_src # ------------------------------------------------------------------------------ -function sg_check_src($sgx, $input_errors) +function sg_check_src($sgx, &$input_errors) { $elog = array(); @@ -1822,7 +1822,7 @@ function str_packspaces($str) while(strpos($str, ' ')) $str = str_replace(' ', ' ', $str); } -function array_packitems($arval) +function array_packitems(&$arval) { if (is_array($arval)) { $arval = array_map("trim", $arval); # trim all items @@ -1894,7 +1894,7 @@ function check_time($time) # ----------------------------------------------------------------------------- # acl_remove_blacklist_items # ----------------------------------------------------------------------------- -function acl_remove_blacklist_items($items) +function acl_remove_blacklist_items(&$items) { # add !items and ^items $db_entries = sg_entries_blacklist(); @@ -2207,7 +2207,7 @@ function sg_update_blacklist($from_file) $blk_list = array(); # scan blacklist items - scan_blacklist_cat($tmp_unpack_dir, "blk", & $blk_items); + scan_blacklist_cat($tmp_unpack_dir, "blk", $blk_items); # move blacklist catalog structure to 'one level' (from tmp_DB to arch_DB) foreach ($blk_items as $key => $val) { @@ -2416,7 +2416,7 @@ function squidguard_blacklist_restore_arcdb() # ["urls"] urls file path # ["expressions"] expressions file path # ------------------------------------------------------------------------------ -function scan_blacklist_cat($curdir, $key_name, $cat_array) +function scan_blacklist_cat($curdir, $key_name, &$cat_array) { if (file_exists($curdir) and is_dir($curdir)) { @@ -2449,7 +2449,7 @@ function scan_blacklist_cat($curdir, $key_name, $cat_array) $fls_key = $key_name . "_" . $fls; # recursive call - scan_blacklist_cat($fls_file, $fls_key, & $cat_array); + scan_blacklist_cat($fls_file, $fls_key, $cat_array); } } } diff --git a/config/squidGuard/squidguard_default.xml b/config/squidGuard/squidguard_default.xml index 01380ea5..4a03c2b6 100644 --- a/config/squidGuard/squidguard_default.xml +++ b/config/squidGuard/squidguard_default.xml @@ -134,10 +134,10 @@ </field> </fields> <custom_php_validation_command> - squidguard_validate_acl(&$_POST, &$input_errors); + squidguard_validate_acl($_POST, $input_errors); </custom_php_validation_command> <custom_php_command_before_form> - squidguard_before_form_acl(&$pkg, false); + squidguard_before_form_acl($pkg, false); </custom_php_command_before_form> <custom_php_after_form_command> squidGuard_print_javascript(); diff --git a/config/squidGuard/squidguard_dest.xml b/config/squidGuard/squidguard_dest.xml index 3525098e..5f128a49 100644 --- a/config/squidGuard/squidguard_dest.xml +++ b/config/squidGuard/squidguard_dest.xml @@ -172,10 +172,10 @@ </field> </fields> <custom_php_command_before_form> - squidguard_before_form_dest(&$pkg); + squidguard_before_form_dest($pkg); </custom_php_command_before_form> <custom_php_validation_command> - squidguard_validate_destination($_POST, &$input_errors); + squidguard_validate_destination($_POST, $input_errors); </custom_php_validation_command> <custom_php_resync_config_command> squidguard_resync_dest(); diff --git a/config/squidGuard/squidguard_log.php b/config/squidGuard/squidguard_log.php index 8eba2311..fae61a8c 100644 --- a/config/squidGuard/squidguard_log.php +++ b/config/squidGuard/squidguard_log.php @@ -77,14 +77,14 @@ function squidguard_log_AJAX_response( $request ) $res = squidguard_prep_textareacont($cont); break; case 'guilog': - $res = squidguard_logrep(squidguard_guidump( &$offset, 50, true)); + $res = squidguard_logrep(squidguard_guidump( $offset, 50, true)); break; case 'filterlog': - $res = squidguard_logrep(squidguard_filterdump( &$offset, 50, true)); + $res = squidguard_logrep(squidguard_filterdump( $offset, 50, true)); break; case "blocked": default: - $res = squidguard_logrep(squidguard_blockdump( &$offset, 50, true)); + $res = squidguard_logrep(squidguard_blockdump( $offset, 50, true)); break; } @@ -93,7 +93,7 @@ function squidguard_log_AJAX_response( $request ) return $res; } -function squidguard_logrep( $dump ) +function squidguard_logrep( &$dump ) { $res = ''; diff --git a/config/squidGuard/squidguard_rewr.xml b/config/squidGuard/squidguard_rewr.xml index c21cb1c0..4b55292d 100644 --- a/config/squidGuard/squidguard_rewr.xml +++ b/config/squidGuard/squidguard_rewr.xml @@ -136,7 +136,7 @@ squidGuard_print_javascript(); </custom_php_after_form_command> <custom_php_validation_command> - squidguard_validate_rewrite($_POST, &$input_errors); + squidguard_validate_rewrite($_POST, $input_errors); </custom_php_validation_command> <custom_php_resync_config_command> // squidguard_resync_rewrite(); diff --git a/config/squidGuard/squidguard_time.xml b/config/squidGuard/squidguard_time.xml index dfd589aa..7f682174 100644 --- a/config/squidGuard/squidguard_time.xml +++ b/config/squidGuard/squidguard_time.xml @@ -136,7 +136,7 @@ squidGuard_print_javascript(); </custom_php_after_form_command> <custom_php_validation_command> - squidguard_validate_times(&$_POST, &$input_errors); + squidguard_validate_times($_POST, $input_errors); </custom_php_validation_command> <custom_php_resync_config_command> // squidguard_resync_time(); |