diff options
author | Simo Sorce <idra@samba.org> | 2006-03-08 01:01:14 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:52:36 -0500 |
commit | 82da2d401e54d0b3124b727fab755d94dd5402d4 (patch) | |
tree | 96670e28213628ea78e1d0bec751a24d17ec61ae /source4/ldap_server | |
parent | 257598424e63c2cfa118b5ea84b7dc719d1dc5aa (diff) | |
download | samba-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/ldap_server')
-rw-r--r-- | source4/ldap_server/ldap_backend.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c index 713d99a2ea..b9f002f157 100644 --- a/source4/ldap_server/ldap_backend.c +++ b/source4/ldap_server/ldap_backend.c @@ -118,7 +118,7 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call) struct ldb_context *samdb = talloc_get_type(call->conn->ldb, struct ldb_context); struct ldb_dn *basedn; struct ldb_result *res = NULL; - struct ldb_request lreq; + struct ldb_request *lreq; enum ldb_scope scope = LDB_SCOPE_DEFAULT; const char **attrs = NULL; const char *errstr = NULL; @@ -172,19 +172,21 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call) DEBUG(5,("ldb_request dn=%s filter=%s\n", req->basedn, ldb_filter_from_tree(call, req->tree))); - ZERO_STRUCT(lreq); - lreq.operation = LDB_REQ_SEARCH; - lreq.op.search.base = basedn; - lreq.op.search.scope = scope; - lreq.op.search.tree = req->tree; - lreq.op.search.attrs = attrs; + lreq = talloc(local_ctx, struct ldb_request); + NT_STATUS_HAVE_NO_MEMORY(local_ctx); + + lreq->operation = LDB_REQ_SEARCH; + lreq->op.search.base = basedn; + lreq->op.search.scope = scope; + lreq->op.search.tree = req->tree; + lreq->op.search.attrs = attrs; - lreq.controls = call->request->controls; + lreq->controls = call->request->controls; - ldb_ret = ldb_request(samdb, &lreq); + ldb_ret = ldb_request(samdb, lreq); /* Ensure we don't keep the search results around for too long */ - res = talloc_steal(local_ctx, lreq.op.search.res); + res = talloc_steal(local_ctx, lreq->op.search.res); if (ldb_ret == LDB_SUCCESS) { for (i = 0; i < res->count; i++) { |