summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/modules
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-03-08 01:01:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:52:36 -0500
commit82da2d401e54d0b3124b727fab755d94dd5402d4 (patch)
tree96670e28213628ea78e1d0bec751a24d17ec61ae /source4/lib/ldb/modules
parent257598424e63c2cfa118b5ea84b7dc719d1dc5aa (diff)
downloadsamba-82da2d401e54d0b3124b727fab755d94dd5402d4.tar.gz
samba-82da2d401e54d0b3124b727fab755d94dd5402d4.tar.bz2
samba-82da2d401e54d0b3124b727fab755d94dd5402d4.zip
r13998: From now on ldb_request() will require an alloced request
By freeing the request you will be sure everything down the path get freed. this also means you have to steal the results if you want to keep them :) simo. (This used to be commit e8075e6a062ce5edb84485e45d0b841c2ee2af7d)
Diffstat (limited to 'source4/lib/ldb/modules')
-rw-r--r--source4/lib/ldb/modules/paged_results.c21
-rw-r--r--source4/lib/ldb/modules/sort.c19
2 files changed, 28 insertions, 12 deletions
diff --git a/source4/lib/ldb/modules/paged_results.c b/source4/lib/ldb/modules/paged_results.c
index 9d6a50e27f..fd0cc7c90b 100644
--- a/source4/lib/ldb/modules/paged_results.c
+++ b/source4/lib/ldb/modules/paged_results.c
@@ -249,29 +249,36 @@ static int paged_request(struct ldb_module *module, struct ldb_request *req)
static int paged_request_init(struct ldb_module *module)
{
- struct ldb_request request;
- int ret;
struct private_data *data;
+ struct ldb_request *req;
+ int ret;
data = talloc(module, struct private_data);
if (data == NULL) {
return LDB_ERR_OTHER;
}
-
+
data->next_free_id = 1;
data->store = NULL;
module->private_data = data;
- request.operation = LDB_REQ_REGISTER;
- request.op.reg.oid = LDB_CONTROL_PAGED_RESULTS_OID;
- request.controls = NULL;
+ req = talloc(module, struct ldb_request);
+ if (req == NULL) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ req->operation = LDB_REQ_REGISTER;
+ req->op.reg.oid = LDB_CONTROL_PAGED_RESULTS_OID;
+ req->controls = NULL;
- ret = ldb_request(module->ldb, &request);
+ ret = ldb_request(module->ldb, req);
if (ret != LDB_SUCCESS) {
ldb_debug(module->ldb, LDB_DEBUG_ERROR, "paged_request: Unable to register control with rootdse!\n");
+ talloc_free(req);
return LDB_ERR_OTHER;
}
+ talloc_free(req);
return ldb_next_init(module);
}
diff --git a/source4/lib/ldb/modules/sort.c b/source4/lib/ldb/modules/sort.c
index 82b589c749..08047c21f5 100644
--- a/source4/lib/ldb/modules/sort.c
+++ b/source4/lib/ldb/modules/sort.c
@@ -395,6 +395,8 @@ static int server_sort_search_async(struct ldb_module *module, struct ldb_contro
ac->reverse = sort_ctrls[0]->reverse;
ac->req = talloc(req, struct ldb_request);
+ if (!ac->req)
+ return LDB_ERR_OPERATIONS_ERROR;
ac->req->operation = req->operation;
ac->req->op.search.base = req->op.search.base;
@@ -548,19 +550,26 @@ static int server_sort_async_wait(struct ldb_async_handle *handle, enum ldb_asyn
static int server_sort_init(struct ldb_module *module)
{
- struct ldb_request request;
+ struct ldb_request *req;
int ret;
- request.operation = LDB_REQ_REGISTER;
- request.op.reg.oid = LDB_CONTROL_SERVER_SORT_OID;
- request.controls = NULL;
+ req = talloc(module, struct ldb_request);
+ if (req == NULL) {
+ return LDB_ERR_OPERATIONS_ERROR;
+ }
+
+ req->operation = LDB_REQ_REGISTER;
+ req->op.reg.oid = LDB_CONTROL_SERVER_SORT_OID;
+ req->controls = NULL;
- ret = ldb_request(module->ldb, &request);
+ ret = ldb_request(module->ldb, req);
if (ret != LDB_SUCCESS) {
ldb_debug(module->ldb, LDB_DEBUG_ERROR, "server_sort: Unable to register control with rootdse!\n");
+ talloc_free(req);
return LDB_ERR_OTHER;
}
+ talloc_free(req);
return ldb_next_init(module);
}