Added ldap support for search_mode_1
Encapsulated search callback (patch by @michelRenon)