From b94b9d8c3d7b99294eb48437894d8c6901e9dc70 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 1 Aug 2006 02:25:05 +0000 Subject: r17349: We can't just return sucess here, modules below us expect the async reply rules to be followed. Add code to do a fake async callback on the skipped records. Andrew Bartlett (This used to be commit 26bc7dbed978f92e814d9803366eac7d7f4ded3e) --- source4/lib/ldb/ldb_tdb/ldb_tdb.c | 55 ++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 24 deletions(-) (limited to 'source4/lib/ldb/ldb_tdb/ldb_tdb.c') diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index cbc9d61613..588f73fe23 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -270,35 +270,42 @@ static int ltdb_add_internal(struct ldb_module *module, const struct ldb_message } ret = ltdb_store(module, msg, TDB_INSERT); - if (ret != LDB_SUCCESS) { - switch (ret) { - case LDB_ERR_ENTRY_ALREADY_EXISTS: - { - TALLOC_CTX *mem_ctx = talloc_new(module); - char *errstring, *dn; - if (!mem_ctx) { - break; - } - dn = ldb_dn_linearize(mem_ctx, msg->dn); - if (!dn) { - break; - } - errstring = talloc_asprintf(mem_ctx, "Entry %s already exists", - dn); - ldb_set_errstring(module->ldb, errstring); - talloc_free(mem_ctx); + switch (ret) { + case LDB_SUCCESS: + { + TALLOC_CTX *mem_ctx = talloc_new(module); + char *dn; + dn = ldb_dn_linearize(mem_ctx, msg->dn); + if (!dn) { break; } + ret = ltdb_modified(module, msg->dn); + if (ret != LDB_SUCCESS) { + return LDB_ERR_OPERATIONS_ERROR; } - return ret; + break; } - - ret = ltdb_modified(module, msg->dn); - if (ret != LDB_SUCCESS) { - return LDB_ERR_OPERATIONS_ERROR; + case LDB_ERR_ENTRY_ALREADY_EXISTS: + { + TALLOC_CTX *mem_ctx = talloc_new(module); + char *errstring, *dn; + if (!mem_ctx) { + break; + } + dn = ldb_dn_linearize(mem_ctx, msg->dn); + if (!dn) { + break; + } + errstring = talloc_asprintf(mem_ctx, "Entry %s already exists", + dn); + ldb_set_errstring(module->ldb, errstring); + talloc_free(mem_ctx); + break; } - - return LDB_SUCCESS; + default: + break; + } + return ret; } /* -- cgit