[SCM] Samba Shared Repository - branch master updated

Matthias Dieter Wallnöfer mdw at samba.org
Mon Oct 25 03:49:02 MDT 2010


The branch, master has been updated
       via  e24cd13 s4:samldb LDB module - fix indentations
       via  edab363 s4:samldb LDB module - use "uint32_t" for available krbtgt number
       via  9e6d07e s4:samldb LDB module - assign better memory contexts in some cases
      from  adcfda9 s3-waf: implement LIBMSRPC_GEN as tiny wrapper of 'NDR_STANDARD NDR_DSSETUP NDR_SPOOLSS'

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


- Log -----------------------------------------------------------------
commit e24cd13e40fa3ce867654cfea70369ba627351d8
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Mon Oct 25 11:05:22 2010 +0200

    s4:samldb LDB module - fix indentations
    
    Autobuild-User: Matthias Dieter Wallnöfer <mdw at samba.org>
    Autobuild-Date: Mon Oct 25 09:48:15 UTC 2010 on sn-devel-104

commit edab363466256ab0357e4e43f2e38b25a509d711
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Mon Oct 25 11:02:34 2010 +0200

    s4:samldb LDB module - use "uint32_t" for available krbtgt number

commit 9e6d07e1b32d3050cc3574f658be1ea6ff4e87d8
Author: Matthias Dieter Wallnöfer <mdw at samba.org>
Date:   Mon Oct 25 10:55:11 2010 +0200

    s4:samldb LDB module - assign better memory contexts in some cases

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

Summary of changes:
 source4/dsdb/samdb/ldb_modules/samldb.c |   73 +++++++++++++++++++------------
 1 files changed, 45 insertions(+), 28 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index 2357ffd..8a420f4 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -132,8 +132,8 @@ static int samldb_next_step(struct samldb_ctx *ac)
 		return ac->curstep->fn(ac);
 	}
 
