From 7ff3ae73741c42e8081b8fc242cddc4b1b436449 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 8 Jan 2017 13:00:39 +0000 Subject: [PATCH] idmap_tdb: Avoid a few casts The times of attempting to be C++ compatible are gone since C compilers can do very good warnings too. Signed-off-by: Volker Lendecke Reviewed-by: Uri Simchoni --- source3/winbindd/idmap_tdb_common.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/source3/winbindd/idmap_tdb_common.c b/source3/winbindd/idmap_tdb_common.c index 0d7e734cd5d..e873b60bd8f 100644 --- a/source3/winbindd/idmap_tdb_common.c +++ b/source3/winbindd/idmap_tdb_common.c @@ -51,11 +51,9 @@ static NTSTATUS idmap_tdb_common_allocate_id_action(struct db_context *db, void *private_data) { NTSTATUS ret; - struct idmap_tdb_common_allocate_id_context *state; + struct idmap_tdb_common_allocate_id_context *state = private_data; uint32_t hwm; - state = (struct idmap_tdb_common_allocate_id_context *)private_data; - ret = dbwrap_fetch_uint32_bystring(db, state->hwmkey, &hwm); if (!NT_STATUS_IS_OK(ret)) { ret = NT_STATUS_INTERNAL_DB_ERROR; @@ -180,11 +178,9 @@ static NTSTATUS idmap_tdb_common_set_mapping_action(struct db_context *db, { TDB_DATA data; NTSTATUS ret; - struct idmap_tdb_common_set_mapping_context *state; + struct idmap_tdb_common_set_mapping_context *state = private_data; TALLOC_CTX *tmp_ctx = talloc_stackframe(); - state = (struct idmap_tdb_common_set_mapping_context *)private_data; - DEBUG(10, ("Storing %s <-> %s map\n", state->ksidstr, state->kidstr)); /* check whether sid mapping is already present in db */ @@ -546,12 +542,10 @@ struct idmap_tdb_common_sids_to_unixids_context { static NTSTATUS idmap_tdb_common_sids_to_unixids_action(struct db_context *db, void *private_data) { - struct idmap_tdb_common_sids_to_unixids_context *state; + struct idmap_tdb_common_sids_to_unixids_context *state = private_data; int i, num_mapped = 0; NTSTATUS ret = NT_STATUS_OK; - state = (struct idmap_tdb_common_sids_to_unixids_context *)private_data; - DEBUG(10, ("idmap_tdb_common_sids_to_unixids: " " domain: [%s], allocate: %s\n", state->dom->name, state->allocate_unmapped ? "yes" : "no")); -- 2.34.1