summaryrefslogtreecommitdiff
path: root/source4/lib/ldb
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb')
-rw-r--r--source4/lib/ldb/common/ldb.c40
-rw-r--r--source4/lib/ldb/include/ldb.h14
-rw-r--r--source4/lib/ldb/ldb_ildap/ldb_ildap.c40
-rw-r--r--source4/lib/ldb/ldb_ldap/ldb_ldap.c34
-rw-r--r--source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c30
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_search.c14
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c48
-rw-r--r--source4/lib/ldb/modules/asq.c34
-rw-r--r--source4/lib/ldb/modules/objectclass.c42
-rw-r--r--source4/lib/ldb/modules/operational.c28
-rw-r--r--source4/lib/ldb/modules/paged_results.c22
-rw-r--r--source4/lib/ldb/modules/rdn_name.c20
-rw-r--r--source4/lib/ldb/modules/sort.c18
-rw-r--r--source4/lib/ldb/tools/ldbsearch.c6
14 files changed, 188 insertions, 202 deletions
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c
index a962aa4322..9420318fa9 100644
--- a/source4/lib/ldb/common/ldb.c
+++ b/source4/lib/ldb/common/ldb.c
@@ -335,7 +335,7 @@ static int ldb_autotransaction_request(struct ldb_context *ldb, struct ldb_reque
ret = ldb_request(ldb, req);
if (ret == LDB_SUCCESS) {
- ret = ldb_wait(req->async.handle, LDB_WAIT_ALL);
+ ret = ldb_wait(req->handle, LDB_WAIT_ALL);
}
if (ret == LDB_SUCCESS) {
@@ -369,11 +369,11 @@ int ldb_set_timeout(struct ldb_context *ldb, struct ldb_request *req, int timeou
if (req == NULL) return LDB_ERR_OPERATIONS_ERROR;
if (timeout != 0) {
- req->async.timeout = timeout;
+ req->timeout = timeout;
} else {
- req->async.timeout = ldb->default_timeout;
+ req->timeout = ldb->default_timeout;
}
- req->async.starttime = time(NULL);
+ req->starttime = time(NULL);
return LDB_SUCCESS;
}
@@ -390,11 +390,11 @@ int ldb_set_timeout_from_prev_req(struct ldb_context *ldb, struct ldb_request *o
if (oldreq == NULL)
return ldb_set_timeout(ldb, newreq, 0);
- if ((now - oldreq->async.starttime) > oldreq->async.timeout) {
+ if ((now - oldreq->starttime) > oldreq->timeout) {
return LDB_ERR_TIME_LIMIT_EXCEEDED;
}
- newreq->async.starttime = oldreq->async.starttime;
- newreq->async.timeout = oldreq->async.timeout - (now - oldreq->async.starttime);
+ newreq->starttime = oldreq->starttime;
+ newreq->timeout = oldreq->timeout - (now - oldreq->starttime);
return LDB_SUCCESS;
}
@@ -556,14 +556,14 @@ int ldb_search(struct ldb_context *ldb,
req->op.search.attrs = attrs;
req->controls = NULL;
- req->async.context = res;
- req->async.callback = ldb_search_callback;
+ req->context = res;
+ req->callback = ldb_search_callback;
ldb_set_timeout(ldb, req, 0); /* use default timeout */
ret = ldb_request(ldb, req);
if (ret == LDB_SUCCESS) {
- ret = ldb_wait(req->async.handle, LDB_WAIT_ALL);
+ ret = ldb_wait(req->handle, LDB_WAIT_ALL);
}
if (ret != LDB_SUCCESS) {
@@ -600,8 +600,8 @@ int ldb_add(struct ldb_context *ldb,
req->operation = LDB_ADD;
req->op.add.message = message;
req->controls = NULL;
- req->async.context = NULL;
- req->async.callback = NULL;
+ req->context = NULL;
+ req->callback = NULL;
ldb_set_timeout(ldb, req, 0); /* use default timeout */
/* do request and autostart a transaction */
@@ -632,8 +632,8 @@ int ldb_modify(struct ldb_context *ldb,
req->operation = LDB_MODIFY;
req->op.add.message = message;
req->controls = NULL;
- req->async.context = NULL;
- req->async.callback = NULL;
+ req->context = NULL;
+ req->callback = NULL;
ldb_set_timeout(ldb, req, 0); /* use default timeout */
/* do request and autostart a transaction */
@@ -661,8 +661,8 @@ int ldb_delete(struct ldb_context *ldb, const struct ldb_dn *dn)
req->operation = LDB_DELETE;
req->op.del.dn = dn;
req->controls = NULL;
- req->async.context = NULL;
- req->async.callback = NULL;
+ req->context = NULL;
+ req->callback = NULL;
ldb_set_timeout(ldb, req, 0); /* use default timeout */
/* do request and autostart a transaction */
@@ -690,8 +690,8 @@ int ldb_rename(struct ldb_context *ldb, const struct ldb_dn *olddn, const struct
req->op.rename.olddn = olddn;
req->op.rename.newdn = newdn;
req->controls = NULL;
- req->async.context = NULL;
- req->async.callback = NULL;
+ req->context = NULL;
+ req->callback = NULL;
ldb_set_timeout(ldb, req, 0); /* use default timeout */
/* do request and autostart a transaction */
@@ -718,8 +718,8 @@ int ldb_sequence_number(struct ldb_context *ldb, uint64_t *seq_num)
req->operation = LDB_SEQUENCE_NUMBER;
req->controls = NULL;
- req->async.context = NULL;
- req->async.callback = NULL;
+ req->context = NULL;
+ req->callback = NULL;
ldb_set_timeout(ldb, req, 0); /* use default timeout */
/* do request and autostart a transaction */
diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h
index 885842ff9c..68c2272adf 100644
--- a/source4/lib/ldb/include/ldb.h
+++ b/source4/lib/ldb/include/ldb.h
@@ -664,14 +664,12 @@ struct ldb_request {
struct ldb_control **controls;
- struct {
- void *context;
- int (*callback)(struct ldb_context *, void *, struct ldb_reply *);
-
- int timeout;
- time_t starttime;
- struct ldb_handle *handle;
- } async;
+ void *context;
+ int (*callback)(struct ldb_context *, void *, struct ldb_reply *);
+
+ int timeout;
+ time_t starttime;
+ struct ldb_handle *handle;
};
int ldb_request(struct ldb_context *ldb, struct ldb_request *request);
diff --git a/source4/lib/ldb/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c
index 3410d68c5e..ae92ede8ce 100644
--- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c
+++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c
@@ -391,9 +391,9 @@ static int ildb_search(struct ldb_module *module, struct ldb_request *req)
struct ldap_message *msg;
int n;
- req->async.handle = NULL;
+ req->handle = NULL;
- if (!req->async.callback || !req->async.context) {
+ if (!req->callback || !req->context) {
ldb_set_errstring(module->ldb, talloc_asprintf(module, "Async interface called with NULL callback function or NULL context"));
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -444,7 +444,7 @@ static int ildb_search(struct ldb_module *module, struct ldb_request *req)
msg->r.SearchRequest.attributes = discard_const(req->op.search.attrs);
msg->controls = req->controls;
- return ildb_request_send(module, msg, req->async.context, req->async.callback, req->async.timeout, &(req->async.handle));
+ return ildb_request_send(module, msg, req->context, req->callback, req->timeout, &(req->handle));
}
/*
@@ -457,7 +457,7 @@ static int ildb_add(struct ldb_module *module, struct ldb_request *req)
struct ldap_mod **mods;
int i,n;
- req->async.handle = NULL;
+ req->handle = NULL;
/* ignore ltdb specials */
if (ldb_dn_is_special(req->op.add.message->dn)) {
@@ -494,7 +494,7 @@ static int ildb_add(struct ldb_module *module, struct ldb_request *req)
msg->r.AddRequest.attributes[i] = mods[i]->attrib;
}
- return ildb_request_send(module, msg, req->async.context, req->async.callback, req->async.timeout, &(req->async.handle));
+ return ildb_request_send(module, msg, req->context, req->callback, req->timeout, &(req->handle));
}
/*
@@ -507,7 +507,7 @@ static int ildb_modify(struct ldb_module *module, struct ldb_request *req)
struct ldap_mod **mods;
int i,n;
- req->async.handle = NULL;
+ req->handle = NULL;
/* ignore ltdb specials */
if (ldb_dn_is_special(req->op.mod.message->dn)) {
@@ -544,11 +544,7 @@ static int ildb_modify(struct ldb_module *module, struct ldb_request *req)
msg->r.ModifyRequest.mods[i] = *mods[i];
}
- return ildb_request_send(module, msg,
- req->async.context,
- req->async.callback,
- req->async.timeout,
- &(req->async.handle));
+ return ildb_request_send(module, msg, req->context, req->callback, req->timeout, &(req->handle));
}
/*
@@ -559,7 +555,7 @@ static int ildb_delete(struct ldb_module *module, struct ldb_request *req)
struct ildb_private *ildb = talloc_get_type(module->private_data, struct ildb_private);
struct ldap_message *msg;
- req->async.handle = NULL;
+ req->handle = NULL;
/* ignore ltdb specials */
if (ldb_dn_is_special(req->op.del.dn)) {
@@ -579,11 +575,7 @@ static int ildb_delete(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_INVALID_DN_SYNTAX;
}
- return ildb_request_send(module, msg,
- req->async.context,
- req->async.callback,
- req->async.timeout,
- &(req->async.handle));
+ return ildb_request_send(module, msg, req->context, req->callback, req->timeout, &(req->handle));
}
/*
@@ -594,7 +586,7 @@ static int ildb_rename(struct ldb_module *module, struct ldb_request *req)
struct ildb_private *ildb = talloc_get_type(module->private_data, struct ildb_private);
struct ldap_message *msg;
- req->async.handle = NULL;
+ req->handle = NULL;
/* ignore ltdb specials */
if (ldb_dn_is_special(req->op.rename.olddn) || ldb_dn_is_special(req->op.rename.newdn)) {
@@ -632,11 +624,7 @@ static int ildb_rename(struct ldb_module *module, struct ldb_request *req)
msg->r.ModifyDNRequest.deleteolddn = True;
- return ildb_request_send(module, msg,
- req->async.context,
- req->async.callback,
- req->async.timeout,
- &(req->async.handle));
+ return ildb_request_send(module, msg, req->context, req->callback, req->timeout, &(req->handle));
}
static int ildb_start_trans(struct ldb_module *module)
@@ -757,8 +745,8 @@ static int ildb_init(struct ldb_module *module)
req->op.search.tree = ldb_parse_tree(req, "dn=dc=rootDSE");
req->op.search.attrs = NULL;
req->controls = NULL;
- req->async.context = ildb;
- req->async.callback = ildb_rootdse_callback;
+ req->context = ildb;
+ req->callback = ildb_rootdse_callback;
ldb_set_timeout(module->ldb, req, 60);
ret = ildb_search(module, req);
@@ -767,7 +755,7 @@ static int ildb_init(struct ldb_module *module)
return ret;
}
- ret = ildb_wait(req->async.handle, LDB_WAIT_ALL);
+ ret = ildb_wait(req->handle, LDB_WAIT_ALL);
talloc_free(req);
return ret;
diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c
index f6d24411db..1a20a28590 100644
--- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c
+++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c
@@ -236,7 +236,7 @@ static int lldb_search(struct ldb_module *module, struct ldb_request *req)
char *expression;
int ret;
- if (!req->async.callback || !req->async.context) {
+ if (!req->callback || !req->context) {
ldb_set_errstring(module->ldb, talloc_asprintf(module, "Async interface called with NULL callback function or NULL context"));
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -250,12 +250,12 @@ static int lldb_search(struct ldb_module *module, struct ldb_request *req)
ldb_debug(module->ldb, LDB_DEBUG_WARNING, "Controls are not yet supported by ldb_ldap backend!\n");
}
- req->async.handle = init_handle(lldb, module, req->async.context, req->async.callback, req->async.timeout, req->async.starttime);
- if (req->async.handle == NULL) {
+ req->handle = init_handle(lldb, module, req->context, req->callback, req->timeout, req->starttime);
+ if (req->handle == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
- lldb_ac = talloc_get_type(req->async.handle->private_data, struct lldb_context);
+ lldb_ac = talloc_get_type(req->handle->private_data, struct lldb_context);
search_base = ldb_dn_linearize(lldb_ac, req->op.search.base);
if (req->op.search.base == NULL) {
@@ -282,7 +282,7 @@ static int lldb_search(struct ldb_module *module, struct ldb_request *req)
break;
}
- tv.tv_sec = req->async.timeout;
+ tv.tv_sec = req->timeout;
tv.tv_usec = 0;
ret = ldap_search_ext(lldb->ldap, search_base, ldap_scope,
@@ -318,12 +318,12 @@ static int lldb_add(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_INVALID_DN_SYNTAX;
}
- req->async.handle = init_handle(lldb, module, req->async.context, req->async.callback, req->async.timeout, req->async.starttime);
- if (req->async.handle == NULL) {
+ req->handle = init_handle(lldb, module, req->context, req->callback, req->timeout, req->starttime);
+ if (req->handle == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
- lldb_ac = talloc_get_type(req->async.handle->private_data, struct lldb_context);
+ lldb_ac = talloc_get_type(req->handle->private_data, struct lldb_context);
mods = lldb_msg_to_mods(lldb_ac, req->op.add.message, 0);
if (mods == NULL) {
@@ -363,12 +363,12 @@ static int lldb_modify(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_INVALID_DN_SYNTAX;
}
- req->async.handle = init_handle(lldb, module, req->async.context, req->async.callback, req->async.timeout, req->async.starttime);
- if (req->async.handle == NULL) {
+ req->handle = init_handle(lldb, module, req->context, req->callback, req->timeout, req->starttime);
+ if (req->handle == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
- lldb_ac = talloc_get_type(req->async.handle->private_data, struct lldb_context);
+ lldb_ac = talloc_get_type(req->handle->private_data, struct lldb_context);
mods = lldb_msg_to_mods(lldb_ac, req->op.mod.message, 1);
if (mods == NULL) {
@@ -407,12 +407,12 @@ static int lldb_delete(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_INVALID_DN_SYNTAX;
}
- req->async.handle = init_handle(lldb, module, req->async.context, req->async.callback, req->async.timeout, req->async.starttime);
- if (req->async.handle == NULL) {
+ req->handle = init_handle(lldb, module, req->context, req->callback, req->timeout, req->starttime);
+ if (req->handle == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
- lldb_ac = talloc_get_type(req->async.handle->private_data, struct lldb_context);
+ lldb_ac = talloc_get_type(req->handle->private_data, struct lldb_context);
dnstr = ldb_dn_linearize(lldb_ac, req->op.del.dn);
@@ -445,12 +445,12 @@ static int lldb_rename(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_INVALID_DN_SYNTAX;
}
- req->async.handle = init_handle(lldb, module, req->async.context, req->async.callback, req->async.timeout, req->async.starttime);
- if (req->async.handle == NULL) {
+ req->handle = init_handle(lldb, module, req->context, req->callback, req->timeout, req->starttime);
+ if (req->handle == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
- lldb_ac = talloc_get_type(req->async.handle->private_data, struct lldb_context);
+ lldb_ac = talloc_get_type(req->handle->private_data, struct lldb_context);
old_dn = ldb_dn_linearize(lldb_ac, req->op.rename.olddn);
if (old_dn == NULL) {
diff --git a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
index c2ac9f47f4..153a6d27d4 100644
--- a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
+++ b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
@@ -2018,38 +2018,38 @@ static int lsql_request(struct ldb_module *module, struct ldb_request *req)
req->op.search.scope,
req->op.search.tree,
req->op.search.attrs,
- req->async.context,
- req->async.callback,
- &req->async.handle);
+ req->context,
+ req->callback,
+ &req->handle);
/*
case LDB_ADD:
return lsql_add_async(module,
req->op.add.message,
- req->async.context,
- req->async.callback,
- &req->async.handle);
+ req->context,
+ req->callback,
+ &req->handle);
case LDB_MODIFY:
return lsql_modify_async(module,
req->op.mod.message,
- req->async.context,
- req->async.callback,
- &req->async.handle);
+ req->context,
+ req->callback,
+ &req->handle);
*/
case LDB_DELETE:
return lsql_delete_async(module,
req->op.del.dn,
- req->async.context,
- req->async.callback,
- &req->async.handle);
+ req->context,
+ req->callback,
+ &req->handle);
case LDB_RENAME:
return lsql_rename_async(module,
req->op.rename.olddn,
req->op.rename.newdn,
- req->async.context,
- req->async.callback,
- &req->async.handle);
+ req->context,
+ req->callback,
+ &req->handle);
default:
return LDB_ERR_OPERATIONS_ERROR;
diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c
index 62e310ede6..ad6f98ea97 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_search.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_search.c
@@ -498,27 +498,27 @@ int ltdb_search(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_OPERATIONS_ERROR;
}
- req->async.handle = init_ltdb_handle(ltdb, module, req->async.context, req->async.callback);
- if (req->async.handle == NULL) {
+ req->handle = init_ltdb_handle(ltdb, module, req->context, req->callback);
+ if (req->handle == NULL) {
ltdb_unlock_read(module);
return LDB_ERR_OPERATIONS_ERROR;
}
- ltdb_ac = talloc_get_type(req->async.handle->private_data, struct ltdb_context);
+ ltdb_ac = talloc_get_type(req->handle->private_data, struct ltdb_context);
ltdb_ac->tree = req->op.search.tree;
ltdb_ac->scope = req->op.search.scope;
ltdb_ac->base = req->op.search.base;
ltdb_ac->attrs = req->op.search.attrs;
- ret = ltdb_search_indexed(req->async.handle);
+ ret = ltdb_search_indexed(req->handle);
if (ret == -1) {
- ret = ltdb_search_full(req->async.handle);
+ ret = ltdb_search_full(req->handle);
}
if (ret != LDB_SUCCESS) {
ldb_set_errstring(module->ldb, talloc_strdup(module->ldb, "Indexed and full searches both failed!\n"));
- req->async.handle->state = LDB_ASYNC_DONE;
- req->async.handle->status = ret;
+ req->handle->state = LDB_ASYNC_DONE;
+ req->handle->status = ret;
}
ltdb_unlock_read(module);
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index ababedad15..1401052955 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -298,15 +298,15 @@ static int ltdb_add(struct ldb_module *module, struct ldb_request *req)
}
}
- req->async.handle = init_ltdb_handle(ltdb, module, req->async.context, req->async.callback);
- if (req->async.handle == NULL) {
+ req->handle = init_ltdb_handle(ltdb, module, req->context, req->callback);
+ if (req->handle == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
- ltdb_ac = talloc_get_type(req->async.handle->private_data, struct ltdb_context);
+ ltdb_ac = talloc_get_type(req->handle->private_data, struct ltdb_context);
tret = ltdb_add_internal(module, req->op.add.message);
if (tret != LDB_SUCCESS) {
- req->async.handle->status = tret;
+ req->handle->status = tret;
goto done;
}
@@ -314,7 +314,7 @@ static int ltdb_add(struct ldb_module *module, struct ldb_request *req)
ret = ltdb_ac->callback(module->ldb, ltdb_ac->context, NULL);
}
done:
- req->async.handle->state = LDB_ASYNC_DONE;
+ req->handle->state = LDB_ASYNC_DONE;
return ret;
}
@@ -400,21 +400,21 @@ static int ltdb_delete(struct ldb_module *module, struct ldb_request *req)
}
}
- req->async.handle = NULL;
+ req->handle = NULL;
if (ltdb_cache_load(module) != 0) {
return LDB_ERR_OPERATIONS_ERROR;
}
- req->async.handle = init_ltdb_handle(ltdb, module, req->async.context, req->async.callback);
- if (req->async.handle == NULL) {
+ req->handle = init_ltdb_handle(ltdb, module, req->context, req->callback);
+ if (req->handle == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
- ltdb_ac = talloc_get_type(req->async.handle->private_data, struct ltdb_context);
+ ltdb_ac = talloc_get_type(req->handle->private_data, struct ltdb_context);
tret = ltdb_delete_internal(module, req->op.del.dn);
if (tret != LDB_SUCCESS) {
- req->async.handle->status = tret;
+ req->handle->status = tret;
goto done;
}
@@ -422,7 +422,7 @@ static int ltdb_delete(struct ldb_module *module, struct ldb_request *req)
ret = ltdb_ac->callback(module->ldb, ltdb_ac->context, NULL);
}
done:
- req->async.handle->state = LDB_ASYNC_DONE;
+ req->handle->state = LDB_ASYNC_DONE;
return ret;
}
@@ -764,17 +764,17 @@ static int ltdb_modify(struct ldb_module *module, struct ldb_request *req)
}
}
- req->async.handle = NULL;
+ req->handle = NULL;
- req->async.handle = init_ltdb_handle(ltdb, module, req->async.context, req->async.callback);
- if (req->async.handle == NULL) {
+ req->handle = init_ltdb_handle(ltdb, module, req->context, req->callback);
+ if (req->handle == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
- ltdb_ac = talloc_get_type(req->async.handle->private_data, struct ltdb_context);
+ ltdb_ac = talloc_get_type(req->handle->private_data, struct ltdb_context);
tret = ltdb_check_special_dn(module, req->op.mod.message);
if (tret != LDB_SUCCESS) {
- req->async.handle->status = tret;
+ req->handle->status = tret;
goto done;
}
@@ -785,7 +785,7 @@ static int ltdb_modify(struct ldb_module *module, struct ldb_request *req)
tret = ltdb_modify_internal(module, req->op.mod.message);
if (tret != LDB_SUCCESS) {
- req->async.handle->status = tret;
+ req->handle->status = tret;
goto done;
}
@@ -793,7 +793,7 @@ static int ltdb_modify(struct ldb_module *module, struct ldb_request *req)
ret = ltdb_ac->callback(module->ldb, ltdb_ac->context, NULL);
}
done:
- req->async.handle->state = LDB_ASYNC_DONE;
+ req->handle->state = LDB_ASYNC_DONE;
return ret;
}
@@ -814,17 +814,17 @@ static int ltdb_rename(struct ldb_module *module, struct ldb_request *req)
}
}
- req->async.handle = NULL;
+ req->handle = NULL;
if (ltdb_cache_load(module) != 0) {
return LDB_ERR_OPERATIONS_ERROR;
}
- req->async.handle = init_ltdb_handle(ltdb, module, req->async.context, req->async.callback);
- if (req->async.handle == NULL) {
+ req->handle = init_ltdb_handle(ltdb, module, req->context, req->callback);
+ if (req->handle == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
- ltdb_ac = talloc_get_type(req->async.handle->private_data, struct ltdb_context);
+ ltdb_ac = talloc_get_type(req->handle->private_data, struct ltdb_context);
msg = talloc(ltdb_ac, struct ldb_message);
if (msg == NULL) {
@@ -837,7 +837,7 @@ static int ltdb_rename(struct ldb_module *module, struct ldb_request *req)
tret = ltdb_search_dn1(module, req->op.rename.olddn, msg);
if (tret != 1) {
/* not finding the old record is an error */
- req->async.handle->status = LDB_ERR_NO_SUCH_OBJECT;
+ req->handle->status = LDB_ERR_NO_SUCH_OBJECT;
goto done;
}
@@ -864,7 +864,7 @@ static int ltdb_rename(struct ldb_module *module, struct ldb_request *req)
ret = ltdb_ac->callback(module->ldb, ltdb_ac->context, NULL);
}
done:
- req->async.handle->state = LDB_ASYNC_DONE;
+ req->handle->state = LDB_ASYNC_DONE;
return ret;
}
diff --git a/source4/lib/ldb/modules/asq.c b/source4/lib/ldb/modules/asq.c
index 466286e8cd..110470c8bb 100644
--- a/source4/lib/ldb/modules/asq.c
+++ b/source4/lib/ldb/modules/asq.c
@@ -217,9 +217,9 @@ static int asq_search(struct ldb_module *module, struct ldb_request *req)
return ldb_next_request(module, req);
}
- req->async.handle = NULL;
+ req->handle = NULL;
- if (!req->async.callback || !req->async.context) {
+ if (!req->callback || !req->context) {
ldb_set_errstring(module->ldb, talloc_asprintf(module,
"Async interface called with NULL callback function or NULL context"));
return LDB_ERR_OPERATIONS_ERROR;
@@ -230,13 +230,13 @@ static int asq_search(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_PROTOCOL_ERROR;
}
- h = init_handle(req, module, req->async.context, req->async.callback);
+ h = init_handle(req, module, req->context, req->callback);
if (!h) {
return LDB_ERR_OPERATIONS_ERROR;
}
ac = talloc_get_type(h->private_data, struct asq_context);
- req->async.handle = h;
+ req->handle = h;
/* check the search is well formed */
if (req->op.search.scope != LDB_SCOPE_BASE) {
@@ -266,8 +266,8 @@ static int asq_search(struct ldb_module *module, struct ldb_request *req)
base_attrs[1] = NULL;
ac->base_req->op.search.attrs = (const char * const *)base_attrs;
- ac->base_req->async.context = ac;
- ac->base_req->async.callback = asq_base_callback;
+ ac->base_req->context = ac;
+ ac->base_req->callback = asq_base_callback;
ldb_set_timeout_from_prev_req(module->ldb, req, ac->base_req);
ac->step = ASQ_SEARCH_BASE;
@@ -319,8 +319,8 @@ static int asq_requests(struct ldb_handle *handle) {
ac->reqs[i]->op.search.tree = ac->base_req->op.search.tree;
ac->reqs[i]->op.search.attrs = ac->req_attrs;
- ac->reqs[i]->async.context = ac;
- ac->reqs[i]->async.callback = asq_reqs_callback;
+ ac->reqs[i]->context = ac;
+ ac->reqs[i]->callback = asq_reqs_callback;
ldb_set_timeout_from_prev_req(ac->module->ldb, ac->base_req, ac->reqs[i]);
}
@@ -350,18 +350,18 @@ static int asq_wait_none(struct ldb_handle *handle)
switch (ac->step) {
case ASQ_SEARCH_BASE:
- ret = ldb_wait(ac->base_req->async.handle, LDB_WAIT_NONE);
+ ret = ldb_wait(ac->base_req->handle, LDB_WAIT_NONE);
if (ret != LDB_SUCCESS) {
handle->status = ret;
goto done;
}
- if (ac->base_req->async.handle->status != LDB_SUCCESS) {
- handle->status = ac->base_req->async.handle->status;
+ if (ac->base_req->handle->status != LDB_SUCCESS) {
+ handle->status = ac->base_req->handle->status;
goto done;
}
- if (ac->base_req->async.handle->state != LDB_ASYNC_DONE) {
+ if (ac->base_req->handle->state != LDB_ASYNC_DONE) {
return LDB_SUCCESS;
}
@@ -369,24 +369,24 @@ static int asq_wait_none(struct ldb_handle *handle)
case ASQ_SEARCH_MULTI:
- if (ac->reqs[ac->cur_req]->async.handle == NULL) {
+ if (ac->reqs[ac->cur_req]->handle == NULL) {
ret = ldb_request(ac->module->ldb, ac->reqs[ac->cur_req]);
if (ret != LDB_SUCCESS) {
return ret;
}
}
- ret = ldb_wait(ac->reqs[ac->cur_req]->async.handle, LDB_WAIT_NONE);
+ ret = ldb_wait(ac->reqs[ac->cur_req]->handle, LDB_WAIT_NONE);
if (ret != LDB_SUCCESS) {
handle->status = ret;
goto done;
}
- if (ac->reqs[ac->cur_req]->async.handle->status != LDB_SUCCESS) {
- handle->status = ac->reqs[ac->cur_req]->async.handle->status;
+ if (ac->reqs[ac->cur_req]->handle->status != LDB_SUCCESS) {
+ handle->status = ac->reqs[ac->cur_req]->handle->status;
}
- if (ac->reqs[ac->cur_req]->async.handle->state == LDB_ASYNC_DONE) {
+ if (ac->reqs[ac->cur_req]->handle->state == LDB_ASYNC_DONE) {
ac->cur_req++;
}
diff --git a/source4/lib/ldb/modules/objectclass.c b/source4/lib/ldb/modules/objectclass.c
index 03ff58e994..a8c99226cd 100644
--- a/source4/lib/ldb/modules/objectclass.c
+++ b/source4/lib/ldb/modules/objectclass.c
@@ -283,7 +283,7 @@ static int objectclass_add(struct ldb_module *module, struct ldb_request *req)
/* do not free down_req as the call results may be linked to it,
* it will be freed when the upper level request get freed */
if (ret == LDB_SUCCESS) {
- req->async.handle = down_req->async.handle;
+ req->handle = down_req->handle;
}
return ret;
}
@@ -382,7 +382,7 @@ static int objectclass_modify(struct ldb_module *module, struct ldb_request *req
/* do not free down_req as the call results may be linked to it,
* it will be freed when the upper level request get freed */
if (ret == LDB_SUCCESS) {
- req->async.handle = down_req->async.handle;
+ req->handle = down_req->handle;
}
return ret;
}
@@ -399,7 +399,7 @@ static int objectclass_modify(struct ldb_module *module, struct ldb_request *req
ac = talloc_get_type(h->private_data, struct oc_context);
/* return or own handle to deal with this call */
- req->async.handle = h;
+ req->handle = h;
/* prepare the first operation */
ac->down_req = talloc(ac, struct ldb_request);
@@ -410,8 +410,8 @@ static int objectclass_modify(struct ldb_module *module, struct ldb_request *req
*(ac->down_req) = *req; /* copy the request */
- ac->down_req->async.context = NULL;
- ac->down_req->async.callback = NULL;
+ ac->down_req->context = NULL;
+ ac->down_req->callback = NULL;
ldb_set_timeout_from_prev_req(module->ldb, req, ac->down_req);
ac->step = OC_DO_REQ;
@@ -471,8 +471,8 @@ static int objectclass_search_self(struct ldb_handle *h) {
}
ac->search_req->op.search.attrs = attrs;
ac->search_req->controls = NULL;
- ac->search_req->async.context = ac;
- ac->search_req->async.callback = get_self_callback;
+ ac->search_req->context = ac;
+ ac->search_req->callback = get_self_callback;
ldb_set_timeout_from_prev_req(ac->module->ldb, ac->orig_req, ac->search_req);
ac->step = OC_SEARCH_SELF;
@@ -504,8 +504,8 @@ static int objectclass_do_mod(struct ldb_handle *h) {
ac->mod_req->operation = LDB_MODIFY;
ac->mod_req->controls = NULL;
- ac->mod_req->async.context = ac;
- ac->mod_req->async.callback = NULL;
+ ac->mod_req->context = ac;
+ ac->mod_req->callback = NULL;
ldb_set_timeout_from_prev_req(ac->module->ldb, ac->orig_req, ac->mod_req);
/* use a new message structure */
@@ -590,18 +590,18 @@ static int oc_wait(struct ldb_handle *handle) {
switch (ac->step) {
case OC_DO_REQ:
- ret = ldb_wait(ac->down_req->async.handle, LDB_WAIT_NONE);
+ ret = ldb_wait(ac->down_req->handle, LDB_WAIT_NONE);
if (ret != LDB_SUCCESS) {
handle->status = ret;
goto done;
}
- if (ac->down_req->async.handle->status != LDB_SUCCESS) {
- handle->status = ac->down_req->async.handle->status;
+ if (ac->down_req->handle->status != LDB_SUCCESS) {
+ handle->status = ac->down_req->handle->status;
goto done;
}
- if (ac->down_req->async.handle->state != LDB_ASYNC_DONE) {
+ if (ac->down_req->handle->state != LDB_ASYNC_DONE) {
return LDB_SUCCESS;
}
@@ -609,18 +609,18 @@ static int oc_wait(struct ldb_handle *handle) {
return objectclass_search_self(handle);
case OC_SEARCH_SELF:
- ret = ldb_wait(ac->search_req->async.handle, LDB_WAIT_NONE);
+ ret = ldb_wait(ac->search_req->handle, LDB_WAIT_NONE);
if (ret != LDB_SUCCESS) {
handle->status = ret;
goto done;
}
- if (ac->search_req->async.handle->status != LDB_SUCCESS) {
- handle->status = ac->search_req->async.handle->status;
+ if (ac->search_req->handle->status != LDB_SUCCESS) {
+ handle->status = ac->search_req->handle->status;
goto done;
}
- if (ac->search_req->async.handle->state != LDB_ASYNC_DONE) {
+ if (ac->search_req->handle->state != LDB_ASYNC_DONE) {
return LDB_SUCCESS;
}
@@ -628,18 +628,18 @@ static int oc_wait(struct ldb_handle *handle) {
return objectclass_do_mod(handle);
case OC_DO_MOD:
- ret = ldb_wait(ac->mod_req->async.handle, LDB_WAIT_NONE);
+ ret = ldb_wait(ac->mod_req->handle, LDB_WAIT_NONE);
if (ret != LDB_SUCCESS) {
handle->status = ret;
goto done;
}
- if (ac->mod_req->async.handle->status != LDB_SUCCESS) {
- handle->status = ac->mod_req->async.handle->status;
+ if (ac->mod_req->handle->status != LDB_SUCCESS) {
+ handle->status = ac->mod_req->handle->status;
goto done;
}
- if (ac->mod_req->async.handle->state != LDB_ASYNC_DONE) {
+ if (ac->mod_req->handle->state != LDB_ASYNC_DONE) {
return LDB_SUCCESS;
}
diff --git a/source4/lib/ldb/modules/operational.c b/source4/lib/ldb/modules/operational.c
index 4cadaa27ee..7e7c8d83ad 100644
--- a/source4/lib/ldb/modules/operational.c
+++ b/source4/lib/ldb/modules/operational.c
@@ -226,7 +226,7 @@ static int add_uint64_element(struct ldb_message *msg, const char *attr, uint64_
hook search operations
*/
-struct operational_async_context {
+struct operational_context {
struct ldb_module *module;
void *up_context;
@@ -235,16 +235,16 @@ struct operational_async_context {
const char * const *attrs;
};
-static int operational_async_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares)
+static int operational_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares)
{
- struct operational_async_context *ac;
+ struct operational_context *ac;
if (!context || !ares) {
ldb_set_errstring(ldb, talloc_asprintf(ldb, "NULL Context or Result in callback"));
goto error;
}
- ac = talloc_get_type(context, struct operational_async_context);
+ ac = talloc_get_type(context, struct operational_context);
if (ares->type == LDB_REPLY_ENTRY) {
/* for each record returned post-process to add any derived
@@ -263,21 +263,21 @@ error:
static int operational_search(struct ldb_module *module, struct ldb_request *req)
{
- struct operational_async_context *ac;
+ struct operational_context *ac;
struct ldb_request *down_req;
const char **search_attrs = NULL;
int i, a, ret;
- req->async.handle = NULL;
+ req->handle = NULL;
- ac = talloc(req, struct operational_async_context);
+ ac = talloc(req, struct operational_context);
if (ac == NULL) {
return LDB_ERR_OPERATIONS_ERROR;
}
ac->module = module;
- ac->up_context = req->async.context;
- ac->up_callback = req->async.callback;
+ ac->up_context = req->context;
+ ac->up_callback = req->callback;
ac->attrs = req->op.search.attrs;
down_req = talloc_zero(req, struct ldb_request);
@@ -325,8 +325,8 @@ static int operational_search(struct ldb_module *module, struct ldb_request *req
down_req->controls = req->controls;
- down_req->async.context = ac;
- down_req->async.callback = operational_async_callback;
+ down_req->context = ac;
+ down_req->callback = operational_callback;
ldb_set_timeout_from_prev_req(module->ldb, req, down_req);
/* perform the search */
@@ -335,7 +335,7 @@ static int operational_search(struct ldb_module *module, struct ldb_request *req
/* do not free down_req as the call results may be linked to it,
* it will be freed when the upper level request get freed */
if (ret == LDB_SUCCESS) {
- req->async.handle = down_req->async.handle;
+ req->handle = down_req->handle;
}
return ret;
@@ -392,7 +392,7 @@ static int operational_add(struct ldb_module *module, struct ldb_request *req)
/* do not free down_req as the call results may be linked to it,
* it will be freed when the upper level request get freed */
if (ret == LDB_SUCCESS) {
- req->async.handle = down_req->async.handle;
+ req->handle = down_req->handle;
}
return ret;
@@ -449,7 +449,7 @@ static int operational_modify(struct ldb_module *module, struct ldb_request *req
/* do not free down_req as the call results may be linked to it,
* it will be freed when the upper level request get freed */
if (ret == LDB_SUCCESS) {
- req->async.handle = down_req->async.handle;
+ req->handle = down_req->handle;
}
return ret;
diff --git a/source4/lib/ldb/modules/paged_results.c b/source4/lib/ldb/modules/paged_results.c
index 3f2ff66b32..2d972b7316 100644
--- a/source4/lib/ldb/modules/paged_results.c
+++ b/source4/lib/ldb/modules/paged_results.c
@@ -251,9 +251,9 @@ static int paged_search(struct ldb_module *module, struct ldb_request *req)
private_data = talloc_get_type(module->private_data, struct private_data);
- req->async.handle = NULL;
+ req->handle = NULL;
- if (!req->async.callback || !req->async.context) {
+ if (!req->callback || !req->context) {
ldb_set_errstring(module->ldb, talloc_asprintf(module,
"Async interface called with NULL callback function or NULL context"));
return LDB_ERR_OPERATIONS_ERROR;
@@ -264,7 +264,7 @@ static int paged_search(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_PROTOCOL_ERROR;
}
- h = init_handle(req, module, req->async.context, req->async.callback);
+ h = init_handle(req, module, req->context, req->callback);
if (!h) {
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -299,8 +299,8 @@ static int paged_search(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_OPERATIONS_ERROR;
}
- ac->store->req->async.context = ac;
- ac->store->req->async.callback = paged_search_callback;
+ ac->store->req->context = ac;
+ ac->store->req->callback = paged_search_callback;
ldb_set_timeout_from_prev_req(module->ldb, req, ac->store->req);
ret = ldb_next_request(module, ac->store->req);
@@ -323,7 +323,7 @@ static int paged_search(struct ldb_module *module, struct ldb_request *req)
ret = LDB_SUCCESS;
}
- req->async.handle = h;
+ req->handle = h;
/* check if it is an abandon */
if (ac->size == 0) {
@@ -463,7 +463,7 @@ static int paged_wait(struct ldb_handle *handle, enum ldb_wait_type type)
ac = talloc_get_type(handle->private_data, struct paged_context);
- if (ac->store->req->async.handle->state == LDB_ASYNC_DONE) {
+ if (ac->store->req->handle->state == LDB_ASYNC_DONE) {
/* if lower level is finished we do not need to call it anymore */
/* return all we have until size == 0 or we empty storage */
ret = paged_results(handle);
@@ -478,8 +478,8 @@ static int paged_wait(struct ldb_handle *handle, enum ldb_wait_type type)
}
if (type == LDB_WAIT_ALL) {
- while (ac->store->req->async.handle->state != LDB_ASYNC_DONE) {
- ret = ldb_wait(ac->store->req->async.handle, type);
+ while (ac->store->req->handle->state != LDB_ASYNC_DONE) {
+ ret = ldb_wait(ac->store->req->handle, type);
if (ret != LDB_SUCCESS) {
handle->state = LDB_ASYNC_DONE;
handle->status = ret;
@@ -498,7 +498,7 @@ static int paged_wait(struct ldb_handle *handle, enum ldb_wait_type type)
return ret;
}
- ret = ldb_wait(ac->store->req->async.handle, type);
+ ret = ldb_wait(ac->store->req->handle, type);
if (ret != LDB_SUCCESS) {
handle->state = LDB_ASYNC_DONE;
handle->status = ret;
@@ -508,7 +508,7 @@ static int paged_wait(struct ldb_handle *handle, enum ldb_wait_type type)
handle->status = ret;
if (ac->store->num_entries >= ac->size ||
- ac->store->req->async.handle->state == LDB_ASYNC_DONE) {
+ ac->store->req->handle->state == LDB_ASYNC_DONE) {
ret = paged_results(handle);
diff --git a/source4/lib/ldb/modules/rdn_name.c b/source4/lib/ldb/modules/rdn_name.c
index b005b49c55..fce1d34ac0 100644
--- a/source4/lib/ldb/modules/rdn_name.c
+++ b/source4/lib/ldb/modules/rdn_name.c
@@ -128,7 +128,7 @@ static int rdn_name_add(struct ldb_module *module, struct ldb_request *req)
/* do not free down_req as the call results may be linked to it,
* it will be freed when the upper level request get freed */
if (ret == LDB_SUCCESS) {
- req->async.handle = down_req->async.handle;
+ req->handle = down_req->handle;
}
return ret;
@@ -181,7 +181,7 @@ static int rdn_name_rename(struct ldb_module *module, struct ldb_request *req)
ac->step = RENAME_RENAME;
- req->async.handle = h;
+ req->handle = h;
/* rename first, modify "name" if rename is ok */
return ldb_next_request(module, ac->down_req);
@@ -254,17 +254,17 @@ static int rename_wait(struct ldb_handle *handle)
switch(ac->step) {
case RENAME_RENAME:
- ret = ldb_wait(ac->down_req->async.handle, LDB_WAIT_NONE);
+ ret = ldb_wait(ac->down_req->handle, LDB_WAIT_NONE);
if (ret != LDB_SUCCESS) {
handle->status = ret;
goto done;
}
- if (ac->down_req->async.handle->status != LDB_SUCCESS) {
- handle->status = ac->down_req->async.handle->status;
+ if (ac->down_req->handle->status != LDB_SUCCESS) {
+ handle->status = ac->down_req->handle->status;
goto done;
}
- if (ac->down_req->async.handle->state != LDB_ASYNC_DONE) {
+ if (ac->down_req->handle->state != LDB_ASYNC_DONE) {
return LDB_SUCCESS;
}
@@ -272,17 +272,17 @@ static int rename_wait(struct ldb_handle *handle)
return rdn_name_rename_do_mod(handle);
case RENAME_MODIFY:
- ret = ldb_wait(ac->mod_req->async.handle, LDB_WAIT_NONE);
+ ret = ldb_wait(ac->mod_req->handle, LDB_WAIT_NONE);
if (ret != LDB_SUCCESS) {
handle->status = ret;
goto done;
}
- if (ac->mod_req->async.handle->status != LDB_SUCCESS) {
- handle->status = ac->mod_req->async.handle->status;
+ if (ac->mod_req->handle->status != LDB_SUCCESS) {
+ handle->status = ac->mod_req->handle->status;
goto done;
}
- if (ac->mod_req->async.handle->state != LDB_ASYNC_DONE) {
+ if (ac->mod_req->handle->state != LDB_ASYNC_DONE) {
return LDB_SUCCESS;
}
diff --git a/source4/lib/ldb/modules/sort.c b/source4/lib/ldb/modules/sort.c
index 261bae7e78..1ab034f4fb 100644
--- a/source4/lib/ldb/modules/sort.c
+++ b/source4/lib/ldb/modules/sort.c
@@ -242,14 +242,14 @@ static int server_sort_search(struct ldb_module *module, struct ldb_request *req
return ldb_next_request(module, req);
}
- req->async.handle = NULL;
+ req->handle = NULL;
- if (!req->async.callback || !req->async.context) {
+ if (!req->callback || !req->context) {
ldb_set_errstring(module->ldb, talloc_asprintf(module, "Async interface called with NULL callback function or NULL context"));
return LDB_ERR_OPERATIONS_ERROR;
}
- h = init_handle(req, module, req->async.context, req->async.callback);
+ h = init_handle(req, module, req->context, req->callback);
if (!h) {
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -310,11 +310,11 @@ static int server_sort_search(struct ldb_module *module, struct ldb_request *req
return LDB_ERR_OPERATIONS_ERROR;
}
- ac->req->async.context = ac;
- ac->req->async.callback = server_sort_search_callback;
+ ac->req->context = ac;
+ ac->req->callback = server_sort_search_callback;
ldb_set_timeout_from_prev_req(module->ldb, req, ac->req);
- req->async.handle = h;
+ req->handle = h;
return ldb_next_request(module, ac->req);
}
@@ -398,15 +398,15 @@ static int server_sort_wait(struct ldb_handle *handle, enum ldb_wait_type type)
ac = talloc_get_type(handle->private_data, struct sort_context);
- ret = ldb_wait(ac->req->async.handle, type);
+ ret = ldb_wait(ac->req->handle, type);
if (ret != LDB_SUCCESS) {
handle->status = ret;
return ret;
}
- handle->state = ac->req->async.handle->state;
- handle->status = ac->req->async.handle->status;
+ handle->state = ac->req->handle->state;
+ handle->status = ac->req->handle->status;
if (handle->status != LDB_SUCCESS) {
return handle->status;
diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c
index 45826f0996..93bb89a1d3 100644
--- a/source4/lib/ldb/tools/ldbsearch.c
+++ b/source4/lib/ldb/tools/ldbsearch.c
@@ -224,8 +224,8 @@ static int do_search(struct ldb_context *ldb,
if (req->op.search.tree == NULL) return -1;
req->op.search.attrs = attrs;
req->controls = sctx->req_ctrls;
- req->async.context = sctx;
- req->async.callback = &search_callback;
+ req->context = sctx;
+ req->callback = &search_callback;
ldb_set_timeout(ldb, req, 0); /* TODO: make this settable by command line */
again:
@@ -237,7 +237,7 @@ again:
return -1;
}
- ret = ldb_wait(req->async.handle, LDB_WAIT_ALL);
+ ret = ldb_wait(req->handle, LDB_WAIT_ALL);
if (ret != LDB_SUCCESS) {
printf("search error - %s\n", ldb_errstring(ldb));
return -1;