sub[ug]id: compare range before comparing username/UID, to avoid unnecessary syscalls

Change suggested by Nicolas François as performance optimization.
Performance penalty would be really noticeable when usernames are
stored in remote databases (ldap).