h->private_data = (void *)ildb_ac;
+ h->state = LDB_ASYNC_INIT;
+ h->status = LDB_SUCCESS;
+
req = ldap_request_send(ildb->ldap, msg);
if (req == NULL) {
ldb_set_errstring(module->ldb, talloc_asprintf(module, "async send request failed"));
{
struct ildb_async_context *ac = talloc_get_type(handle->private_data, struct ildb_async_context);
+ if (handle->state == LDB_ASYNC_DONE) {
+ return handle->status;
+ }
+
if (!ac) {
return LDB_ERR_OPERATIONS_ERROR;
}
h->private_data = (void *)ac;
+ h->state = LDB_ASYNC_INIT;
+ h->status = LDB_SUCCESS;
+
ac->module = module;
ac->context = context;
ac->callback = callback;
LDAPMessage *result;
int ret = LDB_ERR_OPERATIONS_ERROR;
- if (!ac->msgid) {
+ if (handle->state == LDB_ASYNC_DONE) {
+ return handle->status;
+ }
+
+ if (!ac || !ac->msgid) {
return LDB_ERR_OPERATIONS_ERROR;
}
handle->status = LDB_SUCCESS;
- handle->state = LDB_ASYNC_INIT;
switch(type) {
case LDB_WAIT_NONE:
int (*callback)(struct ldb_context *, void *, struct ldb_async_result *);
};
-static struct ldb_async_handle *init_lsql_handle(struct lsqlite3_private *lsqlite3, struct ldb_module *module,
- void *context,
- int (*callback)(struct ldb_context *, void *, struct ldb_async_result *))
+static struct ldb_async_handle *init_handle(struct lsqlite3_private *lsqlite3, struct ldb_module *module,
+ void *context,
+ int (*callback)(struct ldb_context *, void *, struct ldb_async_result *))
{
struct lsql_async_context *ac;
struct ldb_async_handle *h;
h->private_data = (void *)ac;
+ h->state = LDB_ASYNC_INIT;
+ h->status = LDB_SUCCESS;
+
ac->module = module;
ac->context = context;
ac->callback = callback;
char *query = NULL;
int ret;
- *handle = init_lsql_handle(lsqlite3, module, context, callback);
+ *handle = init_handle(lsqlite3, module, context, callback);
if (*handle == NULL) {
talloc_free(*handle);
return LDB_ERR_OPERATIONS_ERROR;
int i;
int ret = LDB_ERR_OPERATIONS_ERROR;
- *handle = init_lsql_handle(lsqlite3, module, context, callback);
+ *handle = init_handle(lsqlite3, module, context, callback);
if (*handle == NULL) {
goto failed;
}
int i;
int ret = LDB_ERR_OPERATIONS_ERROR;
- *handle = init_lsql_handle(lsqlite3, module, context, callback);
+ *handle = init_handle(lsqlite3, module, context, callback);
if (*handle == NULL) {
goto failed;
}
int ret = LDB_ERR_OPERATIONS_ERROR;
- *handle = init_lsql_handle(lsqlite3, module, context, callback);
+ *handle = init_handle(lsqlite3, module, context, callback);
if (*handle == NULL) {
goto failed;
}
char *query;
int ret = LDB_ERR_OPERATIONS_ERROR;
- *handle = init_lsql_handle(lsqlite3, module, context, callback);
+ *handle = init_handle(lsqlite3, module, context, callback);
if (*handle == NULL) {
goto failed;
}