From 31480d928c561fb41a2511acacb03a3405bf9687 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Oct 07 2013 21:50:27 +0000 Subject: Ticket #47515 Fedora 20: setup-ds-admin.pl https://fedorahosted.org/389/ticket/47515 Reviewed by: nhosoi (Thanks!) Branch: master Fix Description: If the last section in the last inf in process_maptbl was a simple string scalar, and not a hash ref, the $infsection variable would be set to that string scalar, and execution would pass to the next statement beyond the foreach loop. The next statement would attempt to dereference that simple string as a hash reference. The fix is to just remove that test for the presence of the hash key. If execution got to this point in the code, the hash key was not found, and we need to check for a default value, or no key at all. Note that the old code would always have returned true for this condition - calling defined($href->{key}) will always return 0 if $href is not really a hash ref. Not sure why this is a problem on F20 - perhaps perl 5.18 in F20 is much more strict with "use strict". Platforms tested: RHEL6 x86_64, Fedora 20 Flag Day: no Doc impact: no --- diff --git a/ldap/admin/src/scripts/DSUtil.pm.in b/ldap/admin/src/scripts/DSUtil.pm.in index eaf5e4b..d40d889 100644 --- a/ldap/admin/src/scripts/DSUtil.pm.in +++ b/ldap/admin/src/scripts/DSUtil.pm.in @@ -861,18 +861,15 @@ sub process_maptbl } } } - if (!defined($infsection->{$value})) + if ($default_value ne "") { - if ($default_value ne "") - { - $default_value =~ tr/\"//d; # default_value is a regular double quoted string - remove quotes - $mapper->{$key} = $default_value; - } - else - { - push @{$errs}, ['no_mapvalue_for_key', $value, $key]; - return {}; - } + $default_value =~ tr/\"//d; # default_value is a regular double quoted string - remove quotes + $mapper->{$key} = $default_value; + } + else + { + push @{$errs}, ['no_mapvalue_for_key', $value, $key]; + return {}; } } }