diff -up shadow-4.1.4.3/libmisc/find_new_gid.c.uflg shadow-4.1.4.3/libmisc/find_new_gid.c --- shadow-4.1.4.3/libmisc/find_new_gid.c.uflg 2011-05-20 21:18:24.474018778 +0200 +++ shadow-4.1.4.3/libmisc/find_new_gid.c 2011-05-20 21:18:43.178018729 +0200 @@ -61,7 +61,7 @@ int find_new_gid (bool sys_group, gid_min = (gid_t) getdef_ulong ("GID_MIN", 1000UL); gid_max = (gid_t) getdef_ulong ("GID_MAX", 60000UL); } else { - gid_min = (gid_t) getdef_ulong ("SYS_GID_MIN", 101UL); + gid_min = (gid_t) 1; gid_max = (gid_t) getdef_ulong ("GID_MIN", 1000UL) - 1; gid_max = (gid_t) getdef_ulong ("SYS_GID_MAX", (unsigned long) gid_max); } @@ -80,6 +80,10 @@ int find_new_gid (bool sys_group, return 0; } + /* if we did not find free preffered system gid, we start to look for + * one in the range assigned to dynamic system IDs */ + if (sys_group) + gid_min = (gid_t) getdef_ulong ("SYS_GID_MIN", 101UL); /* * Search the entire group file,