Add scoping to ldap lookup when only dn given

Fixes #6856