useradd: don't mask user_id variable in check_uid_range
While it's not "wrong" right now, it could be confusing, and cause
trouble later.
I'm not a fan of global variables in the first place, but restructuring
venerable code like this tends to be asking for trouble.
Also rename rflg as sys_user. And fix its type, as it is a bool, not
int.
Also a note on commit
764e56e9ec: useradd: fix subuid allocation,
which is in a PR comment. Putting it here so it'll be in the git
tree itself:
> For posterity: this was apparently always broken, but the opposite way. The
> user_id part of the check was always true if !user_id, and user_id was always
> 0, so that was ignored. Alex fixed that accidentally by switching to if
> (user_id == 0) return false, in
8508d61.
Signed-off-by: Serge Hallyn <serge@hallyn.com>
Reported-by: Alejandro Colomar <alx@kernel.org>
Reviewed-by: Alejandro Colomar <alx@kernel.org>