Ldap support for search mode 1

**This is not (yet) intended to be pulled!**

I'd like to have feedback on the changes first.

Thank you!