svn commit: samba r15761 - in branches/SAMBA_4_0/source: dsdb/samdb/ldb_modules lib/ldb/common lib/ldb/include lib/ldb/modules

idra at samba.org idra at samba.org
Sat May 20 19:37:22 GMT 2006


Author: idra
Date: 2006-05-20 19:37:21 +0000 (Sat, 20 May 2006)
New Revision: 15761

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15761

Log:

Fix-as-you-go ...
Testing various async paths and uncovering bugs


Modified:
   branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/password_hash.c
   branches/SAMBA_4_0/source/lib/ldb/common/ldb_msg.c
   branches/SAMBA_4_0/source/lib/ldb/include/ldb.h
   branches/SAMBA_4_0/source/lib/ldb/modules/operational.c


Changeset:
Modified: branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/password_hash.c
===================================================================
--- branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/password_hash.c	2006-05-20 19:03:06 UTC (rev 15760)
+++ branches/SAMBA_4_0/source/dsdb/samdb/ldb_modules/password_hash.c	2006-05-20 19:37:21 UTC (rev 15761)
@@ -1672,11 +1672,11 @@
 
 	switch (ac->step) {
 	case PH_ADD_SEARCH_DOM:
-		if (ac->dom_req->async.handle->status != LDB_ASYNC_DONE) {
+		if (ac->dom_req->async.handle->state != LDB_ASYNC_DONE) {
 			ret = ldb_async_wait(ac->dom_req->async.handle, LDB_WAIT_NONE);
-			if (ret != LDB_SUCCESS) goto error;
+			if (ret != LDB_SUCCESS) goto done;
 
-			if (ac->dom_req->async.handle->status != LDB_ASYNC_DONE) {
+			if (ac->dom_req->async.handle->state != LDB_ASYNC_DONE) {
 				return LDB_SUCCESS;
 			}
 		}
@@ -1685,22 +1685,22 @@
 		return password_hash_add_async_do_add(handle);
 
 	case PH_ADD_DO_ADD:
-		if (ac->down_req->async.handle->status != LDB_ASYNC_DONE) {
+		if (ac->down_req->async.handle->state != LDB_ASYNC_DONE) {
 			ret = ldb_async_wait(ac->down_req->async.handle, LDB_WAIT_NONE);
-			if (ret != LDB_SUCCESS) goto error;
+			if (ret != LDB_SUCCESS) goto done;
 
-			if (ac->down_req->async.handle->status != LDB_ASYNC_DONE) {
+			if (ac->down_req->async.handle->state != LDB_ASYNC_DONE) {
 				return LDB_SUCCESS;
 			}
 		}
 		return LDB_SUCCESS;
 		
 	case PH_MOD_DO_REQ:
-		if (ac->down_req->async.handle->status != LDB_ASYNC_DONE) {
+		if (ac->down_req->async.handle->state != LDB_ASYNC_DONE) {
 			ret = ldb_async_wait(ac->down_req->async.handle, LDB_WAIT_NONE);
-			if (ret != LDB_SUCCESS) goto error;
+			if (ret != LDB_SUCCESS) goto done;
 
-			if (ac->down_req->async.handle->status != LDB_ASYNC_DONE) {
+			if (ac->down_req->async.handle->state != LDB_ASYNC_DONE) {
 				return LDB_SUCCESS;
 			}
 		}
@@ -1709,11 +1709,11 @@
 		return password_hash_mod_async_search_self(handle);
 		
 	case PH_MOD_SEARCH_SELF:
-		if (ac->search_req->async.handle->status != LDB_ASYNC_DONE) {
+		if (ac->search_req->async.handle->state != LDB_ASYNC_DONE) {
 			ret = ldb_async_wait(ac->search_req->async.handle, LDB_WAIT_NONE);
-			if (ret != LDB_SUCCESS) goto error;
+			if (ret != LDB_SUCCESS) goto done;
 
-			if (ac->search_req->async.handle->status != LDB_ASYNC_DONE) {
+			if (ac->search_req->async.handle->state != LDB_ASYNC_DONE) {
 				return LDB_SUCCESS;
 			}
 		}
@@ -1722,11 +1722,11 @@
 		return password_hash_mod_async_search_dom(handle);
 		
 	case PH_MOD_SEARCH_DOM:
-		if (ac->dom_req->async.handle->status != LDB_ASYNC_DONE) {
+		if (ac->dom_req->async.handle->state != LDB_ASYNC_DONE) {
 			ret = ldb_async_wait(ac->dom_req->async.handle, LDB_WAIT_NONE);
-			if (ret != LDB_SUCCESS) goto error;
+			if (ret != LDB_SUCCESS) goto done;
 
-			if (ac->dom_req->async.handle->status != LDB_ASYNC_DONE) {
+			if (ac->dom_req->async.handle->state != LDB_ASYNC_DONE) {
 				return LDB_SUCCESS;
 			}
 		}
@@ -1735,22 +1735,25 @@
 		return password_hash_mod_async_do_mod(handle);
 
 	case PH_MOD_DO_MOD:
-		if (ac->mod_req->async.handle->status != LDB_ASYNC_DONE) {
+		if (ac->mod_req->async.handle->state != LDB_ASYNC_DONE) {
 			ret = ldb_async_wait(ac->mod_req->async.handle, LDB_WAIT_NONE);
-			if (ret != LDB_SUCCESS) goto error;
+			if (ret != LDB_SUCCESS) goto done;
 
-			if (ac->mod_req->async.handle->status != LDB_ASYNC_DONE) {
+			if (ac->mod_req->async.handle->state != LDB_ASYNC_DONE) {
 				return LDB_SUCCESS;
 			}
 		}
-		return LDB_SUCCESS;
+
+		break;
 		
 	default:
 		ret = LDB_ERR_OPERATIONS_ERROR;
-		goto error;
+		goto done;
 	}
 
-error:
+	ret = LDB_SUCCESS;
+
+done:
 	handle->state = LDB_ASYNC_DONE;
 	handle->status = ret;
 	return ret;

Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_msg.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_msg.c	2006-05-20 19:03:06 UTC (rev 15760)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_msg.c	2006-05-20 19:37:21 UTC (rev 15761)
@@ -734,7 +734,7 @@
 		return 0;
 
 	val.data = discard_const(value);
-	val.length = strlen(value) + 1;
+	val.length = strlen(value);
 
 	if (ldb_msg_find_val(el, &val))
 		return 1;

Modified: branches/SAMBA_4_0/source/lib/ldb/include/ldb.h
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/include/ldb.h	2006-05-20 19:03:06 UTC (rev 15760)
+++ branches/SAMBA_4_0/source/lib/ldb/include/ldb.h	2006-05-20 19:37:21 UTC (rev 15761)
@@ -619,17 +619,17 @@
 struct ldb_search {
 	const struct ldb_dn *base;
 	enum ldb_scope scope;
-	struct ldb_parse_tree *tree;
+	const struct ldb_parse_tree *tree;
 	const char * const *attrs;
 	struct ldb_result *res;
 };
 
 struct ldb_add {
-	struct ldb_message *message;
+	const struct ldb_message *message;
 };
 
 struct  ldb_modify {
-	struct ldb_message *message;
+	const struct ldb_message *message;
 };
 
 struct ldb_delete {
@@ -647,7 +647,7 @@
 
 struct ldb_request {
 
-	int operation;
+	enum ldb_request_type operation;
 
 	union {
 		struct ldb_search search;

Modified: branches/SAMBA_4_0/source/lib/ldb/modules/operational.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/modules/operational.c	2006-05-20 19:03:06 UTC (rev 15760)
+++ branches/SAMBA_4_0/source/lib/ldb/modules/operational.c	2006-05-20 19:37:21 UTC (rev 15761)
@@ -522,8 +522,10 @@
 		return LDB_ERR_OPERATIONS_ERROR;
 	}
 
+	*down_req = *req;
+
 	/* we have to copy the message as the caller might have it as a const */
-	msg = ldb_msg_copy_shallow(down_req, req->op.add.message);
+	down_req->op.mod.message = msg = ldb_msg_copy_shallow(down_req, req->op.mod.message);
 	if (msg == NULL) {
 		return LDB_ERR_OPERATIONS_ERROR;
 	}
@@ -543,15 +545,6 @@
 		}
 	}
 
-	down_req->op.add.message = msg;
-	
-	down_req->controls = req->controls;
-	down_req->creds = req->creds;
-
-	down_req->async.context = req->async.context;
-	down_req->async.callback = req->async.callback;
-	down_req->async.timeout = req->async.timeout;
-
 	/* go on with the call chain */
 	ret = ldb_next_request(module, down_req);
 
@@ -583,8 +576,10 @@
 		return LDB_ERR_OPERATIONS_ERROR;
 	}
 
+	*down_req = *req;
+
 	/* we have to copy the message as the caller might have it as a const */
-	msg = ldb_msg_copy_shallow(down_req, req->op.mod.message);
+	down_req->op.mod.message = msg = ldb_msg_copy_shallow(down_req, req->op.mod.message);
 	if (msg == NULL) {
 		return LDB_ERR_OPERATIONS_ERROR;
 	}
@@ -600,16 +595,7 @@
 		talloc_free(down_req);
 		return -1;
 	}
-
-	down_req->op.mod.message = msg;
 	
-	down_req->controls = req->controls;
-	down_req->creds = req->creds;
-
-	down_req->async.context = req->async.context;
-	down_req->async.callback = req->async.callback;
-	down_req->async.timeout = req->async.timeout;
-
 	/* go on with the call chain */
 	ret = ldb_next_request(module, down_req);
 



More information about the samba-cvs mailing list