libcli: Remove a reference to asn1->ofs
authorVolker Lendecke <vl@samba.org>
Mon, 4 Jan 2016 09:30:35 +0000 (10:30 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 28 Mar 2016 22:41:20 +0000 (00:41 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11804

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 3c340d81d8bf2e7b8488b150452bbcc4e3b521b6)

libcli/cldap/cldap.c

index df81767a7606c8b494f876ee9904f399754388fa..2d34337338a00f0f3fcbed8e48535aaabade8b7e 100644 (file)
@@ -220,7 +220,6 @@ nomem:
 static bool cldap_socket_recv_dgram(struct cldap_socket *c,
                                    struct cldap_incoming *in)
 {
-       DATA_BLOB blob;
        struct asn1_data *asn1;
        void *p;
        struct cldap_search_state *search;
@@ -230,16 +229,12 @@ static bool cldap_socket_recv_dgram(struct cldap_socket *c,
                goto error;
        }
 
-       blob = data_blob_const(in->buf, in->len);
-
        asn1 = asn1_init(in);
        if (!asn1) {
                goto nomem;
        }
 
-       if (!asn1_load(asn1, blob)) {
-               goto nomem;
-       }
+       asn1_load_nocopy(asn1, in->buf, in->len);
 
        in->ldap_msg = talloc(in, struct ldap_message);
        if (in->ldap_msg == NULL) {
@@ -267,8 +262,11 @@ static bool cldap_socket_recv_dgram(struct cldap_socket *c,
 
        search = talloc_get_type_abort(p, struct cldap_search_state);
        search->response.in = talloc_move(search, &in);
+
        search->response.asn1 = asn1;
-       search->response.asn1->ofs = 0;
+
+       asn1_load_nocopy(search->response.asn1,
+                        search->response.in->buf, search->response.in->len);
 
        DLIST_REMOVE(c->searches.list, search);