summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_ldap/ldb_ldap.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/ldb/ldb_ldap/ldb_ldap.c')
-rw-r--r--source4/lib/ldb/ldb_ldap/ldb_ldap.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c
index 5a4d911218..a2ca7a7cc8 100644
--- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c
+++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c
@@ -87,6 +87,9 @@ static struct ldb_async_handle *init_handle(struct lldb_private *lldb, struct ld
h->private_data = (void *)ac;
+ h->state = LDB_ASYNC_INIT;
+ h->status = LDB_SUCCESS;
+
ac->module = module;
ac->context = context;
ac->callback = callback;
@@ -885,12 +888,15 @@ static int lldb_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_
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: