diff options
author | Jeremy Allison <jra@samba.org> | 2013-09-03 12:08:46 -0700 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2013-09-04 08:41:33 +1200 |
commit | 181c11066bd53b07015a199f56eb71182e89ff71 (patch) | |
tree | 3dc9372f66a1b40a788560248d54ccbf092b4842 /source3/libsmb | |
parent | 66006be7ef703b2935334633d27641050cee5f58 (diff) | |
download | samba-181c11066bd53b07015a199f56eb71182e89ff71.tar.gz samba-181c11066bd53b07015a199f56eb71182e89ff71.tar.bz2 samba-181c11066bd53b07015a199f56eb71182e89ff71.zip |
Move the manipulation of site_name into the caller function dsgetdcname().
Leave dsgetdcname_internal() only using const char *site_name.
Bug 5917 - Samba does not work on site with Read Only Domain Controller
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Richard Sharpe <rsharpe@samba.org>
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/dsgetdcname.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/source3/libsmb/dsgetdcname.c b/source3/libsmb/dsgetdcname.c index 819fa20c23..cad212827d 100644 --- a/source3/libsmb/dsgetdcname.c +++ b/source3/libsmb/dsgetdcname.c @@ -1106,7 +1106,6 @@ static NTSTATUS dsgetdcname_internal(TALLOC_CTX *mem_ctx, { NTSTATUS status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND; struct netr_DsRGetDCNameInfo *myinfo = NULL; - char *query_site = NULL; bool first = true; struct netr_DsRGetDCNameInfo *first_info = NULL; @@ -1114,7 +1113,7 @@ static NTSTATUS dsgetdcname_internal(TALLOC_CTX *mem_ctx, "domain_guid: %s, site_name: %s, flags: 0x%08x\n", domain_name, domain_guid ? GUID_string(mem_ctx, domain_guid) : "(null)", - site_name, flags)); + site_name ? site_name : "(null)", flags)); *info = NULL; @@ -1123,18 +1122,12 @@ static NTSTATUS dsgetdcname_internal(TALLOC_CTX *mem_ctx, return NT_STATUS_INVALID_PARAMETER; } - if ((site_name == NULL) || (site_name[0] == '\0')) { - 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, query_site, &myinfo); + flags, site_name, &myinfo); if (NT_STATUS_IS_OK(status)) { goto done; } @@ -1145,12 +1138,10 @@ static NTSTATUS dsgetdcname_internal(TALLOC_CTX *mem_ctx, rediscover: status = dsgetdcname_rediscover(mem_ctx, msg_ctx, domain_name, - domain_guid, flags, query_site, + domain_guid, flags, site_name, &myinfo); done: - SAFE_FREE(query_site); - if (!NT_STATUS_IS_OK(status)) { if (!first) { *info = first_info; @@ -1165,7 +1156,7 @@ static NTSTATUS dsgetdcname_internal(TALLOC_CTX *mem_ctx, first = false; first_info = myinfo; /* TODO: may use the next_closest_site here */ - query_site = SMB_STRDUP(myinfo->client_site_name); + site_name = myinfo->client_site_name; goto rediscover; } @@ -1187,11 +1178,24 @@ NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx, uint32_t flags, struct netr_DsRGetDCNameInfo **info) { - return dsgetdcname_internal(mem_ctx, + NTSTATUS status; + char *query_site = NULL; + + if ((site_name == NULL) || (site_name[0] == '\0')) { + query_site = sitename_fetch(domain_name); + } else { + query_site = SMB_STRDUP(site_name); + } + + status = dsgetdcname_internal(mem_ctx, msg_ctx, domain_name, domain_guid, - site_name, + query_site, flags, info); + + SAFE_FREE(query_site); + + return status; } |