Bug 10925: fix LDAP auth failing if DEBUG is enabled
authorJonathan Druart <jonathan.druart@biblibre.com>
Fri, 20 Sep 2013 15:21:40 +0000 (17:21 +0200)
committerGalen Charlton <gmc@esilibrary.com>
Wed, 2 Oct 2013 14:26:03 +0000 (14:26 +0000)
To reproduce:
1/ Edit your apache virtual host and set the DEBUG environment variable
(SetEnv DEBUG 1).
2/ Try to login with an ldap user
3/ You will be redirected to the 500 error page.
The Koha logs contains:
malformed header from script. Bad header=------------------------------: mainpage.pl

The hashdump routine directly prints to STDOUT (!) and breaks the
headers.
It appears Net::LDAP::?->dump does the same thing.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>

Maybe we can kill C4::Utils after getting rid of this

Signed-off-by: Galen Charlton <gmc@esilibrary.com>

C4/Auth_with_ldap.pm

index d7a5e9a..0efeb95 100644 (file)
@@ -26,7 +26,6 @@ use C4::Context;
 use C4::Members qw(AddMember changepassword);
 use C4::Members::Attributes;
 use C4::Members::AttributeTypes;
-use C4::Utils qw( :all );
 use List::MoreUtils qw( any );
 use Net::LDAP;
 use Net::LDAP::Filter;
@@ -203,10 +202,8 @@ sub ldap_entry_2_hash {
        my %memberhash;
        $userldapentry->exists('uid');  # This is bad, but required!  By side-effect, this initializes the attrs hash. 
        if ($debug) {
-               print STDERR "\nkeys(\%\$userldapentry) = " . join(', ', keys %$userldapentry), "\n", $userldapentry->dump();
                foreach (keys %$userldapentry) {
                        print STDERR "\n\nLDAP key: $_\t", sprintf('(%s)', ref $userldapentry->{$_}), "\n";
-                       hashdump("LDAP key: ",$userldapentry->{$_});
                }
        }
        my $x = $userldapentry->{attrs} or return;