From: Dan Wells Date: Wed, 31 Oct 2012 14:21:14 +0000 (-0400) Subject: Protect against empty/invalid log_protect sections X-Git-Tag: osrf_rel_2_2_0-alpha~29 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=705af84edadda570da5385db11e1f6aeb72857a9;p=OpenSRF.git Protect against empty/invalid log_protect sections Connectivity would fail if the log_protect section of opensrf_core.xml was empty, or contained only comments, as it does in the default example. Add a simple guard against this potential problem. This fix will also protect against cases where the 'log_protect' section contains text rather than separate configuration elements. Credit to Dan Scott for finding the bug and working out how to fix it. Signed-off-by: Dan Wells Signed-off-by: Dan Scott --- diff --git a/src/perl/lib/OpenSRF/Application.pm b/src/perl/lib/OpenSRF/Application.pm index 93cb92d..9283b7f 100644 --- a/src/perl/lib/OpenSRF/Application.pm +++ b/src/perl/lib/OpenSRF/Application.pm @@ -135,10 +135,12 @@ sub handler { my $logdata = "CALL: ".$session->service." $method_name "; my $redact_params = 0; if (@p) { - foreach my $match_string (@{$shared_conf->shared->log_protect}) { - if ($method_name =~ /^$match_string/) { - $redact_params = 1; - last; + if (ref($shared_conf->shared->log_protect) eq 'ARRAY') { + foreach my $match_string (@{$shared_conf->shared->log_protect}) { + if ($method_name =~ /^$match_string/) { + $redact_params = 1; + last; + } } } if ($redact_params) {