From a8360c4f6b40a669abf82a759c398561bc97aaa6 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Mon, 9 May 2005 16:02:57 +0000 Subject: r6682: patch from Qiao Yang to use out own DC when getting the SID for a domain (This used to be commit 2e0941ebc1d6a9a9498cc5a9f072d501293f8933) --- source3/nsswitch/winbindd_rpc.c | 13 ++++++++----- source3/nsswitch/winbindd_util.c | 9 +++++++-- 2 files changed, 15 insertions(+), 7 deletions(-) (limited to 'source3/nsswitch') diff --git a/source3/nsswitch/winbindd_rpc.c b/source3/nsswitch/winbindd_rpc.c index 1dfa810a8d..faf5a1161f 100644 --- a/source3/nsswitch/winbindd_rpc.c +++ b/source3/nsswitch/winbindd_rpc.c @@ -286,16 +286,19 @@ NTSTATUS msrpc_name_to_sid(struct winbindd_domain *domain, const char *full_name; int retry; - DEBUG(3,("rpc: name_to_sid name=%s\n", name)); - - full_name = talloc_asprintf(mem_ctx, "%s\\%s", domain_name, name); - + if(name == NULL || *name=='\0') { + DEBUG(3,("rpc: name_to_sid name=%s\n", domain_name)); + full_name = talloc_asprintf(mem_ctx, "%s", domain_name); + } else { + DEBUG(3,("rpc: name_to_sid name=%s\\%s\n", domain_name, name)); + full_name = talloc_asprintf(mem_ctx, "%s\\%s", domain_name, name); + } if (!full_name) { DEBUG(0, ("talloc_asprintf failed!\n")); return NT_STATUS_NO_MEMORY; } - DEBUG(3,("name_to_sid [rpc] %s for domain %s\n", name, domain_name )); + DEBUG(3,("name_to_sid [rpc] %s for domain %s\n", name?name:"", domain_name )); retry = 0; do { diff --git a/source3/nsswitch/winbindd_util.c b/source3/nsswitch/winbindd_util.c index d6aef04b4b..739a7ed2a7 100644 --- a/source3/nsswitch/winbindd_util.c +++ b/source3/nsswitch/winbindd_util.c @@ -224,7 +224,7 @@ static void add_trusted_domains( struct winbindd_domain *domain ) /* if the SID was empty, we better set it now */ if ( sid_equal(&dom_sids[i], &null_sid) ) { - + enum SID_NAME_USE type; new_domain = find_domain_from_name(names[i]); /* this should never happen */ @@ -237,7 +237,12 @@ static void add_trusted_domains( struct winbindd_domain *domain ) /* call the cache method; which will operate on the winbindd_domain \ passed in and choose either rpc or ads as appropriate */ - result = domain->methods->domain_sid( new_domain, &new_domain->sid ); + result = domain->methods->name_to_sid( domain, + mem_ctx, + new_domain->name, + NULL, + &new_domain->sid, + &type); if ( NT_STATUS_IS_OK(result) ) sid_copy( &dom_sids[i], &new_domain->sid ); -- cgit