dcesrv_core: Add dcesrv_context_set_callbacks()
authorVolker Lendecke <vl@samba.org>
Tue, 2 Feb 2021 14:10:38 +0000 (15:10 +0100)
committerVolker Lendecke <vl@samba.org>
Fri, 10 Dec 2021 14:02:30 +0000 (14:02 +0000)
We'll need to set custom callbacks on source3's global_dcesrv_ctx,
which right now is deeply embedded. Once we have everything more
nicely layered, this can go again.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
librpc/rpc/dcesrv_core.c
librpc/rpc/dcesrv_core.h

index afbb49d4006fdc8fa520ac143000ed335da41e2e..c0567bb27f0cf51db1be99b0c732ffc2aefd7c3c 100644 (file)
 #include "lib/util/tevent_ntstatus.h"
 #include "system/network.h"
 
+/**
+ * @file
+ * @brief DCERPC server
+ */
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_RPC_SRV
@@ -2453,6 +2457,22 @@ _PUBLIC_ NTSTATUS dcesrv_reinit_context(struct dcesrv_context *dce_ctx)
        return NT_STATUS_OK;
 }
 
+/**
+ * @brief Set callback functions on an existing dcesrv_context
+ *
+ * This allows to reset callbacks initially set via
+ * dcesrv_init_context()
+ *
+ * @param[in] dce_ctx The context to set the callbacks on
+ * @param[in] cb The callbacks to set on dce_ctx
+ */
+_PUBLIC_ void dcesrv_context_set_callbacks(
+       struct dcesrv_context *dce_ctx,
+       struct dcesrv_context_callbacks *cb)
+{
+       dce_ctx->callbacks = cb;
+}
+
 _PUBLIC_ NTSTATUS dcesrv_init_ep_servers(struct dcesrv_context *dce_ctx,
                                         const char **endpoint_servers)
 {
index e20bc00bbc1bdd1103102c5c371d2a8901fecad4..289cdebaa194fce5125c3796b9976188cf7ab48c 100644 (file)
@@ -483,6 +483,9 @@ NTSTATUS dcesrv_init_context(TALLOC_CTX *mem_ctx,
                             struct dcesrv_context_callbacks *cb,
                             struct dcesrv_context **_dce_ctx);
 NTSTATUS dcesrv_reinit_context(struct dcesrv_context *dce_ctx);
+void dcesrv_context_set_callbacks(
+       struct dcesrv_context *dce_ctx,
+       struct dcesrv_context_callbacks *cb);
 
 NTSTATUS dcesrv_reply(struct dcesrv_call_state *call);
 struct dcesrv_handle *dcesrv_handle_create(struct dcesrv_call_state *call,