summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-08-13 15:33:49 +0200
committerStefan Metzmacher <metze@samba.org>2012-08-14 10:47:26 +0200
commit0b926a27d8984a3e8ad9cefa49981f9ab2dd6480 (patch)
treeda0f00c165f0d4c211e220453d925ca416c74fc1
parentd81d6afd6f0d661b836885f57ab397c1e905a90b (diff)
downloadsamba-0b926a27d8984a3e8ad9cefa49981f9ab2dd6480.tar.gz
samba-0b926a27d8984a3e8ad9cefa49981f9ab2dd6480.tar.bz2
samba-0b926a27d8984a3e8ad9cefa49981f9ab2dd6480.zip
s4:dsdb/repl: make sure instanceType_e is not changed by a reallocation
Pair-Programmed-With: Björn Baumbach <bb@sernet.de> metze
-rw-r--r--source4/dsdb/repl/replicated_objects.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c
index cd664e3656..91ca4b89a2 100644
--- a/source4/dsdb/repl/replicated_objects.c
+++ b/source4/dsdb/repl/replicated_objects.c
@@ -372,7 +372,6 @@ WERROR dsdb_convert_object_ex(struct ldb_context *ldb,
must be used on the client with TYPE_WRITE removed
*/
if (instanceType & INSTANCE_TYPE_WRITE) {
- instanceType &= ~INSTANCE_TYPE_WRITE;
/*
* Make sure we do not change the order
* of msg->elements!
@@ -382,7 +381,18 @@ WERROR dsdb_convert_object_ex(struct ldb_context *ldb,
* instead of
* ldb_msg_remove_attr(msg, "instanceType");
*/
+ struct ldb_message_element *e;
+
+ e = ldb_msg_find_element(msg, "instanceType");
+ if (e != instanceType_e) {
+ DEBUG(0,("instanceType_e[%p] changed to e[%p]\n",
+ instanceType_e, e));
+ return WERR_FOOBAR;
+ }
+
instanceType_e->num_values = 0;
+
+ instanceType &= ~INSTANCE_TYPE_WRITE;
if (ldb_msg_add_fmt(msg, "instanceType", "%d", instanceType) != LDB_SUCCESS) {
return WERR_INTERNAL_ERROR;
}