* libmisc/find_new_gid.c, libmisc/find_new_uid.c: Avoid calling
getgrent()/getpwent() after they return NULL. This caused LDAP to return at the beginning of the group/user entries.
This commit is contained in:
parent
32ef9c2135
commit
a62e781248
@ -1,3 +1,9 @@
|
|||||||
|
2009-02-22 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
* libmisc/find_new_gid.c, libmisc/find_new_uid.c: Avoid calling
|
||||||
|
getgrent()/getpwent() after they return NULL. This caused LDAP to
|
||||||
|
return at the beginning of the group/user entries.
|
||||||
|
|
||||||
2009-01-27 Nicolas François <nicolas.francois@centraliens.net>
|
2009-01-27 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* man/nologin.8.xml: Fix typo (HYSTORY -> HISTORY).
|
* man/nologin.8.xml: Fix typo (HYSTORY -> HISTORY).
|
||||||
|
@ -89,9 +89,7 @@ int find_new_gid (bool sys_group, gid_t *gid, gid_t const *preferred_gid)
|
|||||||
* some groups were created but the changes were not committed yet.
|
* some groups were created but the changes were not committed yet.
|
||||||
*/
|
*/
|
||||||
setgrent ();
|
setgrent ();
|
||||||
gr_rewind ();
|
while ((grp = getgrent ()) != NULL) {
|
||||||
while ( ((grp = getgrent ()) != NULL)
|
|
||||||
|| ((grp = gr_next ()) != NULL)) {
|
|
||||||
if ((grp->gr_gid >= group_id) && (grp->gr_gid <= gid_max)) {
|
if ((grp->gr_gid >= group_id) && (grp->gr_gid <= gid_max)) {
|
||||||
group_id = grp->gr_gid + 1;
|
group_id = grp->gr_gid + 1;
|
||||||
}
|
}
|
||||||
@ -101,6 +99,16 @@ int find_new_gid (bool sys_group, gid_t *gid, gid_t const *preferred_gid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
endgrent ();
|
endgrent ();
|
||||||
|
gr_rewind ();
|
||||||
|
while ((grp = getgrent ()) != NULL) {
|
||||||
|
if ((grp->gr_gid >= group_id) && (grp->gr_gid <= gid_max)) {
|
||||||
|
group_id = grp->gr_gid + 1;
|
||||||
|
}
|
||||||
|
/* create index of used GIDs */
|
||||||
|
if (grp->gr_gid <= gid_max) {
|
||||||
|
used_gids[grp->gr_gid] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If a group with GID equal to GID_MAX exists, the above algorithm
|
* If a group with GID equal to GID_MAX exists, the above algorithm
|
||||||
|
@ -90,9 +90,7 @@ int find_new_uid (bool sys_user, uid_t *uid, uid_t const *preferred_uid)
|
|||||||
* some users were created but the changes were not committed yet.
|
* some users were created but the changes were not committed yet.
|
||||||
*/
|
*/
|
||||||
setpwent ();
|
setpwent ();
|
||||||
pw_rewind ();
|
while ((pwd = getpwent ()) != NULL) {
|
||||||
while ( ((pwd = getpwent ()) != NULL)
|
|
||||||
|| ((pwd = pw_next ()) != NULL)) {
|
|
||||||
if ((pwd->pw_uid >= user_id) && (pwd->pw_uid <= uid_max)) {
|
if ((pwd->pw_uid >= user_id) && (pwd->pw_uid <= uid_max)) {
|
||||||
user_id = pwd->pw_uid + 1;
|
user_id = pwd->pw_uid + 1;
|
||||||
}
|
}
|
||||||
@ -102,6 +100,16 @@ int find_new_uid (bool sys_user, uid_t *uid, uid_t const *preferred_uid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
endpwent ();
|
endpwent ();
|
||||||
|
pw_rewind ();
|
||||||
|
while ((pwd = pw_next ()) != NULL) {
|
||||||
|
if ((pwd->pw_uid >= user_id) && (pwd->pw_uid <= uid_max)) {
|
||||||
|
user_id = pwd->pw_uid + 1;
|
||||||
|
}
|
||||||
|
/* create index of used UIDs */
|
||||||
|
if (pwd->pw_uid <= uid_max) {
|
||||||
|
used_uids[pwd->pw_uid] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If a user with UID equal to UID_MAX exists, the above algorithm
|
* If a user with UID equal to UID_MAX exists, the above algorithm
|
||||||
|
Loading…
Reference in New Issue
Block a user