[Pkg-shadow-commits] r2644 - in upstream/trunk: . libmisc
Nicolas FRANÇOIS
nekral-guest at alioth.debian.org
Sat Apr 11 16:00:45 UTC 2009
Author: nekral-guest
Date: 2009-04-11 16:00:45 +0000 (Sat, 11 Apr 2009)
New Revision: 2644
Modified:
upstream/trunk/ChangeLog
upstream/trunk/NEWS
upstream/trunk/libmisc/find_new_gid.c
upstream/trunk/libmisc/find_new_uid.c
Log:
* libmisc/find_new_gid.c, libmisc/find_new_uid.c: For system
accounts, return the first unused ID, starting from the max value.
This could be useful later to increase the static IDs range.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2009-04-11 15:34:10 UTC (rev 2643)
+++ upstream/trunk/ChangeLog 2009-04-11 16:00:45 UTC (rev 2644)
@@ -1,5 +1,11 @@
2009-04-11 Peter Vrabec <pvrabec at redhat.com>
+ * libmisc/find_new_gid.c, libmisc/find_new_uid.c: For system
+ accounts, return the first unused ID, starting from the max value.
+ This could be useful later to increase the static IDs range.
+
+2009-04-11 Peter Vrabec <pvrabec at redhat.com>
+
* NEWS, src/useradd.c, man/useradd.8.xml: add -Z option to map
SELinux user for user's login.
* NEWS, src/usermod.c, man/usermod.8.xml: Likewise.
Modified: upstream/trunk/NEWS
===================================================================
--- upstream/trunk/NEWS 2009-04-11 15:34:10 UTC (rev 2643)
+++ upstream/trunk/NEWS 2009-04-11 16:00:45 UTC (rev 2644)
@@ -56,6 +56,8 @@
* error handling improvement (see above).
* Speedup (see "addition of users or groups" above).
* do not create groups with GID set to (gid_t)-1.
+ * Allocate system group GIDs in reverse order. This could be useful
+ later to increase the static IDs range.
- groupdel
* audit logging improvements.
* error handling improvement (see above).
@@ -82,6 +84,8 @@
* Speedup (see "addition of users or groups" above).
* do not create users with UID set to (gid_t)-1.
* do not create groups with GID set to (gid_t)-1.
+ * Allocate system account UIDs/GIDs in reverse order. This could be useful
+ later to increase the static IDs range.
- passwd
* For compatibility with other passwd version, the --lock an --unlock
options do not lock or unlock the user account anymore. They only
@@ -98,6 +102,8 @@
* New -M/--no-create-home option to disable CREATE_HOME.
* do not create users with UID set to (gid_t)-1.
* Added -Z option to map SELinux user for user's login.
+ * Allocate system user UIDs in reverse order. This could be useful
+ later to increase the static IDs range.
- userdel
* audit logging improvements.
* Do not fail if the removed user is not in the shadow database.
Modified: upstream/trunk/libmisc/find_new_gid.c
===================================================================
--- upstream/trunk/libmisc/find_new_gid.c 2009-04-11 15:34:10 UTC (rev 2643)
+++ upstream/trunk/libmisc/find_new_gid.c 2009-04-11 16:00:45 UTC (rev 2644)
@@ -110,6 +110,23 @@
}
}
+ /* find free system account in reverse order */
+ if (sys_group) {
+ for (group_id = gid_max; group_id >= gid_min; group_id--) {
+ if (0 == used_gids[group_id]) {
+ break;
+ }
+ }
+ if ( group_id < gid_min ) {
+ fprintf (stderr,
+ _("%s: Can't get unique GID (no more available GIDs)\n"),
+ Prog);
+ SYSLOG ((LOG_WARN,
+ "no more available GID on the system"));
+ return -1;
+ }
+ }
+
/*
* If a group with GID equal to GID_MAX exists, the above algorithm
* will give us GID_MAX+1 even if not unique. Search for the first
Modified: upstream/trunk/libmisc/find_new_uid.c
===================================================================
--- upstream/trunk/libmisc/find_new_uid.c 2009-04-11 15:34:10 UTC (rev 2643)
+++ upstream/trunk/libmisc/find_new_uid.c 2009-04-11 16:00:45 UTC (rev 2644)
@@ -111,6 +111,23 @@
}
}
+ /* find free system account in reverse order */
+ if (sys_user) {
+ for (user_id = uid_max; user_id >= uid_min; user_id--) {
+ if (0 == used_uids[user_id]) {
+ break;
+ }
+ }
+ if (user_id < uid_min ) {
+ fprintf (stderr,
+ _("%s: Can't get unique system UID (no more available UIDs)\n"),
+ Prog);
+ SYSLOG ((LOG_WARN,
+ "no more available UID on the system"));
+ return -1;
+ }
+ }
+
/*
* If a user with UID equal to UID_MAX exists, the above algorithm
* will give us UID_MAX+1 even if not unique. Search for the first
More information about the Pkg-shadow-commits
mailing list