svn commit: samba r13827 - in branches/SAMBA_4_0/source/lib/ldb: ldb_ildap ldb_ldap ldb_tdb

idra at samba.org idra at samba.org
Fri Mar 3 22:52:59 GMT 2006


Author: idra
Date: 2006-03-03 22:52:57 +0000 (Fri, 03 Mar 2006)
New Revision: 13827

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

Log:

Minor enhancements or cosmetic changes


Modified:
   branches/SAMBA_4_0/source/lib/ldb/ldb_ildap/ldb_ildap.c
   branches/SAMBA_4_0/source/lib/ldb/ldb_ldap/ldb_ldap.c
   branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_search.c
   branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c
   branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.h


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_ildap/ldb_ildap.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/ldb_ildap/ldb_ildap.c	2006-03-03 22:52:38 UTC (rev 13826)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb_ildap/ldb_ildap.c	2006-03-03 22:52:57 UTC (rev 13827)
@@ -536,12 +536,15 @@
 	ret = ildb_search_async(module, base, scope, tree, attrs, control_req,
 				res, &ildb_search_sync_callback, ildb->ldap->timeout, &handle);
 
-	if (ret != LDB_SUCCESS)
-		return ret;
+	if (ret == LDB_SUCCESS) {
+		ret = ldb_async_wait(module->ldb, handle, LDB_WAIT_ALL);
+		talloc_free(handle);
+	}
 
-	ret = ldb_async_wait(module->ldb, handle, LDB_WAIT_ALL);
+	if (ret != LDB_SUCCESS) {
+		talloc_free(*res);
+	}
 
-	talloc_free(handle);
 	return ret;
 }
 

Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_ldap/ldb_ldap.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/ldb_ldap/ldb_ldap.c	2006-03-03 22:52:38 UTC (rev 13826)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb_ldap/ldb_ldap.c	2006-03-03 22:52:57 UTC (rev 13827)
@@ -395,12 +395,15 @@
 	ret = lldb_search_async(module, base, scope, tree, attrs, control_req,
 				res, &lldb_search_sync_callback, lldb->timeout, &handle);
 
-	if (ret != LDB_SUCCESS)
-		return ret;
+	if (ret == LDB_SUCCESS) {
+		ret = ldb_async_wait(module->ldb, handle, LDB_WAIT_ALL);
+		talloc_free(handle);
+	}
 
-	ret = ldb_async_wait(module->ldb, handle, LDB_WAIT_ALL);
+	if (ret != LDB_SUCCESS) {
+		talloc_free(*res);
+	}
 
-	talloc_free(handle);
 	return ret;
 }
 
@@ -866,7 +869,7 @@
 	struct lldb_private *lldb = talloc_get_type(ac->module->private_data, struct lldb_private);
 	struct timeval timeout;
 	LDAPMessage *result;
-	int ret;
+	int ret = LDB_ERR_OPERATIONS_ERROR;
 
 	if (!ac->msgid) {
 		return LDB_ERR_OPERATIONS_ERROR;
@@ -915,8 +918,6 @@
 			}
 		}
 		break;
-	default:
-		ret = LDB_ERR_OPERATIONS_ERROR;
 	}
 
 	return ret;

Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_search.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_search.c	2006-03-03 22:52:38 UTC (rev 13826)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_search.c	2006-03-03 22:52:57 UTC (rev 13827)
@@ -522,7 +522,6 @@
 		      const char * const *attrs,
 		      void *context,
 		      int (*callback)(struct ldb_context *, void *, struct ldb_async_result *),
-		      int timeout,
 		      struct ldb_async_handle **handle)
 {
 	struct ltdb_private *ltdb = talloc_get_type(module->private_data, struct ltdb_private);
@@ -547,7 +546,7 @@
 		return LDB_ERR_OPERATIONS_ERROR;
 	}
 
-	*handle = init_ltdb_handle(ltdb, module, context, callback, timeout);
+	*handle = init_ltdb_handle(ltdb, module, context, callback);
 	if (*handle == NULL) {
 		talloc_free(*handle);
 		ltdb_unlock_read(module);
@@ -594,14 +593,17 @@
 
 	ret = ltdb_search_async(module, base, scope, tree, attrs,
 				res, &ltdb_search_sync_callback,
-				0, &handle);
+				&handle);
 
