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 <dbw2@calvin.edu>
Signed-off-by: Dan Scott <dan@coffeecode.net>
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) {