summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-12-17 14:20:35 +1100
committerAndrew Tridgell <tridge@samba.org>2009-12-18 21:03:39 +1100
commit20869a0bf0758936b31dc648db7c1ee435dadc34 (patch)
tree3a6af8900728ebdaef8832d3ed2c635ec8a2d98a /source4
parent7cb858e1516e7900fddc08d8f69dfa8d003a587f (diff)
downloadsamba-20869a0bf0758936b31dc648db7c1ee435dadc34.tar.gz
samba-20869a0bf0758936b31dc648db7c1ee435dadc34.tar.bz2
samba-20869a0bf0758936b31dc648db7c1ee435dadc34.zip
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 <abartlet@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/ldb/common/ldb.c9
1 files changed, 9 insertions, 0 deletions
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;