summaryrefslogtreecommitdiffstats
path: root/source/utils
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-10-18 18:02:37 +0000
committerJeremy Allison <jra@samba.org>2005-10-18 18:02:37 +0000
commit6bdbe874ad9aa0092d4394a4f678810f3e758ab0 (patch)
tree99565ea6445b98ea3aaf26aaf6909d6d633977f0 /source/utils
parent290aa6ca2e22201c63abc8d3628fff7a34afbb2f (diff)
downloadsamba-6bdbe874ad9aa0092d4394a4f678810f3e758ab0.tar.gz
samba-6bdbe874ad9aa0092d4394a4f678810f3e758ab0.tar.xz
samba-6bdbe874ad9aa0092d4394a4f678810f3e758ab0.zip
r11155: Remove warning in torturous logic.
Jeremy.
Diffstat (limited to 'source/utils')
-rw-r--r--source/utils/net_idmap.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/source/utils/net_idmap.c b/source/utils/net_idmap.c
index 0ee180e13ec..8109bef5225 100644
--- a/source/utils/net_idmap.c
+++ b/source/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;
}