From 1c9f8defcb69991bf7f0ee70f8787228505e8537 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Wed, 19 May 2021 12:24:53 +0200 Subject: [PATCH] Bug 28385: ldap server configuration broken since migration from XML::Simple Bug 28278 removed usage of XML::Simple which had side-affect that C4::Context->config("ldapserver") returns one more level of hash based on id of element, so ldap configuration was no longer available generating error in log: No ldapserver "hostname" defined in KOHA_CONF: /etc/koha/sites/srvgit/koha-conf.xml which is very confusing since hostname is there, but we are looking at wrong place for it. == Test plan == 1. Setup an LDAP server with users or use a public one See https://wiki.koha-community.org/wiki/Ldap_testing 2. Configure Koha to use it, see example config above 3. Go to OPAC 4. Koha doesn't compile due to LDAP config not parsed correctly 5. Apply the patch 6. Koha compiles and page loads 7. Log in successfully with one of the LDAP users 8. Bonus: Try to log-in with a wrong username & a good password and vice-versa Signed-off-by: Martin Renvoize Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Jonathan Druart --- C4/Auth_with_ldap.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/C4/Auth_with_ldap.pm b/C4/Auth_with_ldap.pm index 679c045141..face1e428f 100644 --- a/C4/Auth_with_ldap.pm +++ b/C4/Auth_with_ldap.pm @@ -51,6 +51,8 @@ sub ldapserver_error { use vars qw($mapping @ldaphosts $base $ldapname $ldappassword); my $ldap = C4::Context->config("ldapserver") or die 'No "ldapserver" in server hash from KOHA_CONF: ' . $ENV{KOHA_CONF}; +# since Bug 28278 we need to skip id in which generates additional hash level +$ldap = $ldap->{ldapserver} or die ldapserver_error('id="ldapserver"'); my $prefhost = $ldap->{hostname} or die ldapserver_error('hostname'); my $base = $ldap->{base} or die ldapserver_error('base'); $ldapname = $ldap->{user} ; -- 2.39.5