From: ndostert Date: Mon, 23 Feb 2026 20:50:16 +0000 (+0100) Subject: useradd: Correctly set subuid/subgid when using -F X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=905ae433da015d35bd1b795391ade803df867c98;p=thirdparty%2Fshadow.git useradd: Correctly set subuid/subgid when using -F The -F flag should bypass the -r flag and UID checks. Closes: Signed-off-by: ndostert Co-authored-by: Alejandro Colomar Fixes: 3f7a72e9677b (2022-08-01; "useradd: add -F option for updating /etc/sub[ig]id for system accounts") --- diff --git a/src/useradd.c b/src/useradd.c index 330b52f8d..fbc7e7b25 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -2463,7 +2463,9 @@ should_assign_subuid(void) return false; if (!sub_uid_file_present()) return false; - if (rflg && !Fflg) + if (Fflg) + return true; + if (rflg) return false; if (user_id == 0) return false; @@ -2491,7 +2493,9 @@ should_assign_subgid(void) return false; if (!sub_gid_file_present()) return false; - if (rflg && !Fflg) + if (Fflg) + return true; + if (rflg) return false; if (user_id == 0) return false;