diff options
author | Simo Sorce <idra@samba.org> | 2006-03-07 20:43:40 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:52:34 -0500 |
commit | 7ffc1b48a4ac5d8e2bfba5b5f5f6f4bea33f3964 (patch) | |
tree | 0290b9f9c413e5dc47e4cced71957f22e4b170b0 /source4/lib/ldb/ldb_ldap | |
parent | e460cf7692ccf1fd1e6cd413e43bf90e2b33ee34 (diff) | |
download | samba-7ffc1b48a4ac5d8e2bfba5b5f5f6f4bea33f3964.tar.gz samba-7ffc1b48a4ac5d8e2bfba5b5f5f6f4bea33f3964.tar.bz2 samba-7ffc1b48a4ac5d8e2bfba5b5f5f6f4bea33f3964.zip |
r13986: minor fixes
(This used to be commit 8375f030197d311515085ac6beeaf63af45d14b0)
Diffstat (limited to 'source4/lib/ldb/ldb_ldap')
-rw-r--r-- | source4/lib/ldb/ldb_ldap/ldb_ldap.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c index 3a5039ddc0..307370ee12 100644 --- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c +++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c @@ -713,6 +713,7 @@ static int lldb_parse_result(struct ldb_async_handle *handle, LDAPMessage *resul char *errmsgp = NULL; char **referralsp = NULL; LDAPControl **serverctrlsp = NULL; + int ret; type = ldap_msgtype(result); @@ -763,17 +764,19 @@ static int lldb_parse_result(struct ldb_async_handle *handle, LDAPMessage *resul lldb_add_msg_attr(ac->module->ldb, ares->message, attr, bval); ldap_value_free_len(bval); } - - ldap_memfree(attr); } if (berptr) ber_free(berptr, 0); ares->type = LDB_REPLY_ENTRY; handle->state = LDB_ASYNC_PENDING; - handle->status = ac->callback(ac->module->ldb, ac->context, ares); - - ldap_msgfree(result); + ret = ac->callback(ac->module->ldb, ac->context, ares); + if (ret != LDB_SUCCESS) { + handle->status = ret; + } + } else { + handle->status = LDB_ERR_PROTOCOL_ERROR; + handle->state = LDB_ASYNC_DONE; } break; @@ -798,7 +801,10 @@ static int lldb_parse_result(struct ldb_async_handle *handle, LDAPMessage *resul ares->referral = talloc_strdup(ares, *referralsp); ares->type = LDB_REPLY_REFERRAL; handle->state = LDB_ASYNC_PENDING; - handle->status = ac->callback(ac->module->ldb, ac->context, ares); + ret = ac->callback(ac->module->ldb, ac->context, ares); + if (ret != LDB_SUCCESS) { + handle->status = ret; + } break; @@ -823,7 +829,10 @@ static int lldb_parse_result(struct ldb_async_handle *handle, LDAPMessage *resul ares->type = LDB_REPLY_DONE; handle->state = LDB_ASYNC_DONE; - handle->status = ac->callback(ac->module->ldb, ac->context, ares); + ret = ac->callback(ac->module->ldb, ac->context, ares); + if (ret != LDB_SUCCESS) { + handle->status = ret; + } break; @@ -845,7 +854,8 @@ static int lldb_parse_result(struct ldb_async_handle *handle, LDAPMessage *resul break; default: - handle->state = LDB_ERR_PROTOCOL_ERROR; + handle->status = LDB_ERR_PROTOCOL_ERROR; + goto error; } if (matcheddnp) ldap_memfree(matcheddnp); @@ -856,10 +866,12 @@ static int lldb_parse_result(struct ldb_async_handle *handle, LDAPMessage *resul if (referralsp) ldap_value_free(referralsp); if (serverctrlsp) ldap_controls_free(serverctrlsp); + ldap_msgfree(result); return handle->status; error: handle->state = LDB_ASYNC_DONE; + ldap_msgfree(result); return handle->status; } |