]> granicus.if.org Git - shadow/commitdiff
useradd: Read defaults after changing root directories
authorDavid Michael <david.michael@coreos.com>
Wed, 8 Feb 2017 23:48:36 +0000 (15:48 -0800)
committerSerge Hallyn <serge@hallyn.com>
Sat, 11 Feb 2017 14:59:49 +0000 (08:59 -0600)
This reverts the behavior of "useradd --root" to using the settings
from login.defs in the target root directory, not the root of the
executed useradd command.

src/useradd.c

index 1797229b8b88d4ca808a8546e96d246ed4c6556e..d973ca329141798cc9408753d9d19ffffb548382 100644 (file)
@@ -2047,8 +2047,8 @@ int main (int argc, char **argv)
 #endif                         /* ACCT_TOOLS_SETUID */
 
 #ifdef ENABLE_SUBIDS
-       uid_t uid_min = (uid_t) getdef_ulong ("UID_MIN", 1000UL);
-       uid_t uid_max = (uid_t) getdef_ulong ("UID_MAX", 60000UL);
+       uid_t uid_min;
+       uid_t uid_max;
 #endif
 
        /*
@@ -2085,6 +2085,8 @@ int main (int argc, char **argv)
        process_flags (argc, argv);
 
 #ifdef ENABLE_SUBIDS
+       uid_min = (uid_t) getdef_ulong ("UID_MIN", 1000UL);
+       uid_max = (uid_t) getdef_ulong ("UID_MAX", 60000UL);
        is_sub_uid = sub_uid_file_present () && !rflg &&
            (!user_id || (user_id <= uid_max && user_id >= uid_min));
        is_sub_gid = sub_gid_file_present () && !rflg &&