STEP01: librpc/rpc/dcerpc_connection.c dcerpc_connection_destructor NT_STATUS_LOCAL_D...
authorStefan Metzmacher <metze@samba.org>
Wed, 22 Jan 2014 11:00:38 +0000 (12:00 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 4 Jun 2019 10:45:39 +0000 (12:45 +0200)
librpc/rpc/dcerpc_connection.c

index 828c456c6b3462ec6ce68d19f7f30d196eae1505..1b59c6b89401e47f67a0b040d1cea8f828cf67de 100644 (file)
@@ -129,6 +129,8 @@ struct dcerpc_association *dcerpc_association_create(TALLOC_CTX *mem_ctx,
        return assoc;
 }
 
+static int dcerpc_connection_destructor(struct dcerpc_connection *conn);
+
 struct dcerpc_connection *dcerpc_connection_create(TALLOC_CTX *mem_ctx,
                                        struct dcerpc_association *assoc,
                                        struct tstream_context **stream)
@@ -157,6 +159,8 @@ struct dcerpc_connection *dcerpc_connection_create(TALLOC_CTX *mem_ctx,
                return NULL;
        }
 
+       talloc_set_destructor(conn, dcerpc_connection_destructor);
+
        return conn;
 }
 
@@ -209,7 +213,7 @@ static void dcerpc_connection_dead(struct dcerpc_connection *conn,
        }
 
        if (NT_STATUS_EQUAL(NT_STATUS_OK, error)) {
-               error = NT_STATUS_END_OF_FILE;
+               error = NT_STATUS_LOCAL_DISCONNECT;
        }
 
        if (conn->calls.active != NULL) {
@@ -234,6 +238,12 @@ static void dcerpc_connection_dead(struct dcerpc_connection *conn,
        }
 }
 
+static int dcerpc_connection_destructor(struct dcerpc_connection *conn)
+{
+       dcerpc_connection_dead(conn, NT_STATUS_LOCAL_DISCONNECT);
+       return 0;
+}
+
 struct dcerpc_security *dcerpc_security_allocate(
                                        TALLOC_CTX *mem_ctx,
                                        struct dcerpc_connection *conn,