Fixes: #2918 Fixed LDAP error detection