[SCM] Samba Shared Repository - branch master updated

Matthias Dieter Wallnöfer mdw at samba.org
Sun Feb 21 13:45:26 MST 2010


The branch, master has been updated
       via  280a8a7... s4:operational LDB module - enable support for passing referrals through it
       via  c16d4fb... s4:partition DSDB module - Cosmetic fixups
       via  461987b... s4:password_hash - Fix up request message pointers
       via  eca8697... s4:dsdb/util.c - Use LDB result constants in some more helper functions
      from  f2eac3b... s4:provision.py - try to use other addresses than "127.0.0.x" and "::1"

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


- Log -----------------------------------------------------------------
commit 280a8a70fdf362fbd94308f8dcb6ba7ae0a6db88
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date:   Sun Feb 21 11:55:48 2010 +0100

    s4:operational LDB module - enable support for passing referrals through it

commit c16d4fb76d3a0c9c0f51790e3f448d6083f0f836
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date:   Sat Feb 20 20:31:41 2010 +0100

    s4:partition DSDB module - Cosmetic fixups

commit 461987bc26c89253f5ee71e3c374d4b0db79c84b
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date:   Tue Feb 16 19:48:46 2010 +0100

    s4:password_hash - Fix up request message pointers
    
    For add requests we need the add request messages, for modify requests we need
    the modify request messages.

commit eca8697d6181f1b7c1261393de72411227680065
Author: Matthias Dieter Wallnöfer <mwallnoefer at yahoo.de>
Date:   Wed Feb 17 18:24:03 2010 +0100

    s4:dsdb/util.c - Use LDB result constants in some more helper functions
    
    Always better to rely on the standards rather than on custom results.

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

Summary of changes:
 source4/dsdb/common/util.c                     |   22 +++++++-------
 source4/dsdb/samdb/ldb_modules/operational.c   |    3 +-
 source4/dsdb/samdb/ldb_modules/partition.c     |   39 ++++++++++++++----------
 source4/dsdb/samdb/ldb_modules/password_hash.c |   14 ++++----
 4 files changed, 42 insertions(+), 36 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index 6cdede1..134d428 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -770,7 +770,7 @@ int samdb_msg_add_dom_sid(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, stru
 				       sid,
 				       (ndr_push_flags_fn_t)ndr_push_dom_sid);
 	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
-		return -1;
+		return LDB_ERR_OPERATIONS_ERROR;
 	}
 	return ldb_msg_add_value(msg, attr_name, &v, NULL);
 }
