better check whether string resembles a DN, fixes #9887

We have a check in place that tries to guess whether a provided user id is a DN or a username. Unfortunately this was not sufficient and resulted in errors when a provided DN  did not meet our expectations :( This PR is supposed to fix this.

Please test and review @ksteinb @ostraaten @Xenopathic