Skip to content

Commit 1185c23

Browse files
author
ndostert
committed
useradd: Correctly set subuid/subgid when using -F
The -F flag should bypass the UID check and always add entries to the sub[ud]id while the -r flag should still be used in addition with the UID check. Closes: <#1255> Signed-off-by: ndostert <[email protected]>
1 parent a49d2ac commit 1185c23

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/useradd.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2511,12 +2511,10 @@ int main (int argc, char **argv)
25112511
subgid_count = getdef_ulong ("SUB_GID_COUNT", 65536);
25122512
is_sub_uid = want_subuid_file () &&
25132513
subuid_count > 0 && sub_uid_file_present () &&
2514-
(!rflg || Fflg) &&
2515-
(!user_id || (user_id <= uid_max && user_id >= uid_min));
2514+
(!rflg && (!user_id || (user_id <= uid_max && user_id >= uid_min))) || Fflg;
25162515
is_sub_gid = want_subgid_file() &&
25172516
subgid_count > 0 && sub_gid_file_present() &&
2518-
(!rflg || Fflg) &&
2519-
(!user_id || (user_id <= uid_max && user_id >= uid_min));
2517+
(!rflg && (!user_id || (user_id <= uid_max && user_id >= uid_min))) || Fflg;
25202518
#endif /* ENABLE_SUBIDS */
25212519

25222520
if (run_parts ("/etc/shadow-maint/useradd-pre.d", user_name,

0 commit comments

Comments
 (0)