Fix LDAP authentication 

Previously, even a successful login would result in 
"LDAP authentication failed."