r11872: another attempt at fixing the data_blob_free in async dcerpc bind,
authorAndrew Tridgell <tridge@samba.org>
Wed, 23 Nov 2005 07:33:09 +0000 (07:33 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:46:39 +0000 (13:46 -0500)
after volker gently pointed out that I should be wearing a paper bag
over my head for the last attempt :-)
(This used to be commit 7e132761fce75f64d3e7d42f650c45a483e37e3e)

source4/librpc/rpc/dcerpc.c

index 2c90c62ef5be8381dc4fc4fa85aec9e105ccc00e..b485864c7b51d159d34221871e5ff0bfd562f9e8 100644 (file)
@@ -565,15 +565,19 @@ static void dcerpc_recv_data(struct dcerpc_connection *conn, DATA_BLOB *blob, NT
        }
 
        switch (pkt.ptype) {
-       case DCERPC_PKT_BIND_ACK:
        case DCERPC_PKT_BIND_NAK:
-               dcerpc_bind_recv_data(conn, &pkt);
-               data_blob_free(blob);
+       case DCERPC_PKT_BIND_ACK:
+               if (conn->bind_private) {
+                       talloc_steal(conn->bind_private, blob->data);
+                       dcerpc_bind_recv_data(conn, &pkt);
+               }
                break;
 
        case DCERPC_PKT_ALTER_RESP:
-               dcerpc_alter_recv_data(conn, &pkt);
-               data_blob_free(blob);
+               if (conn->alter_private) {
+                       talloc_steal(conn->alter_private, blob->data);
+                       dcerpc_alter_recv_data(conn, &pkt);
+               }
                break;
 
        default:
@@ -592,10 +596,6 @@ static void dcerpc_bind_recv_data(struct dcerpc_connection *conn, struct ncacn_p
        struct composite_context *c;
        struct dcerpc_pipe *pipe;
 
-       if (conn->bind_private == NULL) {
-               /* it timed out earlier */
-               return;
-       }
        c = talloc_get_type(conn->bind_private, struct composite_context);
        pipe = talloc_get_type(c->private_data, struct dcerpc_pipe);
 
@@ -1526,11 +1526,6 @@ static void dcerpc_alter_recv_data(struct dcerpc_connection *conn, struct ncacn_
        struct composite_context *c;
        struct dcerpc_pipe *pipe;
 
-       if (conn->alter_private == NULL) {
-               /* it timed out earlier */
-               return;
-       }
-
        c = talloc_get_type(conn->alter_private, struct composite_context);
        pipe = talloc_get_type(c->private_data, struct dcerpc_pipe);