@@ -798,18 +798,18 @@ int samdb_msg_add_addval(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struc
 	int ret;
 	a = talloc_strdup(mem_ctx, attr_name);
 	if (a == NULL)
-		return -1;
+		return LDB_ERR_OPERATIONS_ERROR;
 	v = talloc_strdup(mem_ctx, value);
 	if (v == NULL)
-		return -1;
+		return LDB_ERR_OPERATIONS_ERROR;
 	ret = ldb_msg_add_string(msg, a, v);
 	if (ret != 0)
 		return ret;
 	el = ldb_msg_find_element(msg, a);
 	if (el == NULL)
-		return -1;
+		return LDB_ERR_OPERATIONS_ERROR;
 	el->flags = LDB_FLAG_MOD_ADD;
-	return 0;
+	return LDB_SUCCESS;
 }
 
 /*
@@ -823,18 +823,18 @@ int samdb_msg_add_delval(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struc
 	int ret;
 	a = talloc_strdup(mem_ctx, attr_name);
 	if (a == NULL)
-		return -1;
+		return LDB_ERR_OPERATIONS_ERROR;
 	v = talloc_strdup(mem_ctx, value);
 	if (v == NULL)
-		return -1;
+		return LDB_ERR_OPERATIONS_ERROR;
 	ret = ldb_msg_add_string(msg, a, v);
 	if (ret != 0)
 		return ret;
 	el = ldb_msg_find_element(msg, a);
 	if (el == NULL)
-		return -1;
+		return LDB_ERR_OPERATIONS_ERROR;
 	el->flags = LDB_FLAG_MOD_DELETE;
-	return 0;
+	return LDB_SUCCESS;
 }
 
 /*
@@ -884,7 +884,7 @@ int samdb_msg_add_hash(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struct
 	struct ldb_val val;
 	val.data = talloc_memdup(mem_ctx, hash->hash, 16);
 	if (!val.data) {
-		return -1;
+		return LDB_ERR_OPERATIONS_ERROR;
 	}
 	val.length = 16;
 	return ldb_msg_add_value(msg, attr_name, &val, NULL);
@@ -901,7 +901,7 @@ int samdb_msg_add_hashes(TALLOC_CTX *mem_ctx, struct ldb_message *msg,
 	val.data = talloc_array_size(mem_ctx, 16, count);
 	val.length = count*16;
 	if (!val.data) {
-		return -1;
+		return LDB_ERR_OPERATIONS_ERROR;
 	}
 	for (i=0;i<count;i++) {
 		memcpy(i*16 + (char *)val.data, hashes[i].hash, 16);
diff --git a/source4/dsdb/samdb/ldb_modules/operational.c b/source4/dsdb/samdb/ldb_modules/operational.c
index 3b1b13f..b017f23 100644
--- a/source4/dsdb/samdb/ldb_modules/operational.c
+++ b/source4/dsdb/samdb/ldb_modules/operational.c
@@ -359,8 +359,7 @@ static int operational_callback(struct ldb_request *req, struct ldb_reply *ares)
 		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:
 
diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c
index 59e7fab..9bd4578 100644
--- a/source4/dsdb/samdb/ldb_modules/partition.c
+++ b/source4/dsdb/samdb/ldb_modules/partition.c
@@ -62,9 +62,8 @@ static struct partition_context *partition_init_ctx(struct ldb_module *module, s
 }
 
 /*
- *    helper functions to call the next module in chain
- *    */
-
+ * helper functions to call the next module in chain
+ */
 int partition_request(struct ldb_module *module, struct ldb_request *request)
 {
 	if ((module && module->ldb->flags & LDB_FLG_ENABLE_TRACING)) { \
@@ -150,13 +149,13 @@ static int partition_req_callback(struct ldb_request *req,
 		 * or this is an individual search result, we can
 		 * deterministily tell the caller what partition this was
 		 * written to (repl_meta_data likes to know) */
-			ret = ldb_reply_add_control(ares,
-						    DSDB_CONTROL_CURRENT_PARTITION_OID,
-						    false, partition_ctrl->data);
-			if (ret != LDB_SUCCESS) {
-				return ldb_module_done(ac->req, NULL, NULL,
-						       ret);
-			}
+		ret = ldb_reply_add_control(ares,
+					    DSDB_CONTROL_CURRENT_PARTITION_OID,
+					    false, partition_ctrl->data);
+		if (ret != LDB_SUCCESS) {
+			return ldb_module_done(ac->req, NULL, NULL,
+					       ret);
+		}
 	}
 
 	if (ares->error != LDB_SUCCESS) {
@@ -485,12 +484,14 @@ static int partition_search(struct ldb_module *module, struct ldb_request *req)
 	}
 
 	/* TODO:
-	   Generate referrals (look for a partition under this DN) if we don't have the above control specified
-	*/
+	 * Generate referrals (look for a partition under this DN) if we don't
+	 * have the LDB_CONTROL_DOMAIN_SCOPE_OID control specified.
+	 */
 	
 	if (search_options && (search_options->search_options & LDB_SEARCH_OPTION_PHANTOM_ROOT)) {
 		int i;
 		struct partition_context *ac;
+
 		if ((search_options->search_options & ~LDB_SEARCH_OPTION_PHANTOM_ROOT) == 0) {
 			/* We have processed this flag, so we are done with this control now */
 
@@ -500,6 +501,7 @@ static int partition_search(struct ldb_module *module, struct ldb_request *req)
 				return LDB_ERR_OPERATIONS_ERROR;
 			}
 		}
+
 		ac = partition_init_ctx(module, req);
 		if (!ac) {
 			return LDB_ERR_OPERATIONS_ERROR;
@@ -553,7 +555,6 @@ static int partition_search(struct ldb_module *module, struct ldb_request *req)
 
 		/* fire the first one */
 		return partition_call_first(ac);
-
 	} else {
 		/* Handle this like all other requests */
 		if (search_control && (search_options->search_options & ~LDB_SEARCH_OPTION_PHANTOM_ROOT) == 0) {
@@ -682,7 +683,9 @@ static int partition_prepare_commit(struct ldb_module *module)
 		}
 		ret = ldb_next_prepare_commit(data->partitions[i]->module);
 		if (ret != LDB_SUCCESS) {
-			ldb_asprintf_errstring(module->ldb, "prepare_commit error on %s: %s", ldb_dn_get_linearized(data->partitions[i]->ctrl->dn), ldb_errstring(module->ldb));
+			ldb_asprintf_errstring(module->ldb, "prepare_commit error on %s: %s",
+					       ldb_dn_get_linearized(data->partitions[i]->ctrl->dn),
+					       ldb_errstring(module->ldb));
 			return ret;
 		}
 	}
@@ -717,7 +720,9 @@ static int partition_end_trans(struct ldb_module *module)
 		}
 		ret2 = ldb_next_end_trans(data->partitions[i]->module);
 		if (ret2 != LDB_SUCCESS) {
-			ldb_asprintf_errstring(module->ldb, "end_trans error on %s: %s", ldb_dn_get_linearized(data->partitions[i]->ctrl->dn), ldb_errstring(module->ldb));
+			ldb_asprintf_errstring(module->ldb, "end_trans error on %s: %s",
+					       ldb_dn_get_linearized(data->partitions[i]->ctrl->dn),
+					       ldb_errstring(module->ldb));
 			ret = ret2;
 		}
 	}
