1
0
mirror of https://github.com/samba-team/samba.git synced 2025-11-25 00:23:52 +03:00

r19732: The 'res' from ldb_search is only valid if the call returns LDB_SUCCESS.

This seems to show up (as an abort() from talloc) particularly under
ldb_ildap.

Andrew Bartlett
This commit is contained in:
Andrew Bartlett
2006-11-16 09:34:19 +00:00
committed by Gerald (Jerry) Carter
parent 186766e309
commit 9890af534d
2 changed files with 7 additions and 4 deletions

View File

@@ -200,9 +200,12 @@ static struct ldb_dn *samldb_search_domain(struct ldb_module *module, TALLOC_CTX
do {
ret = ldb_search(module->ldb, sdn, LDB_SCOPE_BASE,
"(|(objectClass=domain)(objectClass=builtinDomain))", attrs, &res);
talloc_steal(local_ctx, res);
if (ret == LDB_SUCCESS && res->count == 1)
break;
if (ret == LDB_SUCCESS) {
talloc_steal(local_ctx, res);
if (res->count == 1) {
break;
}
}
} while ((sdn = ldb_dn_get_parent(local_ctx, sdn)));
if (ret != LDB_SUCCESS || res->count != 1) {

View File

@@ -111,8 +111,8 @@ static int ejs_ldbSearch(MprVarHandle eid, int argc, struct MprVar **argv)
mpr_Return(eid, mprCreateUndefinedVar());
} else {
mpr_Return(eid, mprLdbArray(ldb, res->msgs, res->count, "ldb_message"));
talloc_free(res);
}
talloc_free(res);
talloc_free(tmp_ctx);
return 0;