summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-10-18 18:02:37 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:05:03 -0500
commitff00d8e96383dbf6781d550ec1eff54b8737ef94 (patch)
tree2eb3be8ccb64a11f7edcb23ea7415895191f0213 /source3/utils
parent63937fec90338fb5affe2d8cb2a568edae320acd (diff)
downloadsamba-ff00d8e96383dbf6781d550ec1eff54b8737ef94.tar.gz
samba-ff00d8e96383dbf6781d550ec1eff54b8737ef94.tar.bz2
samba-ff00d8e96383dbf6781d550ec1eff54b8737ef94.zip
r11155: Remove warning in torturous logic.
Jeremy. (This used to be commit c7373b39bae6dca8281d45d1ff3f2161465838df)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_idmap.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/source3/utils/net_idmap.c b/source3/utils/net_idmap.c
index 0ee180e13e..8109bef522 100644
--- a/source3/utils/net_idmap.c
+++ b/source3/utils/net_idmap.c
@@ -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;
}