@@ -745,7 +750,9 @@ static int partition_del_trans(struct ldb_module *module)
 		}
 		ret = ldb_next_del_trans(data->partitions[i]->module);
 		if (ret != LDB_SUCCESS) {
-			ldb_asprintf_errstring(module->ldb, "del_trans error on %s: %s", ldb_dn_get_linearized(data->partitions[i]->ctrl->dn), ldb_errstring(module->ldb));
+			ldb_asprintf_errstring(module->ldb, "del_trans error on %s: %s",
+					       ldb_dn_get_linearized(data->partitions[i]->ctrl->dn),
+					       ldb_errstring(module->ldb));
 			final_ret = ret;
 		}
 	}	
diff --git a/source4/dsdb/samdb/ldb_modules/password_hash.c b/source4/dsdb/samdb/ldb_modules/password_hash.c
index cd58821..3cefa18 100644
--- a/source4/dsdb/samdb/ldb_modules/password_hash.c
+++ b/source4/dsdb/samdb/ldb_modules/password_hash.c
@@ -1689,10 +1689,10 @@ static int password_hash_add(struct ldb_module *module, struct ldb_request *req)
 	/* If no part of this ADD touches the userPassword, or the NT
 	 * or LM hashes, then we don't need to make any changes.  */
 
-	sambaAttr = ldb_msg_find_element(req->op.mod.message, "userPassword");
-	clearTextPasswordAttr = ldb_msg_find_element(req->op.mod.message, "clearTextPassword");
-	ntAttr = ldb_msg_find_element(req->op.mod.message, "unicodePwd");
-	lmAttr = ldb_msg_find_element(req->op.mod.message, "dBCSPwd");
+	sambaAttr = ldb_msg_find_element(req->op.add.message, "userPassword");
+	clearTextPasswordAttr = ldb_msg_find_element(req->op.add.message, "clearTextPassword");
+	ntAttr = ldb_msg_find_element(req->op.add.message, "unicodePwd");
+	lmAttr = ldb_msg_find_element(req->op.add.message, "dBCSPwd");
 
 	if ((!sambaAttr) && (!clearTextPasswordAttr) && (!ntAttr) && (!lmAttr)) {
 		return ldb_next_request(module, req);
@@ -1884,13 +1884,13 @@ static int password_hash_modify(struct ldb_module *module, struct ldb_request *r
 	}
 
 	/* nobody must touch password Histories */
-	if (ldb_msg_find_element(req->op.add.message, "ntPwdHistory")) {
+	if (ldb_msg_find_element(req->op.mod.message, "ntPwdHistory")) {
 		return LDB_ERR_UNWILLING_TO_PERFORM;
 	}
-	if (ldb_msg_find_element(req->op.add.message, "lmPwdHistory")) {
+	if (ldb_msg_find_element(req->op.mod.message, "lmPwdHistory")) {
 		return LDB_ERR_UNWILLING_TO_PERFORM;
 	}
-	if (ldb_msg_find_element(req->op.add.message, "supplementalCredentials")) {
+	if (ldb_msg_find_element(req->op.mod.message, "supplementalCredentials")) {
 		return LDB_ERR_UNWILLING_TO_PERFORM;
 	}
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list