From 20869a0bf0758936b31dc648db7c1ee435dadc34 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 17 Dec 2009 14:20:35 +1100 Subject: s4-ldb: canonicalise the message on ldb_add This canonicalise avoids a problem with an add that has multiple elements with the same el->name. That is allowed by MS servers, and by ldb, but it breaks things like the tdb backend and the repl_meta_data RPMD handling. Pair-Programmed-With: Andrew Bartlett --- source4/lib/ldb/common/ldb.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index 91429c2415..94fd6cde1e 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -779,6 +779,15 @@ int ldb_request(struct ldb_context *ldb, struct ldb_request *req) ret = module->ops->search(module, req); break; case LDB_ADD: + /* we have to canonicalise here, as so many places + * in modules and backends assume we don't have two + * elements with the same name */ + req->op.add.message = ldb_msg_canonicalize(ldb, req->op.add.message); + if (!req->op.add.message) { + ldb_oom(ldb); + return LDB_ERR_OPERATIONS_ERROR; + } + talloc_steal(req, req->op.add.message); FIRST_OP(ldb, add); ret = module->ops->add(module, req); break; -- cgit