user-util: switch order of checks in valid_user_group_name_or_id_full()

When we are supposed to accept numeric UIDs formatted as string, then
let's check that first, before passing things on to
valid_user_group_name_full(), since that might log about, and not the
other way round.

See: #15201
Follow-up for: 93c23c9297
This commit is contained in:
Lennart Poettering 2020-03-30 21:46:01 +02:00
parent 36e4a8f22a
commit a85daa0dfb
1 changed files with 2 additions and 2 deletions

View File

@ -778,10 +778,10 @@ bool valid_user_group_name_or_id_full(const char *u, bool strict) {
if (isempty(u))
return false;
if (valid_user_group_name_full(u, strict))
if (parse_uid(u, NULL) >= 0)
return true;
return parse_uid(u, NULL) >= 0;
return valid_user_group_name_full(u, strict);
}
bool valid_gecos(const char *d) {