1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

r11155: Remove warning in torturous logic.

Jeremy.
(This used to be commit c7373b39ba)
This commit is contained in:
Jeremy Allison 2005-10-18 18:02:37 +00:00 committed by Gerald (Jerry) Carter
parent 63937fec90
commit ff00d8e963

View File

@ -84,18 +84,21 @@ static int net_idmap_find_max_id(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA data,
void *handle)
{
struct hwms *hwms = (struct hwms *)handle;
int *idptr = NULL;
void *idptr = NULL;
BOOL isgid = False;
int id;
if (strncmp(key.dptr, "S-", 2) != 0)
return 0;
if (sscanf(data.dptr, "GID %d", &id) == 1) {
idptr = &hwms->group_hwm;
idptr = (void *)&hwms->group_hwm;
isgid = True;
}
if (sscanf(data.dptr, "UID %d", &id) == 1) {
idptr = &hwms->user_hwm;
idptr = (void *)&hwms->user_hwm;
isgid = False;
}
if (idptr == NULL) {
@ -105,8 +108,15 @@ static int net_idmap_find_max_id(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA data,
return -1;
}
if (*idptr <= id)
*idptr = id+1;
if (isgid) {
if (hwms->group_hwm <= (gid_t)id) {
hwms->group_hwm = (gid_t)(id+1);
}
} else {
if (hwms->user_hwm <= (uid_t)id) {
hwms->user_hwm = (uid_t)(id+1);
}
}
return 0;
}