summaryrefslogtreecommitdiff
path: root/source3/lib/ldb/ldb_ldap
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-10-21 00:10:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:15:35 -0500
commit7a390a0dabcdadb30196662b6cdec512bf81dcb4 (patch)
tree8ed126e072e4446ad47d25f277059af5ccd556cc /source3/lib/ldb/ldb_ldap
parentaa3ca346d82da2501406cc1f482643b20905e467 (diff)
downloadsamba-7a390a0dabcdadb30196662b6cdec512bf81dcb4.tar.gz
samba-7a390a0dabcdadb30196662b6cdec512bf81dcb4.tar.bz2
samba-7a390a0dabcdadb30196662b6cdec512bf81dcb4.zip
r19430: merge recent ldb changes from Samba4. This includes memory leak fixes
and significant speedups (This used to be commit bb5c205fef90aa8b89ba400fb9f2f37a111676a8)
Diffstat (limited to 'source3/lib/ldb/ldb_ldap')
-rw-r--r--source3/lib/ldb/ldb_ldap/ldb_ldap.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/source3/lib/ldb/ldb_ldap/ldb_ldap.c b/source3/lib/ldb/ldb_ldap/ldb_ldap.c
index 10563816b9..410ad64b4a 100644
--- a/source3/lib/ldb/ldb_ldap/ldb_ldap.c
+++ b/source3/lib/ldb/ldb_ldap/ldb_ldap.c
@@ -497,9 +497,11 @@ static int lldb_parse_result(struct ldb_handle *handle, LDAPMessage *result)
char **referralsp = NULL;
LDAPControl **serverctrlsp = NULL;
int ret = LDB_SUCCESS;
-
+
type = ldap_msgtype(result);
+ handle->status = 0;
+
switch (type) {
case LDAP_RES_SEARCH_ENTRY:
@@ -631,15 +633,19 @@ static int lldb_parse_result(struct ldb_handle *handle, LDAPMessage *result)
}
if (matcheddnp) ldap_memfree(matcheddnp);
- if (errmsgp) {
+ if (errmsgp && *errmsgp) {
ldb_set_errstring(ac->module->ldb, errmsgp);
+ } else if (handle->status) {
+ ldb_set_errstring(ac->module->ldb, ldap_err2string(handle->status));
+ }
+ if (errmsgp) {
ldap_memfree(errmsgp);
}
if (referralsp) ldap_value_free(referralsp);
if (serverctrlsp) ldap_controls_free(serverctrlsp);
ldap_msgfree(result);
- return ret;
+ return lldb_ldap_to_ldb(handle->status);
error:
handle->state = LDB_ASYNC_DONE;
@@ -816,6 +822,7 @@ static int lldb_connect(struct ldb_context *ldb,
talloc_free(lldb);
return -1;
}
+ talloc_set_name_const(*module, "ldb_ldap backend");
(*module)->ldb = ldb;
(*module)->prev = (*module)->next = NULL;
(*module)->private_data = lldb;