Ldap support

This includes ldap support for all three search modes.

Regarding search mode 2: Doing it properly would bloat the code a lot and it would require two requests to the ldap server with no real benefit, so I just do a "contains" search on the ldap server and add it to the second part (res2).
If you come up with a better solution, I'm eager to hear it!