From: Volker Lendecke Date: Tue, 2 Feb 2021 14:10:38 +0000 (+0100) Subject: dcesrv_core: Add dcesrv_context_set_callbacks() X-Git-Tag: tdb-1.4.6~367 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3284ee9985d8cc0dd2086b03acee4937fefcd5e0;p=thirdparty%2Fsamba.git dcesrv_core: Add dcesrv_context_set_callbacks() 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 Reviewed-by: Samuel Cabrero Reviewed-by: Jeremy Allison Reviewed-by: Stefan Metzmacher --- diff --git a/librpc/rpc/dcesrv_core.c b/librpc/rpc/dcesrv_core.c index afbb49d4006..c0567bb27f0 100644 --- a/librpc/rpc/dcesrv_core.c +++ b/librpc/rpc/dcesrv_core.c @@ -35,6 +35,10 @@ #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) { diff --git a/librpc/rpc/dcesrv_core.h b/librpc/rpc/dcesrv_core.h index e20bc00bbc1..289cdebaa19 100644 --- a/librpc/rpc/dcesrv_core.h +++ b/librpc/rpc/dcesrv_core.h @@ -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,