Fix handling of boundaries.
* lib/subordinateio.c: Fix handling of boundaries. * libmisc/find_new_sub_uids.c: Likewise. * libmisc/find_new_sub_gids.c: Likewise.
This commit is contained in:
parent
d9d1bb4acb
commit
bfbd83239e
@ -1,3 +1,9 @@
|
|||||||
|
2013-08-13 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
* lib/subordinateio.c: Fix handling of boundaries.
|
||||||
|
* libmisc/find_new_sub_uids.c: Likewise.
|
||||||
|
* libmisc/find_new_sub_gids.c: Likewise.
|
||||||
|
|
||||||
2013-08-12 Nicolas François <nicolas.francois@centraliens.net>
|
2013-08-12 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* lib/subordinateio.c: Fix removal of ranges. The database needs
|
* lib/subordinateio.c: Fix removal of ranges. The database needs
|
||||||
|
@ -228,7 +228,7 @@ static unsigned long find_free_range(struct commonio_db *db,
|
|||||||
unsigned long low, high;
|
unsigned long low, high;
|
||||||
|
|
||||||
/* When given invalid parameters fail */
|
/* When given invalid parameters fail */
|
||||||
if ((count == 0) || (max <= min))
|
if ((count == 0) || (max < min))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* Sort by range then by owner */
|
/* Sort by range then by owner */
|
||||||
@ -246,7 +246,7 @@ static unsigned long find_free_range(struct commonio_db *db,
|
|||||||
high = max;
|
high = max;
|
||||||
|
|
||||||
/* Is the hole before this range large enough? */
|
/* Is the hole before this range large enough? */
|
||||||
if ((high > low) && (((high - low) + 1) >= count))
|
if ((high > low) && ((high - low) >= count))
|
||||||
return low;
|
return low;
|
||||||
|
|
||||||
/* Compute the low end of the next hole */
|
/* Compute the low end of the next hole */
|
||||||
|
@ -60,7 +60,7 @@ int find_new_sub_gids (const char *owner,
|
|||||||
max = getdef_ulong ("SUB_GID_MAX", 600100000UL);
|
max = getdef_ulong ("SUB_GID_MAX", 600100000UL);
|
||||||
count = getdef_ulong ("SUB_GID_COUNT", 10000);
|
count = getdef_ulong ("SUB_GID_COUNT", 10000);
|
||||||
|
|
||||||
if (min >= max || count >= max || (min + count) >= max) {
|
if (min > max || count >= max || (min + count - 1) > max) {
|
||||||
(void) fprintf (stderr,
|
(void) fprintf (stderr,
|
||||||
_("%s: Invalid configuration: SUB_GID_MIN (%lu),"
|
_("%s: Invalid configuration: SUB_GID_MIN (%lu),"
|
||||||
" SUB_GID_MAX (%lu), SUB_GID_COUNT (%lu)\n"),
|
" SUB_GID_MAX (%lu), SUB_GID_COUNT (%lu)\n"),
|
||||||
|
@ -60,7 +60,7 @@ int find_new_sub_uids (const char *owner,
|
|||||||
max = getdef_ulong ("SUB_UID_MAX", 600100000UL);
|
max = getdef_ulong ("SUB_UID_MAX", 600100000UL);
|
||||||
count = getdef_ulong ("SUB_UID_COUNT", 10000);
|
count = getdef_ulong ("SUB_UID_COUNT", 10000);
|
||||||
|
|
||||||
if (min >= max || count >= max || (min + count) >= max) {
|
if (min > max || count >= max || (min + count - 1) > max) {
|
||||||
(void) fprintf (stderr,
|
(void) fprintf (stderr,
|
||||||
_("%s: Invalid configuration: SUB_UID_MIN (%lu),"
|
_("%s: Invalid configuration: SUB_UID_MIN (%lu),"
|
||||||
" SUB_UID_MAX (%lu), SUB_UID_COUNT (%lu)\n"),
|
" SUB_UID_MAX (%lu), SUB_UID_COUNT (%lu)\n"),
|
||||||
|
Loading…
Reference in New Issue
Block a user