From 4d593cdb19ec228adbf30cc8c408521e5770167c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 15 May 2008 16:59:46 +0200 Subject: dsgetdcname: add site support. Guenther (This used to be commit e305368538eaa72e3008a5517db3708936924297) --- source3/libsmb/dsgetdcname.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'source3') diff --git a/source3/libsmb/dsgetdcname.c b/source3/libsmb/dsgetdcname.c index 3326c10f5e..16148a39d5 100644 --- a/source3/libsmb/dsgetdcname.c +++ b/source3/libsmb/dsgetdcname.c @@ -1390,6 +1390,7 @@ NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx, { NTSTATUS status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND; struct netr_DsRGetDCNameInfo *myinfo = NULL; + char *query_site = NULL; DEBUG(10,("dsgetdcname: domain_name: %s, " "domain_guid: %s, site_name: %s, flags: 0x%08x\n", @@ -1404,29 +1405,38 @@ NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx, return NT_STATUS_INVALID_PARAMETER; } + if (!site_name) { + query_site = sitename_fetch(domain_name); + } else { + query_site = SMB_STRDUP(site_name); + } + if (flags & DS_FORCE_REDISCOVERY) { goto rediscover; } status = dsgetdcname_cached(mem_ctx, msg_ctx, domain_name, domain_guid, - flags, site_name, &myinfo); + flags, query_site, &myinfo); if (NT_STATUS_IS_OK(status)) { *info = myinfo; - return status; + goto done; } if (flags & DS_BACKGROUND_ONLY) { - return status; + goto done; } rediscover: status = dsgetdcname_rediscover(mem_ctx, msg_ctx, domain_name, - domain_guid, flags, site_name, + domain_guid, flags, query_site, &myinfo); if (NT_STATUS_IS_OK(status)) { *info = myinfo; } + done: + SAFE_FREE(query_site); + return status; } -- cgit