From 705af84edadda570da5385db11e1f6aeb72857a9 Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Wed, 31 Oct 2012 10:21:14 -0400 Subject: [PATCH] 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 --- src/perl/lib/OpenSRF/Application.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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) { -- 2.43.2