summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-05-15 16:59:46 +0200
committerGünther Deschner <gd@samba.org>2008-05-15 16:59:46 +0200
commit4d593cdb19ec228adbf30cc8c408521e5770167c (patch)
tree9b6f8dde5d158de6cc0d8e6c7f82e298b4cfb508 /source3
parent2e8b43c58d6d276ef5856816f0259df51ccd9837 (diff)
downloadsamba-4d593cdb19ec228adbf30cc8c408521e5770167c.tar.gz
samba-4d593cdb19ec228adbf30cc8c408521e5770167c.tar.bz2
samba-4d593cdb19ec228adbf30cc8c408521e5770167c.zip
dsgetdcname: add site support.
Guenther (This used to be commit e305368538eaa72e3008a5517db3708936924297)
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/dsgetdcname.c18
1 files changed, 14 insertions, 4 deletions
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;
}