[SCM] Samba Shared Repository - branch master updated

Matthias Dieter Wallnöfer mdw at samba.org
Sun Nov 7 03:12:01 MST 2010


The branch, master has been updated
       via  d6d5f80 ldb:ldb_pack.c - the "dn" attribute isn't allowed in the message part, only the "distinguishedName" one
       via  dbf747b s4:torture/dssync.c - remove unused variable
       via  7813fc4 s4:descriptor LDB module - save a pointer to the request message on the temporary "ac" context
       via  75ea7bd s4:descriptor LDB module - by "dsdb_next_callback" we don't need anymore the default operation callback implementations
       via  3b52902 s4:descriptor LDB module - remove a bit pointless memory context
       via  d58a4c5 s4:descriptor LDB module - remove a "ldb_msg_sanity_check" call
       via  f1a8fbf s4:descriptor LDB module - don't ignore referrals if we are executing an ordinary external search operation
      from  4217734 credentials: Lowercase library name,

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


- Log -----------------------------------------------------------------
commit d6d5f80348c949c2b4984b9f211d1fff02b50948
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Sun Nov 7 10:04:22 2010 +0100

    ldb:ldb_pack.c - the "dn" attribute isn't allowed in the message part, only the "distinguishedName" one
    
    Autobuild-User: Matthias Dieter Wallnöfer <mdw at samba.org>
    Autobuild-Date: Sun Nov  7 10:11:02 UTC 2010 on sn-devel-104

commit dbf747b6ffdb3e14a10fa920eefbfa8c2a8dbfcf
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Sun Nov 7 09:55:19 2010 +0100

    s4:torture/dssync.c - remove unused variable

commit 7813fc4a0e48c40487f80eac9191fbc43508344e
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Sat Nov 6 23:04:55 2010 +0100

    s4:descriptor LDB module - save a pointer to the request message on the temporary "ac" context
    
    This prevents two calls of "ldb_msg_copy_shallow".

commit 75ea7bd0045823765e2619456bc79f01e2651345
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Sat Nov 6 22:49:08 2010 +0100

    s4:descriptor LDB module - by "dsdb_next_callback" we don't need anymore the default operation callback implementations
    
    Only customised ones still need to remain.

commit 3b52902c1924606a3102a8fe92c835d387ade92e
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Sat Nov 6 22:39:40 2010 +0100

    s4:descriptor LDB module - remove a bit pointless memory context
    
    For only one operation we do not need an additional "mem_ctx". "ac" should be
    enough (see for example the samldb LDB module).

commit d58a4c55c1564a1b546a79631c1cc2fa5dcba523
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Sat Nov 6 22:38:15 2010 +0100

    s4:descriptor LDB module - remove a "ldb_msg_sanity_check" call
    
    This check (the structural objectclass) is performed in the objectclass LDB
    module.

commit f1a8fbfc980d648253e96bee88676b7ce478c1de
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Sat Nov 6 22:27:13 2010 +0100

    s4:descriptor LDB module - don't ignore referrals if we are executing an ordinary external search operation
    
    Referrals are valid results.

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

Summary of changes:
 source4/dsdb/samdb/ldb_modules/descriptor.c |  122 ++++++++-------------------
 source4/lib/ldb/ldb_tdb/ldb_pack.c          |    2 -
 source4/torture/drs/rpc/dssync.c            |    1 -
 3 files changed, 37 insertions(+), 88 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/dsdb/samdb/ldb_modules/descriptor.c b/source4/dsdb/samdb/ldb_modules/descriptor.c
