summaryrefslogtreecommitdiff
path: root/source4/libcli/cldap
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-05-22 00:43:10 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:52:45 -0500
commit86b91f50731d5e8a3497027d8ac7b2ca001eeaa7 (patch)
treef2ba8a332ddb6cd6593e41a9296e499188ba8339 /source4/libcli/cldap
parent31f047f734d763ac6661f33afae8f39cf2fd4bd4 (diff)
downloadsamba-86b91f50731d5e8a3497027d8ac7b2ca001eeaa7.tar.gz
samba-86b91f50731d5e8a3497027d8ac7b2ca001eeaa7.tar.bz2
samba-86b91f50731d5e8a3497027d8ac7b2ca001eeaa7.zip
r23058: the cldap code was getting too intimate with the internals of struct
asn1_context. A hangover from when it wasn't a allocated structure (This used to be commit e4b7968a40e11a96a0b9671f8ef5436f18427818)
Diffstat (limited to 'source4/libcli/cldap')
-rw-r--r--source4/libcli/cldap/cldap.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source4/libcli/cldap/cldap.c b/source4/libcli/cldap/cldap.c
index bd2ab630db..51bab37e97 100644
--- a/source4/libcli/cldap/cldap.c
+++ b/source4/libcli/cldap/cldap.c
@@ -100,7 +100,6 @@ static void cldap_socket_recv(struct cldap_socket *cldap)
talloc_free(tmp_ctx);
return;
}
- talloc_steal(tmp_ctx, asn1->data);
ldap_msg = talloc(tmp_ctx, struct ldap_message);
if (ldap_msg == NULL) {
@@ -129,8 +128,7 @@ static void cldap_socket_recv(struct cldap_socket *cldap)
return;
}
- req->asn1 = asn1;
- talloc_steal(req, asn1->data);
+ req->asn1 = talloc_steal(req, asn1);
req->asn1->ofs = 0;
req->state = CLDAP_REQUEST_DONE;
@@ -312,6 +310,10 @@ struct cldap_request *cldap_search_send(struct cldap_socket *cldap,
req->timeout = io->in.timeout;
req->num_retries = io->in.retries;
req->is_reply = False;
+ req->asn1 = asn1_init(req);
+ if (!req->asn1) {
+ goto failed;
+ }
req->dest = socket_address_from_strings(req, cldap->sock->backend_name,
io->in.dest_address, lp_cldap_port());
@@ -376,6 +378,10 @@ NTSTATUS cldap_reply_send(struct cldap_socket *cldap, struct cldap_reply *io)
req->cldap = cldap;
req->state = CLDAP_REQUEST_SEND;
req->is_reply = True;
+ req->asn1 = asn1_init(req);
+ if (!req->asn1) {
+ goto failed;
+ }
req->dest = io->dest;
if (talloc_reference(req, io->dest) == NULL) goto failed;