Fix LDAP authentication

For LDAP to actually work, this depends on #325.