r12608: Remove some unused #include lines.
[abartlet/samba.git/.git] / source4 / libcli / cldap / cldap.c
index 79cdff2437be90bde5018dfead427ad15ef1b6b2..d406b50baf385039c26ede70761e132d2b16b56f 100644 (file)
@@ -38,7 +38,6 @@
 #include "libcli/ldap/ldap.h"
 #include "libcli/cldap/cldap.h"
 #include "lib/socket/socket.h"
-#include "include/asn_1.h"
 
 /*
   destroy a pending request
@@ -93,7 +92,7 @@ static void cldap_socket_recv(struct cldap_socket *cldap)
        blob.length = nread;
 
        DEBUG(2,("Received cldap packet of length %d from %s:%d\n", 
-                blob.length, src_addr, src_port));
+                (int)blob.length, src_addr, src_port));
 
        if (!asn1_load(&asn1, blob)) {
                DEBUG(2,("Failed to setup for asn.1 decode\n"));
@@ -188,7 +187,7 @@ static void cldap_socket_send(struct cldap_socket *cldap)
                                       req->dest_addr, req->dest_port);
                if (NT_STATUS_IS_ERR(status)) {
                        DEBUG(3,("Failed to send cldap request of length %u to %s:%d\n",
-                                req->encoded.length, req->dest_addr, req->dest_port));
+                                (unsigned)req->encoded.length, req->dest_addr, req->dest_port));
                        DLIST_REMOVE(cldap->send_queue, req);
                        talloc_free(req);
                        continue;
@@ -337,12 +336,11 @@ struct cldap_request *cldap_search_send(struct cldap_socket *cldap,
                goto failed;
        }
 
-       if (!ldap_encode(msg, &req->encoded)) {
+       if (!ldap_encode(msg, &req->encoded, req)) {
                DEBUG(0,("Failed to encode cldap message to %s:%d\n",
                         req->dest_addr, req->dest_port));
                goto failed;
        }
-       talloc_steal(req, req->encoded.data);
 
        DLIST_ADD_END(cldap->send_queue, req, struct cldap_request *);
 
@@ -389,13 +387,12 @@ NTSTATUS cldap_reply_send(struct cldap_socket *cldap, struct cldap_reply *io)
                msg->type = LDAP_TAG_SearchResultEntry;
                msg->r.SearchResultEntry = *io->response;
 
-               if (!ldap_encode(msg, &blob1)) {
+               if (!ldap_encode(msg, &blob1, req)) {
                        DEBUG(0,("Failed to encode cldap message to %s:%d\n",
                                 req->dest_addr, req->dest_port));
                        status = NT_STATUS_INVALID_PARAMETER;
                        goto failed;
                }
-               talloc_steal(req, blob1.data);
        } else {
                blob1 = data_blob(NULL, 0);
        }
@@ -403,13 +400,12 @@ NTSTATUS cldap_reply_send(struct cldap_socket *cldap, struct cldap_reply *io)
        msg->type = LDAP_TAG_SearchResultDone;
        msg->r.SearchResultDone = *io->result;
 
-       if (!ldap_encode(msg, &blob2)) {
+       if (!ldap_encode(msg, &blob2, req)) {
                DEBUG(0,("Failed to encode cldap message to %s:%d\n",
                         req->dest_addr, req->dest_port));
                status = NT_STATUS_INVALID_PARAMETER;
                goto failed;
        }
-       talloc_steal(req, blob2.data);
 
        req->encoded = data_blob_talloc(req, NULL, blob1.length + blob2.length);
        if (req->encoded.data == NULL) goto failed;