Better handling of invalid user ids

- better DN validation before search;
- handle None lookups correctly, returning nothing, instead of
  searching ldap.

Change-Id: Id92d994a20873cae19578142f410cc1b4e89a2d7