-	if (ret != LDB_SUCCESS)
-		return ret;
+	if (ret == LDB_SUCCESS) {
+		ret = ldb_async_wait(module->ldb, handle, LDB_WAIT_ALL);
+		talloc_free(handle);
+	}
 
-	ret = ldb_async_wait(module->ldb, handle, LDB_WAIT_ALL);
+	if (ret != LDB_SUCCESS) {
+		talloc_free(*res);
+	}
 
-	talloc_free(handle);
 	return ret;
 }
 

Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c	2006-03-03 22:52:38 UTC (rev 13826)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.c	2006-03-03 22:52:57 UTC (rev 13827)
@@ -80,8 +80,7 @@
 
 struct ldb_async_handle *init_ltdb_handle(struct ltdb_private *ltdb, struct ldb_module *module,
 					  void *context,
-					  int (*callback)(struct ldb_context *, void *, struct ldb_async_result *),
-					  int timeout)
+					  int (*callback)(struct ldb_context *, void *, struct ldb_async_result *))
 {
 	struct ltdb_async_context *ac;
 	struct ldb_async_handle *h;
@@ -104,7 +103,6 @@
 	ac->module = module;
 	ac->context = context;
 	ac->callback = callback;
-	ac->timeout = timeout;
 
 	return h;
 }
@@ -259,14 +257,13 @@
 static int ltdb_add_async(struct ldb_module *module, const struct ldb_message *msg,
 			  void *context,
 			  int (*callback)(struct ldb_context *, void *, struct ldb_async_result *),
-			  int timeout,
 			  struct ldb_async_handle **handle)
 {
 	struct ltdb_private *ltdb = talloc_get_type(module->private_data, struct ltdb_private);
 	struct ltdb_async_context *ltdb_ac;
 	int ret = LDB_ERR_OPERATIONS_ERROR;
 
-	*handle = init_ltdb_handle(ltdb, module, context, callback, timeout);
+	*handle = init_ltdb_handle(ltdb, module, context, callback);
 	if (*handle == NULL) {
 		return ret;
 	}
@@ -305,7 +302,7 @@
 	struct ldb_async_handle *handle;
 	int ret;
 
-	ret = ltdb_add_async(module, msg, NULL, NULL, 0, &handle);
+	ret = ltdb_add_async(module, msg, NULL, NULL, &handle);
 
 	if (ret != LDB_SUCCESS)
 		return ret;
@@ -347,7 +344,6 @@
 static int ltdb_delete_async(struct ldb_module *module, const struct ldb_dn *dn,
 			     void *context,
 			     int (*callback)(struct ldb_context *, void *, struct ldb_async_result *),
-			     int timeout,
 			     struct ldb_async_handle **handle)
 {
 	struct ltdb_private *ltdb = talloc_get_type(module->private_data, struct ltdb_private);
@@ -361,7 +357,7 @@
 		goto failed;
 	}
 
-	*handle = init_ltdb_handle(ltdb, module, context, callback, timeout);
+	*handle = init_ltdb_handle(ltdb, module, context, callback);
 	if (*handle == NULL) {
 		goto failed;
 	}
@@ -410,8 +406,7 @@
 	struct ldb_async_handle *handle;
 	int ret;
 
-	ret = ltdb_delete_async(module, dn,
-				NULL, NULL, 0, &handle);
+	ret = ltdb_delete_async(module, dn, NULL, NULL, &handle);
 
 	if (ret != LDB_SUCCESS)
 		return ret;
@@ -737,7 +732,6 @@
 static int ltdb_modify_async(struct ldb_module *module, const struct ldb_message *msg,
 			  void *context,
 			  int (*callback)(struct ldb_context *, void *, struct ldb_async_result *),
-			  int timeout,
 			  struct ldb_async_handle **handle)
 {
 	struct ltdb_private *ltdb = talloc_get_type(module->private_data, struct ltdb_private);
@@ -746,7 +740,7 @@
 
 	*handle = NULL;
 
-	*handle = init_ltdb_handle(ltdb, module, context, callback, timeout);
+	*handle = init_ltdb_handle(ltdb, module, context, callback);
 	if (*handle == NULL) {
 		return ret;
 	}
@@ -785,7 +779,7 @@
 	struct ldb_async_handle *handle;
 	int ret;
 
-	ret = ltdb_modify_async(module, msg, NULL, NULL, 0, &handle);
+	ret = ltdb_modify_async(module, msg, NULL, NULL, &handle);
 
 	if (ret != LDB_SUCCESS)
 		return ret;
@@ -802,7 +796,6 @@
 static int ltdb_rename_async(struct ldb_module *module, const struct ldb_dn *olddn, const struct ldb_dn *newdn,
 			     void *context,
 			     int (*callback)(struct ldb_context *, void *, struct ldb_async_result *),
-			     int timeout,
 			     struct ldb_async_handle **handle)
 {
 	struct ltdb_private *ltdb = talloc_get_type(module->private_data, struct ltdb_private);
@@ -816,7 +809,7 @@
 		return ret;
 	}
 
-	*handle = init_ltdb_handle(ltdb, module, context, callback, timeout);
+	*handle = init_ltdb_handle(ltdb, module, context, callback);
 	if (*handle == NULL) {
 		goto failed;
 	}
@@ -872,8 +865,7 @@
 	struct ldb_async_handle *handle;
 	int ret;
 
-	ret = ltdb_rename_async(module, olddn, newdn,
-				NULL, NULL, 0, &handle);
+	ret = ltdb_rename_async(module, olddn, newdn, NULL, NULL, &handle);
 
 	if (ret != LDB_SUCCESS)
 		return ret;
@@ -966,7 +958,6 @@
 					req->op.search.attrs,
 					req->async.context,
 					req->async.callback,
-					req->async.timeout,
 					&req->async.handle);
 
 	case LDB_ASYNC_ADD:
@@ -974,7 +965,6 @@
 					req->op.add.message,
 					req->async.context,
 					req->async.callback,
-					req->async.timeout,
 					&req->async.handle);
 
 	case LDB_ASYNC_MODIFY:
