1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

librpc:core: Add a function to reinitialize the dcesrv_context

Clears all registered endpoints and interfaces, association groups and
broken connections.

To be used by S3 forked daemons.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Samuel Cabrero 2019-10-01 16:59:07 +02:00 committed by Andrew Bartlett
parent 90eb485cf9
commit 79af978c81
2 changed files with 30 additions and 0 deletions

View File

@ -2349,6 +2349,35 @@ _PUBLIC_ NTSTATUS dcesrv_init_context(TALLOC_CTX *mem_ctx,
return NT_STATUS_OK;
}
_PUBLIC_ NTSTATUS dcesrv_reinit_context(struct dcesrv_context *dce_ctx)
{
NTSTATUS status;
status = dcesrv_shutdown_registered_ep_servers(dce_ctx);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
/* Clear endpoints */
while (dce_ctx->endpoint_list != NULL) {
struct dcesrv_endpoint *e = dce_ctx->endpoint_list;
DLIST_REMOVE(dce_ctx->endpoint_list, e);
TALLOC_FREE(e);
}
/* Remove broken connections */
dcesrv_cleanup_broken_connections(dce_ctx);
/* Reinit assoc group idr */
TALLOC_FREE(dce_ctx->assoc_groups_idr);
dce_ctx->assoc_groups_idr = idr_init(dce_ctx);
if (dce_ctx->assoc_groups_idr == NULL) {
return NT_STATUS_NO_MEMORY;
}
return NT_STATUS_OK;
}
_PUBLIC_ NTSTATUS dcesrv_init_ep_servers(struct dcesrv_context *dce_ctx,
const char **endpoint_servers)
{

View File

@ -458,6 +458,7 @@ NTSTATUS dcesrv_init_context(TALLOC_CTX *mem_ctx,
struct loadparm_context *lp_ctx,
struct dcesrv_context_callbacks *cb,
struct dcesrv_context **_dce_ctx);
NTSTATUS dcesrv_reinit_context(struct dcesrv_context *dce_ctx);
NTSTATUS dcesrv_reply(struct dcesrv_call_state *call);
struct dcesrv_handle *dcesrv_handle_create(struct dcesrv_call_state *call,