Highlights:
- Pull resolve_user() and resolve_group() out to make the main flow a bit easier to read
- Fix some edge-cases in user/group resolution: you can have fully numeric usernames, and they may or may not live within the valid ID range. Switch to just trying to resolve every specified group/user as a name, first, with a fallback to converting it to a numeric type and trying to resolve it as an ID.
- Constify locals in main() that don't need to be mutable, re-sort