From: Stefan Metzmacher Date: Wed, 21 Nov 2018 19:05:01 +0000 (+0100) Subject: s4:rpc_server/winreg: don't cache an ldb connection per presentation context X-Git-Tag: talloc-2.1.15~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2ed7db445bf2bd1b4ecab437cb1e860d51a58879;p=thirdparty%2Fsamba.git s4:rpc_server/winreg: don't cache an ldb connection per presentation context We should do this per context handle, as these are available on all connections of the association group. BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113 BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892 Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison --- diff --git a/source4/rpc_server/winreg/rpc_winreg.c b/source4/rpc_server/winreg/rpc_winreg.c index d7ae5ac694a..3adaafead7c 100644 --- a/source4/rpc_server/winreg/rpc_winreg.c +++ b/source4/rpc_server/winreg/rpc_winreg.c @@ -29,42 +29,29 @@ enum handle_types { HTYPE_REGVAL, HTYPE_REGKEY }; -static NTSTATUS dcerpc_winreg_bind(struct dcesrv_call_state *dce_call, - const struct dcesrv_interface *iface) -{ - struct auth_session_info *session_info = - dcesrv_call_session_info(dce_call); - struct registry_context *ctx; - WERROR err; - - err = reg_open_samba(dce_call->context, - &ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, - session_info, - NULL); - - if (!W_ERROR_IS_OK(err)) { - DEBUG(0, ("Error opening registry: %s\n", win_errstr(err))); - return werror_to_ntstatus(err); - } - - dce_call->context->private_data = ctx; - - return NT_STATUS_OK; -} - -#define DCESRV_INTERFACE_WINREG_BIND dcerpc_winreg_bind - static WERROR dcesrv_winreg_openhive(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, uint32_t hkey, struct policy_handle **outh) { - struct registry_context *ctx = dce_call->context->private_data; + struct auth_session_info *session_info = + dcesrv_call_session_info(dce_call); + struct registry_context *ctx = NULL; struct dcesrv_handle *h; WERROR result; h = dcesrv_handle_create(dce_call, HTYPE_REGKEY); W_ERROR_HAVE_NO_MEMORY(h); + result = reg_open_samba(h, &ctx, + dce_call->event_ctx, + dce_call->conn->dce_ctx->lp_ctx, + session_info, + NULL); + if (!W_ERROR_IS_OK(result)) { + DEBUG(0, ("Error opening registry: %s\n", win_errstr(result))); + return result; + } + result = reg_get_predefined_key(ctx, hkey, (struct registry_key **)&h->data); if (!W_ERROR_IS_OK(result)) {