summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-03-30 21:46:01 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-04-01 19:18:26 +0200
commita0b77ea24b314c6b23e7dda9a097db7d148e190e (patch)
treef9073826502b56e334133a0d89385e996ecfe953
parentd71c24910d01c61a332b669d33c283e420f6e07e (diff)
downloadsystemd-a0b77ea24b314c6b23e7dda9a097db7d148e190e.tar.gz
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: 93c23c9297e48e594785e0bb9c51504aae5fbe3e (cherry picked from commit a85daa0dfb3eb03be9845760e90e54b9af8fb00e)
-rw-r--r--src/basic/user-util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/basic/user-util.c b/src/basic/user-util.c
index e998a46e72..1510fc96ef 100644
--- a/src/basic/user-util.c
+++ b/src/basic/user-util.c
@@ -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) {