index 9b950af..731b7bc 100644
--- a/source4/dsdb/samdb/ldb_modules/descriptor.c
+++ b/source4/dsdb/samdb/ldb_modules/descriptor.c
@@ -51,6 +51,7 @@ struct descriptor_data {
 struct descriptor_context {
 	struct ldb_module *module;
 	struct ldb_request *req;
+	struct ldb_message *msg;
 	struct ldb_reply *search_res;
 	struct ldb_reply *search_oc_res;
 	struct ldb_val *parentsd_val;
@@ -477,37 +478,6 @@ static int get_search_oc_callback(struct ldb_request *req, struct ldb_reply *are
 	return LDB_SUCCESS;
 }
 
-
-static int descriptor_op_callback(struct ldb_request *req, struct ldb_reply *ares)
-{
-	struct descriptor_context *ac;
-
-	ac = talloc_get_type(req->context, struct descriptor_context);
-
-	if (!ares) {
-		return ldb_module_done(ac->req, NULL, NULL,
-					LDB_ERR_OPERATIONS_ERROR);
-	}
-
-	if (ares->type == LDB_REPLY_REFERRAL) {
-		return ldb_module_send_referral(ac->req, ares->referral);
-	}
-
-	if (ares->error != LDB_SUCCESS) {
-		return ldb_module_done(ac->req, ares->controls,
-					ares->response, ares->error);
-	}
-
-	if (ares->type != LDB_REPLY_DONE) {
-		talloc_free(ares);
-		return ldb_module_done(ac->req, NULL, NULL,
-					LDB_ERR_OPERATIONS_ERROR);
-	}
-
-	return ldb_module_done(ac->req, ares->controls,
-				ares->response, ares->error);
-}
-
 static int descriptor_search_callback(struct ldb_request *req, struct ldb_reply *ares)
 {
 	struct descriptor_context *ac;
@@ -566,17 +536,15 @@ static int descriptor_search_callback(struct ldb_request *req, struct ldb_reply
 		return ldb_module_send_entry(ac->req, ares->message, ares->controls);
 
 	case LDB_REPLY_REFERRAL:
-		/* ignore referrals */
-		break;
+		return ldb_module_send_referral(ac->req, ares->referral);
 
 	case LDB_REPLY_DONE:
 		return ldb_module_done(ac->req, ares->controls,
 					ares->response, ares->error);
 	}
 
-	talloc_free(ares);
-	return LDB_SUCCESS;
 fail:
+	talloc_free(ares);
 	return ldb_module_done(ac->req, NULL, NULL, ret);
 }
 
@@ -590,7 +558,6 @@ static int descriptor_do_mod(struct descriptor_context *ac)
 	int ret;
 	DATA_BLOB *sd;
 	const struct dsdb_class *objectclass;
-	struct ldb_message *msg;
 	struct ldb_control *sd_control;
 	struct ldb_control *sd_control2;
 	int flags = 0;
@@ -599,11 +566,6 @@ static int descriptor_do_mod(struct descriptor_context *ac)
 	ldb = ldb_module_get_ctx(ac->module);
 	schema = dsdb_get_schema(ldb, ac);
 
-	msg = ldb_msg_copy_shallow(ac, ac->req->op.mod.message);
-	if (msg == NULL) {
-		return ldb_module_oom(ac->module);
-	}
-
 	objectclass_element = ldb_msg_find_element(ac->search_oc_res->message,
 						   "objectClass");
 	if (objectclass_element == NULL) {
@@ -629,20 +591,23 @@ static int descriptor_do_mod(struct descriptor_context *ac)
 			oldsd_val = oldsd_el->values;
 		}
 	}
-	sd = get_new_descriptor(ac->module, msg->dn, ac, objectclass,
+	sd = get_new_descriptor(ac->module, ac->msg->dn, ac, objectclass,
 				ac->parentsd_val, ac->sd_val, oldsd_val, sd_flags);
 	if (ac->sd_val) {
-		tmp_element = ldb_msg_find_element(msg, "ntSecurityDescriptor");
+		tmp_element = ldb_msg_find_element(ac->msg,
+						   "nTSecurityDescriptor");
 		flags = tmp_element->flags;
-		ldb_msg_remove_attr(msg, "nTSecurityDescriptor");
+		ldb_msg_remove_attr(ac->msg, "nTSecurityDescriptor");
 	}
 
 	if (sd) {
-		ret = ldb_msg_add_steal_value(msg, "nTSecurityDescriptor", sd);
+		ret = ldb_msg_add_steal_value(ac->msg,
+					      "nTSecurityDescriptor", sd);
 		if (ret != LDB_SUCCESS) {
 			return ret;
 		}
-		tmp_element = ldb_msg_find_element(msg, "ntSecurityDescriptor");
+		tmp_element = ldb_msg_find_element(ac->msg,
+						   "nTSecurityDescriptor");
 		if (sd_control2) {
 			tmp_element->flags = LDB_FLAG_MOD_REPLACE;
 		} else {
@@ -650,9 +615,9 @@ static int descriptor_do_mod(struct descriptor_context *ac)
 		}
 	}
 	ret = ldb_build_mod_req(&mod_req, ldb, ac,
-				msg,
+				ac->msg,
 				ac->req->controls,
-				ac, descriptor_op_callback,
+				ac->req, dsdb_next_callback,
 				ac->req);
 	LDB_REQ_SET_LOCATION(mod_req);
 	if (ret != LDB_SUCCESS) {
@@ -673,8 +638,6 @@ static int descriptor_do_add(struct descriptor_context *ac)
 	const struct dsdb_schema *schema;
 	struct ldb_request *add_req;
 	struct ldb_message_element *objectclass_element, *sd_element = NULL;
-	struct ldb_message *msg;
-	TALLOC_CTX *mem_ctx;
 	int ret;
 	DATA_BLOB *sd;
 	const struct dsdb_class *objectclass;
@@ -684,19 +647,15 @@ static int descriptor_do_add(struct descriptor_context *ac)
 	ldb = ldb_module_get_ctx(ac->module);
 	schema = dsdb_get_schema(ldb, ac);
 
-	mem_ctx = talloc_new(ac);
-	if (mem_ctx == NULL) {
-		return ldb_module_oom(ac->module);
-	}
-
 	switch (ac->req->operation) {
 	case LDB_ADD:
-		msg = ldb_msg_copy_shallow(ac, ac->req->op.add.message);
-		if (msg == NULL) {
+		ac->msg = ldb_msg_copy_shallow(ac, ac->req->op.add.message);
+		if (ac->msg == NULL) {
 			return ldb_module_oom(ac->module);
 		}
 
-		objectclass_element = ldb_msg_find_element(msg, "objectClass");
+		objectclass_element = ldb_msg_find_element(ac->msg,
+							   "objectClass");
 		if (objectclass_element == NULL) {
 			return ldb_operr(ldb);
 		}
@@ -708,8 +667,8 @@ static int descriptor_do_add(struct descriptor_context *ac)
 		}
 		break;
 	case LDB_MODIFY:
-		msg = ldb_msg_copy_shallow(ac, ac->req->op.mod.message);
-		if (msg == NULL) {
+		ac->msg = ldb_msg_copy_shallow(ac, ac->req->op.mod.message);
+		if (ac->msg == NULL) {
 			return ldb_module_oom(ac->module);
 		}
 		break;
@@ -719,15 +678,15 @@ static int descriptor_do_add(struct descriptor_context *ac)
 
 
 	/* get the security descriptor values*/
-	sd_element = ldb_msg_find_element(msg, "nTSecurityDescriptor");
+	sd_element = ldb_msg_find_element(ac->msg, "nTSecurityDescriptor");
 	if (sd_element) {
 		ac->sd_val = talloc_memdup(ac, &sd_element->values[0], sizeof(struct ldb_val));
 	}
 	/* NC's have no parent */
 	/* FIXME: this has to be made dynamic at some point */
-	if ((ldb_dn_compare(msg->dn, (ldb_get_schema_basedn(ldb))) == 0) ||
-	    (ldb_dn_compare(msg->dn, (ldb_get_config_basedn(ldb))) == 0) ||
-	    (ldb_dn_compare(msg->dn, (ldb_get_default_basedn(ldb))) == 0)) {
+	if ((ldb_dn_compare(ac->msg->dn, (ldb_get_schema_basedn(ldb))) == 0) ||
+	    (ldb_dn_compare(ac->msg->dn, (ldb_get_config_basedn(ldb))) == 0) ||
+	    (ldb_dn_compare(ac->msg->dn, (ldb_get_default_basedn(ldb))) == 0)) {
 		ac->parentsd_val = NULL;
 	} else if (ac->search_res != NULL) {
 		struct ldb_message_element *parent_element = ldb_msg_find_element(ac->search_res->message, "nTSecurityDescriptor");
@@ -740,32 +699,25 @@ static int descriptor_do_add(struct descriptor_context *ac)
 		/* Get the parent descriptor and the one provided. If not
 		 * provided, get the default. Convert it to a security
 		 * descriptor and calculate the permissions. */
-		sd = get_new_descriptor(ac->module, msg->dn, mem_ctx, objectclass,
-					ac->parentsd_val, ac->sd_val, NULL, 0);
+		sd = get_new_descriptor(ac->module, ac->msg->dn, ac,
+					objectclass, ac->parentsd_val,
+					ac->sd_val, NULL, 0);
 		if (ac->sd_val) {
-			ldb_msg_remove_attr(msg, "nTSecurityDescriptor");
+			ldb_msg_remove_attr(ac->msg, "nTSecurityDescriptor");
 		}
 
 		if (sd) {
-			ret = ldb_msg_add_steal_value(msg, "nTSecurityDescriptor", sd);
+			ret = ldb_msg_add_steal_value(ac->msg,
+						      "nTSecurityDescriptor", sd);
 			if (ret != LDB_SUCCESS) {
 				return ret;
 			}
 		}
 
-		talloc_free(mem_ctx);
-		ret = ldb_msg_sanity_check(ldb, msg);
-
-		if (ret != LDB_SUCCESS) {
-			ldb_asprintf_errstring(ldb, "No last structural objectclass found on %s",
-					       ldb_dn_get_linearized(msg->dn));
-			return ret;
-		}
-
 		ret = ldb_build_add_req(&add_req, ldb, ac,
-					msg,
+					ac->msg,
 					ac->req->controls,
-					ac, descriptor_op_callback,
+					ac->req, dsdb_next_callback,
 					ac->req);
 		LDB_REQ_SET_LOCATION(add_req);
 		if (ret != LDB_SUCCESS) {
@@ -773,12 +725,12 @@ static int descriptor_do_add(struct descriptor_context *ac)
 		}
 		return ldb_next_request(ac->module, add_req);
 	} else {
-		ret = ldb_build_search_req(&search_req, ldb,
-				   ac, msg->dn, LDB_SCOPE_BASE,
-				   "(objectClass=*)", attrs,
-				   NULL,
-				   ac, get_search_oc_callback,
-				   ac->req);
+		ret = ldb_build_search_req(&search_req, ldb, ac,
+					   ac->msg->dn, LDB_SCOPE_BASE,
+					   "(objectClass=*)", attrs,
+					   NULL,
+					   ac, get_search_oc_callback,
+					   ac->req);
 		LDB_REQ_SET_LOCATION(search_req);
 		if (ret != LDB_SUCCESS) {
 			return ret;
diff --git a/source4/lib/ldb/ldb_tdb/ldb_pack.c b/source4/lib/ldb/ldb_tdb/ldb_pack.c
index 396b80a..8ab07cd 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_pack.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_pack.c
@@ -59,8 +59,6 @@ static int attribute_storable_values(const struct ldb_message_element *el)
 {
 	if (el->num_values == 0) return 0;
 
-	if (ldb_attr_cmp(el->name, "dn") == 0) return 0;
-
 	if (ldb_attr_cmp(el->name, "distinguishedName") == 0) return 0;
 
 	return el->num_values;
diff --git a/source4/torture/drs/rpc/dssync.c b/source4/torture/drs/rpc/dssync.c
index 7d1c4ff..db1703d 100644
--- a/source4/torture/drs/rpc/dssync.c
+++ b/source4/torture/drs/rpc/dssync.c
@@ -532,7 +532,6 @@ static bool test_analyse_objects(struct torture_context *tctx,
 		}
 
 		for (i=0; i < cur->object.attribute_ctr.num_attributes; i++) {
-			WERROR werr;
 			const char *name = NULL;
 			DATA_BLOB plain_data;
 			struct drsuapi_DsReplicaAttribute *attr;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list