Bug 10384: fall back to normal authentication if LDAP server is not available
authorFridolyn SOMERS <fridolyn.somers@biblibre.com>
Fri, 31 May 2013 08:17:08 +0000 (10:17 +0200)
committerBernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Sat, 3 Aug 2013 19:01:50 +0000 (16:01 -0300)
commite29a98f8166df4cad0cb6ea12bd06a39e52a4d47
tree5bc1423a8d42c913b946171fae31154b2ce3aaa7
parent424a73e889edf5d8e90150ed504fa802953d8194
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>
(cherry picked from commit 85130dafc515363eba8f44973291a7af893a8b52)
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
(cherry picked from commit 85130dafc515363eba8f44973291a7af893a8b52)
C4/Auth_with_ldap.pm