[SCM] Samba Shared Repository - branch master updated

Kamen Mazdrashki kamenim at samba.org
Mon Feb 28 19:46:01 MST 2011


The branch, master has been updated
       via  b1f68b6 s4-libnet_vampire: Ignore some attributes when building working schema cache
       via  fb7975d s4-repl/working_schema: Ignore some attributes when bulding working schema cache
       via  f518dbc s4-replicated_objects: Implement a mechanism to relax some attributes conversion
      from  ec1009f s3-debug Always use C99 true/false rather than True and False

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


- Log -----------------------------------------------------------------
commit b1f68b68717bbcddf81ba7776faaef52f424043b
Author: Kamen Mazdrashki <kamenim at samba.org>
Date:   Tue Mar 1 02:32:19 2011 +0200

    s4-libnet_vampire: Ignore some attributes when building working schema cache
    
    Working schema cache will be used to convert replicated Schema objects
    again later, i.e. used as reference, so we don't need to resolve all
    attribute OIDs for working Schema cache to be usable.
    
    Autobuild-User: Kamen Mazdrashki <kamenim at samba.org>
    Autobuild-Date: Tue Mar  1 03:45:16 CET 2011 on sn-devel-104

commit fb7975d590e341a8d301a21e0c4957a376ee6fb0
Author: Kamen Mazdrashki <kamenim at samba.org>
Date:   Tue Mar 1 02:30:12 2011 +0200

    s4-repl/working_schema: Ignore some attributes when bulding working schema cache
    
    We don't need all object attributes resolved and converted for a working
    schema to be functional.

commit f518dbc0897ba89b8fba1b6cd839e1f36c3c8126
Author: Kamen Mazdrashki <kamenim at samba.org>
Date:   Tue Mar 1 02:25:24 2011 +0200

    s4-replicated_objects: Implement a mechanism to relax some attributes conversion
    
    during replicated object convert stage.
    The problem is that we may have loops in schema graph and we can't
    resolve those loops in just one pass. Ignoring some attributes
    conversion will allow us to have a functional schema cache that we
    can use later to resolve all attribute OIDs on another pass

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

Summary of changes:
 source4/dsdb/repl/replicated_objects.c |   44 +++++++++++++++++++++++++++++---
 source4/libnet/libnet_vampire.c        |    9 ++++++
 2 files changed, 49 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/dsdb/repl/replicated_objects.c b/source4/dsdb/repl/replicated_objects.c
