Bug 10384: fall back to normal authentication if LDAP server is not available
This fixes a bug where, assuming LDAP authentication is enabled, if a user
tries to log in while the LDAP server is down, the following fatal error
is displayed:
Can't call method "bind" on an undefined value at C4/Auth_with_ldap.pm line 134, <DATA> line 558.
This patch catches this error to allow normal authentication when LDAP connexion fails.
Test plan :
- Configure LDAP connexion with a host not having LDAP. ie :
<useldapserver>1</useldapserver>
<ldapserver id="ldapserver">
<hostname>localhost</hostname>
<base>dc=test,dc=com</base>
<user>cn=Manager,dc=test,dc=com</user>
<pass>passwd</pass>
<replicate>0</replicate>
<update>0</update>
<auth_by_bind>0</auth_by_bind>
<mapping>
<firstname is="givenname" ></firstname>
<surname is="sn" ></surname>
<branchcode is="branch" >MAIN</branchcode>
<userid is="uid" ></userid>
<password is="userpassword" ></password>
<email is="mail" ></email>
<categorycode is="employeetype" >PT</categorycode>
</mapping>
</ldapserver>
- Try to connect with mysql user (defined in koha-conf.xml)
- Try to connect with a user defined in borrowers
You may try to connect with working LDAP connexion
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit
96ac578960cb4f2c5a964b3ac7fa4f9ba676b95d)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>