[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Tue Aug 14 05:59:02 MDT 2012


The branch, master has been updated
       via  c47d73f s4:dsdb/repl: ldb_errstring() takes a 'struct ldb_context' not 'int'
       via  0b926a2 s4:dsdb/repl: make sure instanceType_e is not changed by a reallocation
       via  d81d6af s4:dsdb/repl: avoid reallocation of msg->elements
      from  9566786 s4-dsdb: Add mem_ctx argument to samdb_ntds_settings_dn

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c47d73f6c495d1585fa369c75da1173e78002da0
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Aug 14 10:46:26 2012 +0200

    s4:dsdb/repl: ldb_errstring() takes a 'struct ldb_context' not 'int'
    
    metze
    
    Autobuild-User(master): Stefan Metzmacher <metze at samba.org>
    Autobuild-Date(master): Tue Aug 14 13:58:31 CEST 2012 on sn-devel-104

commit 0b926a27d8984a3e8ad9cefa49981f9ab2dd6480
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Aug 13 15:33:49 2012 +0200

    s4:dsdb/repl: make sure instanceType_e is not changed by a reallocation
    
    Pair-Programmed-With: Björn Baumbach <bb at sernet.de>
    
    metze

commit d81d6afd6f0d661b836885f57ab397c1e905a90b
Author: Stefan Metzmacher <metze at samba.org>
Date:   Mon Aug 13 15:31:16 2012 +0200

    s4:dsdb/repl: avoid reallocation of msg->elements
    
    The index into the elements needs to match between
    msg->elements and md->ctr.ctr1.array, which means we should
    pre-allocate them with the same size.
    
    Pair-Programmed-With: Björn Baumbach <bb at sernet.de>
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 source4/dsdb/repl/replicated_objects.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c
index 564befe..829c440 100644
--- a/source4/dsdb/repl/replicated_objects.c
+++ b/source4/dsdb/repl/replicated_objects.c
@@ -258,7 +258,7 @@ WERROR dsdb_convert_object_ex(struct ldb_context *ldb,
 
 	msg->num_elements	= in->object.attribute_ctr.num_attributes;
 	msg->elements		= talloc_array(msg, struct ldb_message_element,
-					       msg->num_elements);
+					       msg->num_elements + 1); /* +1 because of the RDN attribute */
 	W_ERROR_HAVE_NO_MEMORY(msg->elements);
 
 	md = talloc(mem_ctx, struct replPropertyMetaDataBlob);
@@ -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;
 			}
@@ -752,7 +762,8 @@ WERROR dsdb_replicated_objects_commit(struct ldb_context *ldb,
 		if (ret == LDB_SUCCESS) {
 			ret = ldb_transaction_commit(ldb);
 		} else {
-			DEBUG(0, ("Schema update now failed: %s\n", ldb_errstring(ret)));
+			DEBUG(0, ("Schema update now failed: %s\n",
+				  ldb_errstring(ldb)));
 			ldb_transaction_cancel(ldb);
 		}
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list