index bbfcfd8..d11de92 100644
--- a/source4/dsdb/repl/replicated_objects.c
+++ b/source4/dsdb/repl/replicated_objects.c
@@ -61,6 +61,14 @@ WERROR dsdb_repl_make_working_schema(struct ldb_context *ldb,
 	struct dsdb_schema *working_schema;
 	const struct drsuapi_DsReplicaObjectListItemEx *cur;
 	int ret, pass_no;
+	uint32_t ignore_attids[] = {
+			DRSUAPI_ATTID_auxiliaryClass,
+			DRSUAPI_ATTID_mayContain,
+			DRSUAPI_ATTID_mustContain,
+			DRSUAPI_ATTID_possSuperiors,
+			DRSUAPI_ATTID_systemPossSuperiors,
+			DRSUAPI_ATTID_INVALID
+	};
 
 	/* make a copy of the iniatial_scheam so we don't mess with it */
 	working_schema = dsdb_schema_copy_shallow(mem_ctx, ldb, initial_schema);
@@ -111,6 +119,7 @@ WERROR dsdb_repl_make_working_schema(struct ldb_context *ldb,
 			 */
 			werr = dsdb_convert_object_ex(ldb, working_schema, pfm_remote,
 						      cur, gensec_skey,
+						      ignore_attids,
 						      tmp_ctx, &object);
 			if (!W_ERROR_IS_OK(werr)) {
 				DEBUG(1,("Warning: Failed to convert schema object %s into ldb msg\n",
@@ -163,11 +172,26 @@ WERROR dsdb_repl_make_working_schema(struct ldb_context *ldb,
 	return WERR_OK;
 }
 
+static bool dsdb_attid_in_list(const uint32_t attid_list[], uint32_t attid)
+{
+	const uint32_t *cur;
+	if (!attid_list) {
+		return false;
+	}
+	for (cur = attid_list; *cur != DRSUAPI_ATTID_INVALID; cur++) {
+		if (*cur == attid) {
+			return true;
+		}
+	}
+	return false;
+}
+
 WERROR dsdb_convert_object_ex(struct ldb_context *ldb,
 			      const struct dsdb_schema *schema,
 			      const struct dsdb_schema_prefixmap *pfm_remote,
 			      const struct drsuapi_DsReplicaObjectListItemEx *in,
 			      const DATA_BLOB *gensec_skey,
+			      const uint32_t *ignore_attids,
 			      TALLOC_CTX *mem_ctx,
 			      struct dsdb_extended_replicated_object *out)
 {
@@ -189,6 +213,7 @@ WERROR dsdb_convert_object_ex(struct ldb_context *ldb,
 	struct replPropertyMetaData1 *rdn_m = NULL;
 	struct dom_sid *sid = NULL;
 	uint32_t rid = 0;
+	uint32_t attr_count;
 	int ret;
 
 	if (!in->object.identifier) {
@@ -243,7 +268,7 @@ WERROR dsdb_convert_object_ex(struct ldb_context *ldb,
 					       md->ctr.ctr1.count + 1); /* +1 because of the RDN attribute */
 	W_ERROR_HAVE_NO_MEMORY(md->ctr.ctr1.array);
 
-	for (i=0; i < in->meta_data_ctr->count; i++) {
+	for (i=0, attr_count=0; i < in->meta_data_ctr->count; i++, attr_count++) {
 		struct drsuapi_DsReplicaAttribute *a;
 		struct drsuapi_DsReplicaMetaData *d;
 		struct replPropertyMetaData1 *m;
@@ -252,8 +277,13 @@ WERROR dsdb_convert_object_ex(struct ldb_context *ldb,
 
 		a = &in->object.attribute_ctr.attributes[i];
 		d = &in->meta_data_ctr->meta_data[i];
-		m = &md->ctr.ctr1.array[i];
-		e = &msg->elements[i];
+		m = &md->ctr.ctr1.array[attr_count];
+		e = &msg->elements[attr_count];
+
+		if (dsdb_attid_in_list(ignore_attids, a->attid)) {
+			attr_count--;
+			continue;
+		}
 
 		for (j=0; j<a->value_ctr.num_values; j++) {
 			status = drsuapi_decrypt_attribute(a->value_ctr.values[j].blob, gensec_skey, rid, a);
@@ -278,10 +308,15 @@ WERROR dsdb_convert_object_ex(struct ldb_context *ldb,
 		if (a->attid == DRSUAPI_ATTID_name) {
 			name_a = a;
 			name_d = d;
-			rdn_m = &md->ctr.ctr1.array[md->ctr.ctr1.count];
 		}
 	}
 
+	msg->num_elements = attr_count;
+	md->ctr.ctr1.count = attr_count;
+	if (name_a) {
+		rdn_m = &md->ctr.ctr1.array[md->ctr.ctr1.count];
+	}
+
 	if (rdn_m) {
 		struct ldb_message_element *el;
 		el = ldb_msg_find_element(msg, rdn_attr->lDAPDisplayName);
@@ -412,6 +447,7 @@ WERROR dsdb_replicated_objects_convert(struct ldb_context *ldb,
 
 		status = dsdb_convert_object_ex(ldb, schema, pfm_remote,
 						cur, gensec_skey,
+						NULL,
 						out->objects, &out->objects[i]);
 		if (!W_ERROR_IS_OK(status)) {
 			talloc_free(out);
diff --git a/source4/libnet/libnet_vampire.c b/source4/libnet/libnet_vampire.c
index 91a11ee..80b1a61 100644
--- a/source4/libnet/libnet_vampire.c
+++ b/source4/libnet/libnet_vampire.c
@@ -246,6 +246,14 @@ static NTSTATUS libnet_vampire_cb_apply_schema(struct libnet_vampire_cb_state *s
 	int ret, pass_no;
 	bool ok;
 	uint64_t seq_num;
+	uint32_t ignore_attids[] = {
+			DRSUAPI_ATTID_auxiliaryClass,
+			DRSUAPI_ATTID_mayContain,
+			DRSUAPI_ATTID_mustContain,
+			DRSUAPI_ATTID_possSuperiors,
+			DRSUAPI_ATTID_systemPossSuperiors,
+			DRSUAPI_ATTID_INVALID
+	};
 
 	DEBUG(0,("Analyze and apply schema objects\n"));
 
@@ -349,6 +357,7 @@ static NTSTATUS libnet_vampire_cb_apply_schema(struct libnet_vampire_cb_state *s
 			 */
 			status = dsdb_convert_object_ex(s->ldb, working_schema, pfm_remote,
 							cur, c->gensec_skey,
+							ignore_attids,
 							tmp_ctx, &object);
 			if (!W_ERROR_IS_OK(status)) {
 				DEBUG(1,("Warning: Failed to convert schema object %s into ldb msg\n",


-- 
Samba Shared Repository


More information about the samba-cvs mailing list