summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-04-23 11:25:02 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:04:12 -0500
commit2283810356c9836072b1f948228f6b47f25e9e98 (patch)
treeb2575cd1850bfca0581464ce5f358dd554c907d7
parent041456554e32166ce3612ef62cf76e504de30696 (diff)
downloadsamba-2283810356c9836072b1f948228f6b47f25e9e98.tar.gz
samba-2283810356c9836072b1f948228f6b47f25e9e98.tar.bz2
samba-2283810356c9836072b1f948228f6b47f25e9e98.zip
r15176: Ensure we don't segfault when we try and delete @FOO records.
Don't try and steal the result of a search on failure, it has already been talloc_free()'ed by the ildb code. Andrew Bartlett (This used to be commit a99bd2e033501954aca8f35afe8a7f2bbfadf6b7)
-rw-r--r--source4/lib/ldb/common/ldb.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c
index eef02bd760..a681811cb9 100644
--- a/source4/lib/ldb/common/ldb.c
+++ b/source4/lib/ldb/common/ldb.c
@@ -244,6 +244,10 @@ int ldb_transaction_cancel(struct ldb_context *ldb)
int ldb_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_type type)
{
+ if (!handle) {
+ return LDB_SUCCESS;
+ }
+
return handle->module->ops->async_wait(handle, type);
}
@@ -308,9 +312,9 @@ int ldb_request(struct ldb_context *ldb, struct ldb_request *req)
/*
search the database given a LDAP-like search expression
- return the number of records found, or -1 on error
+ returns an LDB error code
- Use talloc_free to free the ldb_message returned in 'res'
+ Use talloc_free to free the ldb_message returned in 'res', if successful
*/
int ldb_search(struct ldb_context *ldb,
@@ -346,9 +350,10 @@ int ldb_search(struct ldb_context *ldb,
req->controls = NULL;
ret = ldb_request(ldb, req);
-
- (*res) = talloc_steal(ldb, req->op.search.res);
-
+
+ if (ret == LDB_SUCCESS) {
+ (*res) = talloc_steal(ldb, req->op.search.res);
+ }
talloc_free(req);
return ret;
}