From a9e31b33b55a873c2f01db5e348560176adf863d Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 22 Nov 2006 02:05:19 +0000 Subject: r19832: better prototypes for the linearization functions: - ldb_dn_get_linearized returns a const string - ldb_dn_alloc_linearized allocs astring with the linearized dn (This used to be commit 3929c086d5d0b3f08b1c4f2f3f9602c3f4a9a4bd) --- source4/lib/ldb/modules/ldb_map.c | 10 +++++----- source4/lib/ldb/modules/ldb_map_inbound.c | 4 ++-- source4/lib/ldb/modules/ldb_map_outbound.c | 2 +- source4/lib/ldb/modules/rdn_name.c | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'source4/lib/ldb/modules') diff --git a/source4/lib/ldb/modules/ldb_map.c b/source4/lib/ldb/modules/ldb_map.c index 05a0459b4a..6387ffc5b7 100644 --- a/source4/lib/ldb/modules/ldb_map.c +++ b/source4/lib/ldb/modules/ldb_map.c @@ -679,7 +679,7 @@ static struct ldb_val ldb_dn_convert_local(struct ldb_module *module, void *mem_ talloc_free(dn); newval.length = 0; - newval.data = (uint8_t *)ldb_dn_linearize(mem_ctx, newdn); + newval.data = (uint8_t *)ldb_dn_alloc_linearized(mem_ctx, newdn); if (newval.data) { newval.length = strlen((char *)newval.data); } @@ -705,7 +705,7 @@ static struct ldb_val ldb_dn_convert_remote(struct ldb_module *module, void *mem talloc_free(dn); newval.length = 0; - newval.data = (uint8_t *)ldb_dn_linearize(mem_ctx, newdn); + newval.data = (uint8_t *)ldb_dn_alloc_linearized(mem_ctx, newdn); if (newval.data) { newval.length = strlen((char *)newval.data); } @@ -992,9 +992,9 @@ struct ldb_request *map_build_fixup_req(struct map_context *ac, struct ldb_dn *o } /* Update local 'IS_MAPPED' to the new remote DN */ - msg->dn = discard_const_p(struct ldb_dn, olddn); - dn = ldb_dn_linearize(msg, newdn); - if (dn == NULL) { + msg->dn = ldb_dn_copy(msg, olddn); + dn = ldb_dn_alloc_linearized(msg, newdn); + if ( ! dn || ! ldb_dn_validate(msg->dn)) { goto failed; } if (ldb_msg_add_empty(msg, IS_MAPPED, LDB_FLAG_MOD_REPLACE, NULL) != 0) { diff --git a/source4/lib/ldb/modules/ldb_map_inbound.c b/source4/lib/ldb/modules/ldb_map_inbound.c index 38454b2b11..7e5583c9e2 100644 --- a/source4/lib/ldb/modules/ldb_map_inbound.c +++ b/source4/lib/ldb/modules/ldb_map_inbound.c @@ -297,7 +297,7 @@ int map_add(struct ldb_module *module, struct ldb_request *req) /* Store remote DN in 'IS_MAPPED' */ /* TODO: use GUIDs here instead */ - dn = ldb_dn_linearize(local, remote->dn); + dn = ldb_dn_alloc_linearized(local, remote->dn); if (ldb_msg_add_string(local, IS_MAPPED, dn) != 0) { goto failed; } @@ -344,10 +344,10 @@ int map_modify_do_local(struct ldb_handle *handle) /* Add local 'IS_MAPPED' */ /* TODO: use GUIDs here instead */ - dn = ldb_dn_linearize(msg, ac->remote_req->op.mod.message->dn); if (ldb_msg_add_empty(msg, IS_MAPPED, LDB_FLAG_MOD_ADD, NULL) != 0) { return LDB_ERR_OPERATIONS_ERROR; } + dn = ldb_dn_alloc_linearized(msg, ac->remote_req->op.mod.message->dn); if (ldb_msg_add_string(msg, IS_MAPPED, dn) != 0) { return LDB_ERR_OPERATIONS_ERROR; } diff --git a/source4/lib/ldb/modules/ldb_map_outbound.c b/source4/lib/ldb/modules/ldb_map_outbound.c index 6305e6666f..b1eb313060 100644 --- a/source4/lib/ldb/modules/ldb_map_outbound.c +++ b/source4/lib/ldb/modules/ldb_map_outbound.c @@ -1028,7 +1028,7 @@ int map_up_callback(struct ldb_context *ldb, const struct ldb_request *req, stru ldb_debug(ldb, LDB_DEBUG_TRACE, "ldb_map: " "Skipping record '%s': " "doesn't match original search\n", - ldb_dn_linearize(ldb, ares->message->dn)); + ldb_dn_get_linearized(ares->message->dn)); return LDB_SUCCESS; } diff --git a/source4/lib/ldb/modules/rdn_name.c b/source4/lib/ldb/modules/rdn_name.c index bab5f6a014..0da8b8f573 100644 --- a/source4/lib/ldb/modules/rdn_name.c +++ b/source4/lib/ldb/modules/rdn_name.c @@ -119,7 +119,7 @@ static int rdn_name_add(struct ldb_module *module, struct ldb_request *req) if (i == attribute->num_values) { ldb_debug_set(module->ldb, LDB_DEBUG_FATAL, "RDN mismatch on %s: %s (%s)", - ldb_dn_linearize(msg, msg->dn), rdn_name, rdn_val.data); + ldb_dn_get_linearized(msg->dn), rdn_name, rdn_val.data); talloc_free(down_req); return LDB_ERR_OPERATIONS_ERROR; } -- cgit