@@ -982,7 +972,6 @@
 					req->op.mod.message,
 					req->async.context,
 					req->async.callback,
-					req->async.timeout,
 					&req->async.handle);
 
 	case LDB_ASYNC_DELETE:
@@ -990,7 +979,6 @@
 					req->op.del.dn,
 					req->async.context,
 					req->async.callback,
-					req->async.timeout,
 					&req->async.handle);
 
 	case LDB_ASYNC_RENAME:
@@ -999,7 +987,6 @@
 					req->op.rename.newdn,
 					req->async.context,
 					req->async.callback,
-					req->async.timeout,
 					&req->async.handle);
 
 	default:

Modified: branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.h
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.h	2006-03-03 22:52:38 UTC (rev 13826)
+++ branches/SAMBA_4_0/source/lib/ldb/ldb_tdb/ldb_tdb.h	2006-03-03 22:52:57 UTC (rev 13827)
@@ -44,7 +44,6 @@
 
 	/* async stuff */
 	void *context;
-	int timeout;
 	int (*callback)(struct ldb_context *, void *, struct ldb_async_result *);
 };
 
@@ -106,7 +105,6 @@
 		      const char * const *attrs,
 		      void *context,
 		      int (*callback)(struct ldb_context *, void *, struct ldb_async_result *),
-		      int timeout,
 		      struct ldb_async_handle **handle);
 int ltdb_search_bytree(struct ldb_module *module, const struct ldb_dn *base,
 		       enum ldb_scope scope, struct ldb_parse_tree *tree,
@@ -116,8 +114,7 @@
 /* The following definitions come from lib/ldb/ldb_tdb/ldb_tdb.c  */
 struct ldb_async_handle *init_ltdb_handle(struct ltdb_private *ltdb, struct ldb_module *module,
 					  void *context,
-					  int (*callback)(struct ldb_context *, void *, struct ldb_async_result *),
-					  int timeout);
+					  int (*callback)(struct ldb_context *, void *, struct ldb_async_result *));
 struct TDB_DATA ltdb_key(struct ldb_module *module, const struct ldb_dn *dn);
 int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flgs);
 int ltdb_delete_noindex(struct ldb_module *module, const struct ldb_dn *dn);



More information about the samba-cvs mailing list