Fix NULL pointer dereference in LDAP lookup code.