-	/* we exit the samldb module here */
-	/* If someone set an ares to forward controls and response back to the caller, use them */
+	/* We exit the samldb module here. If someone set an "ares" to forward
+	 * controls and response back to the caller, use them. */
 	if (ac->ares) {
 		return ldb_module_done(ac->req, ac->ares->controls,
 				       ac->ares->response, LDB_SUCCESS);
@@ -145,7 +145,8 @@ static int samldb_next_step(struct samldb_ctx *ac)
 
 /* sAMAccountName handling */
 
-static int samldb_generate_sAMAccountName(struct ldb_context *ldb, struct ldb_message *msg)
+static int samldb_generate_sAMAccountName(struct ldb_context *ldb,
+					  struct ldb_message *msg)
 {
 	char *name;
 
@@ -236,16 +237,19 @@ static int samldb_allocate_sid(struct samldb_ctx *ac)
 /*
   see if a krbtgt_number is available
  */
-static bool samldb_krbtgtnumber_available(struct samldb_ctx *ac, unsigned krbtgt_number)
+static bool samldb_krbtgtnumber_available(struct samldb_ctx *ac,
+					  uint32_t krbtgt_number)
 {
 	TALLOC_CTX *tmp_ctx = talloc_new(ac);
 	struct ldb_result *res;
-	const char *attrs[] = { NULL };
+	const char *no_attrs[] = { NULL };
 	int ret;
 
-	ret = dsdb_module_search(ac->module, tmp_ctx, &res, NULL, LDB_SCOPE_SUBTREE,
-				 attrs, DSDB_FLAG_NEXT_MODULE,
-				 "msDC-SecondaryKrbTgtNumber=%u", krbtgt_number);
+	ret = dsdb_module_search(ac->module, tmp_ctx, &res, NULL,
+				 LDB_SCOPE_SUBTREE, no_attrs,
+				 DSDB_FLAG_NEXT_MODULE,
+				 "(msDC-SecondaryKrbTgtNumber=%u)",
+				 krbtgt_number);
 	if (ret == LDB_SUCCESS && res->count == 0) {
 		talloc_free(tmp_ctx);
 		return true;
@@ -287,7 +291,8 @@ static int samldb_rodc_add(struct samldb_ctx *ac)
 	return LDB_ERR_OTHER;
 
 found:
-	ret = ldb_msg_add_empty(ac->msg, "msDS-SecondaryKrbTgtNumber", LDB_FLAG_INTERNAL_DISABLE_VALIDATION, NULL);
+	ret = ldb_msg_add_empty(ac->msg, "msDS-SecondaryKrbTgtNumber",
+				LDB_FLAG_INTERNAL_DISABLE_VALIDATION, NULL);
 	if (ret != LDB_SUCCESS) {
 		return ldb_operr(ldb);
 	}
@@ -298,12 +303,13 @@ found:
 		return ldb_operr(ldb);
 	}
 
-	ret = ldb_msg_add_fmt(ac->msg, "sAMAccountName", "krbtgt_%u", krbtgt_number);
+	ret = ldb_msg_add_fmt(ac->msg, "sAMAccountName", "krbtgt_%u",
+			      krbtgt_number);
 	if (ret != LDB_SUCCESS) {
 		return ldb_operr(ldb);
 	}
 
-	newpass = generate_random_password(ac, 128, 255);
+	newpass = generate_random_password(ac->msg, 128, 255);
 	if (newpass == NULL) {
 		return ldb_operr(ldb);
 	}
@@ -327,7 +333,8 @@ static int samldb_find_for_defaultObjectCategory(struct samldb_ctx *ac)
 
 	ret = dsdb_module_search(ac->module, ac, &res,
 				 ac->dn, LDB_SCOPE_BASE, no_attrs,
-				 DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT | DSDB_FLAG_NEXT_MODULE,
+				 DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT
+				 | DSDB_FLAG_NEXT_MODULE,
 				 "(objectClass=classSchema)");
 	if (ret == LDB_ERR_NO_SUCH_OBJECT) {
 		/* Don't be pricky when the DN doesn't exist if we have the */
@@ -367,7 +374,8 @@ static int samldb_add_handle_msDS_IntId(struct samldb_ctx *ac)
 	schema_dn = ldb_get_schema_basedn(ldb);
 
 	/* replicated update should always go through */
-	if (ldb_request_get_control(ac->req, DSDB_CONTROL_REPLICATED_UPDATE_OID)) {
+	if (ldb_request_get_control(ac->req,
+				    DSDB_CONTROL_REPLICATED_UPDATE_OID)) {
 		return LDB_SUCCESS;
 	}
 
@@ -502,7 +510,8 @@ static bool check_rodc_critical_attribute(struct ldb_message *msg)
 
 	schemaFlagsEx = ldb_msg_find_attr_as_uint(msg, "schemaFlagsEx", 0);
 	searchFlags = ldb_msg_find_attr_as_uint(msg, "searchFlags", 0);
-	rodc_filtered_flags = (SEARCH_FLAG_RODC_ATTRIBUTE | SEARCH_FLAG_CONFIDENTIAL);
+	rodc_filtered_flags = (SEARCH_FLAG_RODC_ATTRIBUTE
+			      | SEARCH_FLAG_CONFIDENTIAL);
 
 	if ((schemaFlagsEx & SCHEMA_FLAG_ATTR_IS_CRITICAL) &&
 		((searchFlags & rodc_filtered_flags) == rodc_filtered_flags)) {
@@ -563,8 +572,8 @@ static int samldb_fill_object(struct samldb_ctx *ac)
 		if (!ldb_msg_find_element(ac->msg, "lDAPDisplayName")) {
 			/* the RDN has prefix "CN" */
 			ret = ldb_msg_add_string(ac->msg, "lDAPDisplayName",
-				samdb_cn_to_lDAPDisplayName(ac,
-					(const char *) rdn_value->data));
+				samdb_cn_to_lDAPDisplayName(ac->msg,
+							    (const char *) rdn_value->data));
 			if (ret != LDB_SUCCESS) {
 				ldb_oom(ldb);
 				return ret;
@@ -605,7 +614,7 @@ static int samldb_fill_object(struct samldb_ctx *ac)
 			ac->dn = ac->msg->dn;
 
 			ret = ldb_msg_add_string(ac->msg, "defaultObjectCategory",
-						 ldb_dn_alloc_linearized(ac, ac->dn));
+						 ldb_dn_alloc_linearized(ac->msg, ac->dn));
 			if (ret != LDB_SUCCESS) {
 				ldb_oom(ldb);
 				return ret;
@@ -627,7 +636,7 @@ static int samldb_fill_object(struct samldb_ctx *ac)
 			/* the RDN has prefix "CN" */
 			ret = ldb_msg_add_string(ac->msg, "lDAPDisplayName",
 				samdb_cn_to_lDAPDisplayName(ac->msg,
-					(const char *) rdn_value->data));
+							    (const char *) rdn_value->data));
 			if (ret != LDB_SUCCESS) {
 				ldb_oom(ldb);
 				return ret;
@@ -710,7 +719,8 @@ static int samldb_schema_info_update(struct samldb_ctx *ac)
 	struct dsdb_schema *schema;
 
 	/* replicated update should always go through */
-	if (ldb_request_get_control(ac->req, DSDB_CONTROL_REPLICATED_UPDATE_OID)) {
+	if (ldb_request_get_control(ac->req,
+				    DSDB_CONTROL_REPLICATED_UPDATE_OID)) {
 		return LDB_SUCCESS;
 	}
 
@@ -728,7 +738,8 @@ static int samldb_schema_info_update(struct samldb_ctx *ac)
 		return ldb_operr(ldb);
 	}
 
-	ret = dsdb_module_schema_info_update(ac->module, schema, DSDB_FLAG_NEXT_MODULE);
+	ret = dsdb_module_schema_info_update(ac->module, schema,
+					     DSDB_FLAG_NEXT_MODULE);
 	if (ret != LDB_SUCCESS) {
 		ldb_asprintf_errstring(ldb, "samldb_schema_info_update: dsdb_module_schema_info_update failed with %s",
 				       ldb_errstring(ldb));
@@ -1055,7 +1066,7 @@ static int samldb_prim_group_change(struct samldb_ctx *ac)
 		msg = talloc_zero(ac, struct ldb_message);
 		msg->dn = new_prim_group_dn;
 
-		ret = samdb_msg_add_delval(ldb, ac, msg, "member",
+		ret = samdb_msg_add_delval(ldb, msg, msg, "member",
 					   ldb_dn_get_linearized(ac->msg->dn));
 		if (ret != LDB_SUCCESS) {
 			return ret;
@@ -1070,7 +1081,7 @@ static int samldb_prim_group_change(struct samldb_ctx *ac)
 		msg = talloc_zero(ac, struct ldb_message);
 		msg->dn = prev_prim_group_dn;
 
-		ret = samdb_msg_add_addval(ldb, ac, msg, "member",
+		ret = samdb_msg_add_addval(ldb, msg, msg, "member",
 					   ldb_dn_get_linearized(ac->msg->dn));
 		if (ret != LDB_SUCCESS) {
 			return ret;
@@ -1285,7 +1296,8 @@ static int samldb_modify(struct ldb_module *module, struct ldb_request *req)
 	/* msDS-IntId is not allowed to be modified
 	 * except when modification comes from replication */
 	if (ldb_msg_find_element(req->op.mod.message, "msDS-IntId")) {
-		if (!ldb_request_get_control(req, DSDB_CONTROL_REPLICATED_UPDATE_OID)) {
+		if (!ldb_request_get_control(req,
+					     DSDB_CONTROL_REPLICATED_UPDATE_OID)) {
 			return LDB_ERR_CONSTRAINT_VIOLATION;
 		}
 	}
@@ -1305,7 +1317,8 @@ static int samldb_modify(struct ldb_module *module, struct ldb_request *req)
 	}
 
 	el = ldb_msg_find_element(ac->msg, "groupType");
-	if (el && (LDB_FLAG_MOD_TYPE(el->flags) == LDB_FLAG_MOD_REPLACE) && el->num_values == 1) {
+	if (el && (LDB_FLAG_MOD_TYPE(el->flags) == LDB_FLAG_MOD_REPLACE)
+	    && el->num_values == 1) {
 		uint32_t group_type, old_group_type;
 
 		modified = true;
@@ -1373,7 +1386,8 @@ static int samldb_modify(struct ldb_module *module, struct ldb_request *req)
 	}
 
 	el = ldb_msg_find_element(ac->msg, "primaryGroupID");
-	if (el && (LDB_FLAG_MOD_TYPE(el->flags) == LDB_FLAG_MOD_REPLACE) && el->num_values == 1) {
+	if (el && (LDB_FLAG_MOD_TYPE(el->flags) == LDB_FLAG_MOD_REPLACE)
+	    && el->num_values == 1) {
 		modified = true;
 
 		ret = samldb_prim_group_change(ac);
@@ -1387,7 +1401,8 @@ static int samldb_modify(struct ldb_module *module, struct ldb_request *req)
 	}
 
 	el = ldb_msg_find_element(ac->msg, "userAccountControl");
-	if (el && (LDB_FLAG_MOD_TYPE(el->flags) == LDB_FLAG_MOD_REPLACE) && el->num_values == 1) {
+	if (el && (LDB_FLAG_MOD_TYPE(el->flags) == LDB_FLAG_MOD_REPLACE)
+	    && el->num_values == 1) {
 		uint32_t user_account_control;
 
 		modified = true;
@@ -1446,7 +1461,8 @@ static int samldb_modify(struct ldb_module *module, struct ldb_request *req)
 	}
 
 	el = ldb_msg_find_element(ac->msg, "member");
-	if (el && el->flags & (LDB_FLAG_MOD_ADD|LDB_FLAG_MOD_REPLACE) && el->num_values == 1) {
+	if (el && el->flags & (LDB_FLAG_MOD_ADD|LDB_FLAG_MOD_REPLACE)
+	    && el->num_values == 1) {
 		ret = samldb_member_check(ac);
 		if (ret != LDB_SUCCESS) {
 			return ret;
@@ -1551,7 +1567,8 @@ static int samldb_extended_allocate_rid_pool(struct ldb_module *module, struct l
 	struct dsdb_fsmo_extended_op *exop;
 	int ret;
 
-	exop = talloc_get_type(req->op.extended.data, struct dsdb_fsmo_extended_op);
+	exop = talloc_get_type(req->op.extended.data,
+			       struct dsdb_fsmo_extended_op);
 	if (!exop) {
 		ldb_debug(ldb, LDB_DEBUG_FATAL, "samldb_extended_allocate_rid_pool: invalid extended data\n");
 		return LDB_ERR_PROTOCOL_ERROR;


-- 
Samba Shared Repository


More information about the samba-cvs mailing list