summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-03-03 22:52:57 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:52:14 -0500
commit8edf29e8ef4d886321a6e8ec3902065641d34f40 (patch)
treef0fbc9be4612e112ff5c611e0a83c3df26d6e596 /source4
parente07f36a48cbc1b24192bddd3d27b164d52bfe31c (diff)
downloadsamba-8edf29e8ef4d886321a6e8ec3902065641d34f40.tar.gz
samba-8edf29e8ef4d886321a6e8ec3902065641d34f40.tar.bz2
samba-8edf29e8ef4d886321a6e8ec3902065641d34f40.zip
r13827: Minor enhancements or cosmetic changes
(This used to be commit 7ef63abae12f65835a82f9931ad1f5ea75e5f3f6)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/ldb/ldb_ildap/ldb_ildap.c11
-rw-r--r--source4/lib/ldb/ldb_ldap/ldb_ldap.c15
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_search.c16
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c31
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.h5
5 files changed, 34 insertions, 44 deletions
diff --git a/source4/lib/ldb/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c
index 869aec01cd..3467e65bf9 100644
--- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c
+++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c
@@ -536,12 +536,15 @@ static int ildb_search_bytree(struct ldb_module *module, const struct ldb_dn *ba
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;
}
diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c
index 031fd847e3..d671afb953 100644
--- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c
+++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c
@@ -395,12 +395,15 @@ static int lldb_search_bytree(struct ldb_module *module, const struct ldb_dn *ba
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 @@ static int lldb_async_wait(struct ldb_module *module, struct ldb_async_handle *h
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 @@ static int lldb_async_wait(struct ldb_module *module, struct ldb_async_handle *h
}
}
break;
- default:
- ret = LDB_ERR_OPERATIONS_ERROR;
}
return ret;
diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c
index 5ffd45aa3b..5155031055 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_search.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_search.c
@@ -522,7 +522,6 @@ int ltdb_search_async(struct ldb_module *module, const struct ldb_dn *base,
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 @@ int ltdb_search_async(struct ldb_module *module, const struct ldb_dn *base,
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 @@ int ltdb_search_bytree(struct ldb_module *module, const struct ldb_dn *base,
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;
}
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index da9596199a..0825348658 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -80,8 +80,7 @@ static int ltdb_err_map(enum TDB_ERROR tdb_code)
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 @@ struct ldb_async_handle *init_ltdb_handle(struct ltdb_private *ltdb, struct ldb_
ac->module = module;
ac->context = context;
ac->callback = callback;
- ac->timeout = timeout;
return h;
}
@@ -259,14 +257,13 @@ done:
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 @@ static int ltdb_add(struct ldb_module *module, const struct ldb_message *msg)
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 @@ int ltdb_delete_noindex(struct ldb_module *module, const struct ldb_dn *dn)
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 @@ static int ltdb_delete_async(struct ldb_module *module, const struct ldb_dn *dn,
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 @@ static int ltdb_delete(struct ldb_module *module, const struct ldb_dn *dn)
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 @@ failed:
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 @@ static int ltdb_modify_async(struct ldb_module *module, const struct ldb_message
*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 @@ static int ltdb_modify(struct ldb_module *module, const struct ldb_message *msg)
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_modify(struct ldb_module *module, const struct ldb_message *msg)
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 @@ static int ltdb_rename_async(struct ldb_module *module, const struct ldb_dn *old
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 @@ static int ltdb_rename(struct ldb_module *module, const struct ldb_dn *olddn, co
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 @@ static int ltdb_request(struct ldb_module *module, struct ldb_request *req)
req->op.search.attrs,
req->async.context,
req->async.callback,
- req->async.timeout,
&req->async.handle);
case LDB_ASYNC_ADD:
@@ -974,7 +965,6 @@ static int ltdb_request(struct ldb_module *module, struct ldb_request *req)
req->op.add.message,
req->async.context,
req->async.callback,
- req->async.timeout,
&req->async.handle);
case LDB_ASYNC_MODIFY:
@@ -982,7 +972,6 @@ static int ltdb_request(struct ldb_module *module, struct ldb_request *req)
req->op.mod.message,
req->async.context,
req->async.callback,
- req->async.timeout,
&req->async.handle);
case LDB_ASYNC_DELETE:
@@ -990,7 +979,6 @@ static int ltdb_request(struct ldb_module *module, struct ldb_request *req)
req->op.del.dn,
req->async.context,
req->async.callback,
- req->async.timeout,
&req->async.handle);
case LDB_ASYNC_RENAME:
@@ -999,7 +987,6 @@ static int ltdb_request(struct ldb_module *module, struct ldb_request *req)
req->op.rename.newdn,
req->async.context,
req->async.callback,
- req->async.timeout,
&req->async.handle);
default:
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.h b/source4/lib/ldb/ldb_tdb/ldb_tdb.h
index 5c76463ff7..196103ad6b 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.h
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.h
@@ -44,7 +44,6 @@ struct ltdb_async_context {
/* async stuff */
void *context;
- int timeout;
int (*callback)(struct ldb_context *, void *, struct ldb_async_result *);
};
@@ -106,7 +105,6 @@ int ltdb_search_async(struct ldb_module *module, const struct ldb_dn *base,
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 @@ int ltdb_search_bytree(struct ldb_module *module, const struct ldb_dn *base,
/* 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);