diff options
author | Michael Adam <obnox@samba.org> | 2011-10-06 20:19:41 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2011-10-11 14:17:58 +0200 |
commit | ba88e4e0d86302e7efe2398d5be5cfb32c0dbdeb (patch) | |
tree | 073e2dea10e7d3e4d37b58ea0e5bd1f999d2d31a /source3 | |
parent | f03e4aea66aa59662a49b3dc60917d7b619d7af2 (diff) | |
download | samba-ba88e4e0d86302e7efe2398d5be5cfb32c0dbdeb.tar.gz samba-ba88e4e0d86302e7efe2398d5be5cfb32c0dbdeb.tar.bz2 samba-ba88e4e0d86302e7efe2398d5be5cfb32c0dbdeb.zip |
s3:idmap_tdb: fix hwm-handling to use uint32 consistently
The initialization code user int32, later writes used uint32...
Diffstat (limited to 'source3')
-rw-r--r-- | source3/winbindd/idmap_tdb.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/source3/winbindd/idmap_tdb.c b/source3/winbindd/idmap_tdb.c index 5d5f97899d..ec6b0a8e90 100644 --- a/source3/winbindd/idmap_tdb.c +++ b/source3/winbindd/idmap_tdb.c @@ -241,16 +241,17 @@ static NTSTATUS idmap_tdb_init_hwm(struct idmap_domain *dom) bool update_uid = false; bool update_gid = false; struct idmap_tdb_context *ctx; + bool status; ctx = talloc_get_type(dom->private_data, struct idmap_tdb_context); - low_uid = dbwrap_fetch_int32(ctx->db, HWM_USER); - if (low_uid == -1 || low_uid < dom->low_id) { + status = dbwrap_fetch_uint32(ctx->db, HWM_USER, &low_uid); + if (!status || low_uid < dom->low_id) { update_uid = true; } - low_gid = dbwrap_fetch_int32(ctx->db, HWM_GROUP); - if (low_gid == -1 || low_gid < dom->low_id) { + status = dbwrap_fetch_uint32(ctx->db, HWM_GROUP, &low_gid); + if (!status || low_gid < dom->low_id) { update_gid = true; } @@ -264,7 +265,7 @@ static NTSTATUS idmap_tdb_init_hwm(struct idmap_domain *dom) } if (update_uid) { - ret = dbwrap_store_int32(ctx->db, HWM_USER, dom->low_id); + ret = dbwrap_store_uint32(ctx->db, HWM_USER, dom->low_id); if (ret == -1) { dbwrap_transaction_cancel(ctx->db); DEBUG(0, ("Unable to initialise user hwm in idmap " @@ -274,7 +275,7 @@ static NTSTATUS idmap_tdb_init_hwm(struct idmap_domain *dom) } if (update_gid) { - ret = dbwrap_store_int32(ctx->db, HWM_GROUP, dom->low_id); + ret = dbwrap_store_uint32(ctx->db, HWM_GROUP, dom->low_id); if (ret == -1) { dbwrap_transaction_cancel(ctx->db); DEBUG(0, ("Unable to initialise group hwm in idmap " @@ -389,11 +390,12 @@ static NTSTATUS idmap_tdb_allocate_id_action(struct db_context *db, NTSTATUS ret; struct idmap_tdb_allocate_id_context *state; uint32_t hwm; + bool ret2; state = (struct idmap_tdb_allocate_id_context *)private_data; - hwm = dbwrap_fetch_int32(db, state->hwmkey); - if (hwm == -1) { + ret2 = dbwrap_fetch_uint32(db, state->hwmkey, &hwm); + if (!ret2) { ret = NT_STATUS_INTERNAL_DB_ERROR; goto done; } |