summaryrefslogtreecommitdiff
path: root/source4/ldap_server/ldap_backend.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-06-15 00:27:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:18:12 -0500
commitc0947b0d7f809f5139fbfcdbd618ed7b0a77d2be (patch)
tree7c0d7391b8f27d55e40b22f2c16315356e10a167 /source4/ldap_server/ldap_backend.c
parent74a3621089d4d1e9ba4c1a02e44247d1cff29200 (diff)
downloadsamba-c0947b0d7f809f5139fbfcdbd618ed7b0a77d2be.tar.gz
samba-c0947b0d7f809f5139fbfcdbd618ed7b0a77d2be.tar.bz2
samba-c0947b0d7f809f5139fbfcdbd618ed7b0a77d2be.zip
r7593: simplified the memory management in the ldap code. Having a mem_ctx
element in a structure is not necessary any more. (This used to be commit 912d0427f52eac811b27bf7e385b0642f7dc7f53)
Diffstat (limited to 'source4/ldap_server/ldap_backend.c')
-rw-r--r--source4/ldap_server/ldap_backend.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/source4/ldap_server/ldap_backend.c b/source4/ldap_server/ldap_backend.c
index 1c2ba87018..6ac9839e29 100644
--- a/source4/ldap_server/ldap_backend.c
+++ b/source4/ldap_server/ldap_backend.c
@@ -32,12 +32,16 @@ struct ldapsrv_reply *ldapsrv_init_reply(struct ldapsrv_call *call, uint8_t type
if (!reply) {
return NULL;
}
+ reply->msg = talloc(reply, struct ldap_message);
+ if (reply->msg == NULL) {
+ talloc_free(reply);
+ return NULL;
+ }
reply->prev = reply->next = NULL;
reply->state = LDAPSRV_REPLY_STATE_NEW;
- reply->msg.messageid = call->request.messageid;
- reply->msg.type = type;
- reply->msg.mem_ctx = reply;
+ reply->msg->messageid = call->request->messageid;
+ reply->msg->type = type;
return reply;
}
@@ -63,14 +67,14 @@ NTSTATUS ldapsrv_unwilling(struct ldapsrv_call *call, int error)
struct ldapsrv_reply *reply;
struct ldap_ExtendedResponse *r;
- DEBUG(10,("Unwilling type[%d] id[%d]\n", call->request.type, call->request.messageid));
+ DEBUG(10,("Unwilling type[%d] id[%d]\n", call->request->type, call->request->messageid));
reply = ldapsrv_init_reply(call, LDAP_TAG_ExtendedResponse);
if (!reply) {
return NT_STATUS_NO_MEMORY;
}
- r = &reply->msg.r.ExtendedResponse;
+ r = &reply->msg->r.ExtendedResponse;
r->response.resultcode = error;
r->response.dn = NULL;
r->response.errormessage = NULL;
@@ -84,7 +88,7 @@ NTSTATUS ldapsrv_unwilling(struct ldapsrv_call *call, int error)
static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call)
{
- struct ldap_SearchRequest *req = &call->request.r.SearchRequest;
+ struct ldap_SearchRequest *req = &call->request->r.SearchRequest;
struct ldapsrv_partition *part;
DEBUG(10, ("SearchRequest"));
@@ -102,7 +106,7 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call)
return NT_STATUS_NO_MEMORY;
}
- done = &done_r->msg.r.SearchResultDone;
+ done = &done_r->msg->r.SearchResultDone;
done->resultcode = 53;
done->dn = NULL;
done->errormessage = NULL;
@@ -116,7 +120,7 @@ static NTSTATUS ldapsrv_SearchRequest(struct ldapsrv_call *call)
static NTSTATUS ldapsrv_ModifyRequest(struct ldapsrv_call *call)
{
- struct ldap_ModifyRequest *req = &call->request.r.ModifyRequest;
+ struct ldap_ModifyRequest *req = &call->request->r.ModifyRequest;
struct ldapsrv_partition *part;
DEBUG(10, ("ModifyRequest"));
@@ -133,7 +137,7 @@ static NTSTATUS ldapsrv_ModifyRequest(struct ldapsrv_call *call)
static NTSTATUS ldapsrv_AddRequest(struct ldapsrv_call *call)
{
- struct ldap_AddRequest *req = &call->request.r.AddRequest;
+ struct ldap_AddRequest *req = &call->request->r.AddRequest;
struct ldapsrv_partition *part;
DEBUG(10, ("AddRequest"));
@@ -150,7 +154,7 @@ static NTSTATUS ldapsrv_AddRequest(struct ldapsrv_call *call)
static NTSTATUS ldapsrv_DelRequest(struct ldapsrv_call *call)
{
- struct ldap_DelRequest *req = &call->request.r.DelRequest;
+ struct ldap_DelRequest *req = &call->request->r.DelRequest;
struct ldapsrv_partition *part;
DEBUG(10, ("DelRequest"));
@@ -167,7 +171,7 @@ static NTSTATUS ldapsrv_DelRequest(struct ldapsrv_call *call)
static NTSTATUS ldapsrv_ModifyDNRequest(struct ldapsrv_call *call)
{
- struct ldap_ModifyDNRequest *req = &call->request.r.ModifyDNRequest;
+ struct ldap_ModifyDNRequest *req = &call->request->r.ModifyDNRequest;
struct ldapsrv_partition *part;
DEBUG(10, ("ModifyDNRequrest"));
@@ -185,7 +189,7 @@ static NTSTATUS ldapsrv_ModifyDNRequest(struct ldapsrv_call *call)
static NTSTATUS ldapsrv_CompareRequest(struct ldapsrv_call *call)
{
- struct ldap_CompareRequest *req = &call->request.r.CompareRequest;
+ struct ldap_CompareRequest *req = &call->request->r.CompareRequest;
struct ldapsrv_partition *part;
DEBUG(10, ("CompareRequest"));
@@ -219,14 +223,14 @@ static NTSTATUS ldapsrv_ExtendedRequest(struct ldapsrv_call *call)
return NT_STATUS_NO_MEMORY;
}
- ZERO_STRUCT(reply->msg.r);
+ ZERO_STRUCT(reply->msg->r);
return ldapsrv_queue_reply(call, reply);
}
NTSTATUS ldapsrv_do_call(struct ldapsrv_call *call)
{
- switch(call->request.type) {
+ switch(call->request->type) {
case LDAP_TAG_BindRequest:
return ldapsrv_BindRequest(call);
case LDAP_TAG_UnbindRequest: