Avoid exception in LDAP exception handler
Add tests for subtree search and empty base_dn