From 417c8180c4406e9071ce88cfbe18d15e1f403fc1 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 24 Oct 2023 09:39:09 +0200 Subject: [PATCH] s3:winbind: Always close the policy handle we opened Signed-off-by: Andreas Schneider Reviewed-by: Stefan Metzmacher --- source3/winbindd/winbindd_cm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index 7b136e04f52..a89c0bdbca1 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -2180,10 +2180,11 @@ static bool set_dc_type_and_flags_trustinfo( struct winbindd_domain *domain ) static void set_dc_type_and_flags_connect( struct winbindd_domain *domain ) { NTSTATUS status, result; + NTSTATUS close_status = NT_STATUS_UNSUCCESSFUL; WERROR werr; TALLOC_CTX *mem_ctx = NULL; struct rpc_pipe_client *cli = NULL; - struct policy_handle pol; + struct policy_handle pol = { .handle_type = 0 }; union dssetup_DsRoleInfo info; union lsa_PolicyInformation *lsa_info = NULL; union lsa_revision_info out_revision_info = { @@ -2454,6 +2455,12 @@ no_dssetup: } } done: + if (is_valid_policy_hnd(&pol)) { + dcerpc_lsa_Close(cli->binding_handle, + mem_ctx, + &pol, + &close_status); + } DEBUG(5, ("set_dc_type_and_flags_connect: domain %s is %sin native mode.\n", domain->name, domain->native_mode ? "" : "NOT ")); -- 2.34.1