From 31aeb841c9823574cb6f13986f4da34d00bb40a1 Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Fri, 16 Jul 2010 14:18:14 +0300 Subject: s4-dsdb: use ldb_msg_normalize() in ldb_msg_difference() Signed-off-by: Andrew Bartlett --- source4/lib/ldb/common/ldb_msg.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'source4/lib/ldb/common/ldb_msg.c') diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c index a643004605..8cf2584413 100644 --- a/source4/lib/ldb/common/ldb_msg.c +++ b/source4/lib/ldb/common/ldb_msg.c @@ -705,15 +705,17 @@ int ldb_msg_difference(struct ldb_context *ldb, mod->num_elements = 0; mod->elements = NULL; - /* canonicalize msg2 so we have no repeated elements */ - msg2 = ldb_msg_canonicalize(ldb, msg2); - if (msg2 == NULL) { + /* + * Canonicalize *msg2 so we have no repeated elements + * Resulting message is allocated in *mod's mem context, + * as we are going to move some elements from *msg2 to + * *mod object later + */ + ldb_res = ldb_msg_normalize(ldb, mod, msg2, &msg2); + if (ldb_res != LDB_SUCCESS) { goto failed; } - /* steal msg2 into mod context as it is allocated in ldb's context */ - talloc_steal(mod, msg2); - /* look in msg2 to find elements that need to be added or modified */ for (i=0;inum_elements;i++) { el = ldb_msg_find_element(msg1, msg2->elements[i].name); -- cgit