Ldap

Fixes to allow ldap to work correctly.