rpc_server3: Inline pipes_struct into dcerpc_ncacn_conn
authorVolker Lendecke <vl@samba.org>
Wed, 6 Oct 2021 10:20:17 +0000 (12:20 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 5 Jan 2022 00:11:38 +0000 (00:11 +0000)
This makes it clear that our internal representation of a rpc client
connection in the source3/ server is struct dcerpc_ncacn_conn and that
struct pipes_struct is only around for API compatibility with the
existing server stubs.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/rpc_server/rpc_server.c
source3/rpc_server/rpc_server.h
source3/rpc_server/rpc_worker.c
source3/winbindd/winbindd_dual_ndr.c

index b42667850e3ec43d847fe791a379c51e71cc1a2a..32fbb78f5ffb398965b6887bee04876ea6529ddc 100644 (file)
@@ -299,7 +299,7 @@ struct pipes_struct *dcesrv_get_pipes_struct(struct dcesrv_connection *conn)
                        conn->transport.private_data,
                        struct dcerpc_ncacn_conn);
 
-       return ncacn_conn->p;
+       return &ncacn_conn->p;
 }
 
 /* vim: set ts=8 sw=8 noet cindent syntax=c.doxygen: */
index 4e0eda73d006e3b78d086a0f5186c3437b687852..73cd78ac6a419891eb2cf1cd35e1cc9aceccb43a 100644 (file)
@@ -23,8 +23,8 @@
 #include "librpc/rpc/rpc_common.h" /* For enum dcerpc_transport_t */
 
 #include "librpc/rpc/dcesrv_core.h"
+#include "rpc_pipes.h"
 
-struct pipes_struct;
 struct auth_session_info;
 struct cli_credentials;
 
@@ -35,7 +35,7 @@ struct dcerpc_ncacn_conn {
        struct dcerpc_ncacn_conn *prev, *next;
        int sock;
 
-       struct pipes_struct *p;
+       struct pipes_struct p;
        dcerpc_ncacn_termination_fn termination_fn;
        void *termination_data;
 
index b3720e8f1f042e5d3bc1ac7ff091679021c548c6..dc5df4075e6566ffd64b7f297ab0d9a7389394cb 100644 (file)
@@ -383,13 +383,8 @@ static void rpc_worker_new_client(
                goto fail;
        }
 
-       ncacn_conn->p = talloc_zero(ncacn_conn, struct pipes_struct);
-       if (ncacn_conn->p == NULL) {
-               DBG_DEBUG("talloc failed\n");
-               goto fail;
-       }
-       ncacn_conn->p->msg_ctx = global_messaging_context();
-       ncacn_conn->p->transport = transport;
+       ncacn_conn->p.msg_ctx = global_messaging_context();
+       ncacn_conn->p.transport = transport;
 
        status = dcesrv_endpoint_connect(
                dce_ctx,
index be58b27e79d8873e3baf151eeb9ca8c4d0ef283b..aa43849906d947b9d0f575f4867a076f7e65cb90 100644 (file)
@@ -328,27 +328,17 @@ static NTSTATUS make_internal_ncacn_conn(TALLOC_CTX *mem_ctx,
                                struct dcerpc_ncacn_conn **_out)
 {
        struct dcerpc_ncacn_conn *ncacn_conn = NULL;
-       NTSTATUS status;
 
        ncacn_conn = talloc_zero(mem_ctx, struct dcerpc_ncacn_conn);
        if (ncacn_conn == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
 
-       ncacn_conn->p = talloc_zero(ncacn_conn, struct pipes_struct);
-       if (ncacn_conn->p == NULL) {
-               status = NT_STATUS_NO_MEMORY;
-               goto fail;
-       }
-       ncacn_conn->p->mem_ctx = mem_ctx;
+       ncacn_conn->p.mem_ctx = mem_ctx;
 
        *_out = ncacn_conn;
 
        return NT_STATUS_OK;
-
-fail:
-       talloc_free(ncacn_conn);
-       return status;
 }
 
 static NTSTATUS find_ncalrpc_default_endpoint(struct dcesrv_context *dce_ctx,