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)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 5 Jul 2013 16:08:46 +0000 (16:08 +0000)
commit96ac578960cb4f2c5a964b3ac7fa4f9ba676b95d
tree2f03c7f8ea1f65bcef54908d9a2e3a36cf2a81a0
parent2d32ab38148f7d75412a36e928dea799717bc5fb
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>
C4/Auth_with_ldap.pm