From 28af08292635d1eecbf6e020957b03bb5f57b199 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 27 Feb 2024 09:59:09 +0100 Subject: [PATCH] s3:winbindd: make use of winbindd_get_trust_credentials() in idmap_ad.c Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider --- source3/winbindd/idmap_ad.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/source3/winbindd/idmap_ad.c b/source3/winbindd/idmap_ad.c index a1b1ef657fd..df14ca818dc 100644 --- a/source3/winbindd/idmap_ad.c +++ b/source3/winbindd/idmap_ad.c @@ -299,6 +299,7 @@ static NTSTATUS idmap_ad_get_tldap_ctx(TALLOC_CTX *mem_ctx, { struct netr_DsRGetDCNameInfo *dcinfo; struct sockaddr_storage dcaddr; + struct winbindd_domain *creds_domain = NULL; struct cli_credentials *creds; struct loadparm_context *lp_ctx; struct tldap_context *ld; @@ -394,13 +395,20 @@ static NTSTATUS idmap_ad_get_tldap_ctx(TALLOC_CTX *mem_ctx, * Here we use or own machine account as * we run as domain member. */ - status = pdb_get_trust_credentials(lp_workgroup(), - lp_realm(), - dcinfo, - &creds); + creds_domain = find_our_domain(); + if (creds_domain == NULL) { + DBG_ERR("find_our_domain() returned NULL\n"); + TALLOC_FREE(dcinfo); + return NT_STATUS_INTERNAL_ERROR; + } + status = winbindd_get_trust_credentials(creds_domain, + dcinfo, + false, /* netlogon */ + false, /* ipc_fallback */ + &creds); if (!NT_STATUS_IS_OK(status)) { - DBG_DEBUG("pdb_get_trust_credentials() failed - %s\n", - nt_errstr(status)); + DBG_ERR("winbindd_get_trust_credentials(%s) failed - %s\n", + creds_domain->name, nt_errstr(status)); TALLOC_FREE(dcinfo); return status; } -- 2.11.4.GIT