summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIker Pedrosa <ipedrosa@redhat.com>2022-10-24 10:46:36 +0200
committerSerge Hallyn <serge@hallyn.com>2022-11-18 09:04:42 -0600
commite0524e813a3bae2891b33a66f35876841c11cee7 (patch)
tree45c9f42fe80183f7d855c159a0a0733104d43132
parent24b44b686ea2221405cfd806dede046cf1fd9584 (diff)
useradd: check if subid range exists for user
Check if a user already has a subid range before assigning one. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2012929 Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
-rw-r--r--src/useradd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/useradd.c b/src/useradd.c
index 7ea0a9c4..e784d602 100644
--- a/src/useradd.c
+++ b/src/useradd.c
@@ -2188,14 +2188,14 @@ static void usr_update (unsigned long subuid_count, unsigned long subgid_count)
fail_exit (E_PW_UPDATE);
}
#ifdef ENABLE_SUBIDS
- if (is_sub_uid &&
+ if (is_sub_uid && !local_sub_uid_assigned(user_name) &&
(sub_uid_add(user_name, sub_uid_start, subuid_count) == 0)) {
fprintf (stderr,
_("%s: failed to prepare the new %s entry\n"),
Prog, sub_uid_dbname ());
fail_exit (E_SUB_UID_UPDATE);
}
- if (is_sub_gid &&
+ if (is_sub_gid && !local_sub_gid_assigned(user_name) &&
(sub_gid_add(user_name, sub_gid_start, subgid_count) == 0)) {
fprintf (stderr,
_("%s: failed to prepare the new %s entry\n"),