diff options
author | Jeremy Allison <jra@samba.org> | 2013-09-03 12:20:52 -0700 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2013-09-04 08:41:39 +1200 |
commit | 68e7b1c9446c7d1274b0fb85b59b90ac1a7f6041 (patch) | |
tree | 7feee3f368bf80bc489e44348ebff7a170301514 /source3 | |
parent | 181c11066bd53b07015a199f56eb71182e89ff71 (diff) | |
download | samba-68e7b1c9446c7d1274b0fb85b59b90ac1a7f6041.tar.gz samba-68e7b1c9446c7d1274b0fb85b59b90ac1a7f6041.tar.bz2 samba-68e7b1c9446c7d1274b0fb85b59b90ac1a7f6041.zip |
Move the retry logic when site_name is passed in a NULL or "" to the wrapper function.
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')
-rw-r--r-- | source3/libsmb/dsgetdcname.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/source3/libsmb/dsgetdcname.c b/source3/libsmb/dsgetdcname.c index cad212827d..bdaa250aaf 100644 --- a/source3/libsmb/dsgetdcname.c +++ b/source3/libsmb/dsgetdcname.c @@ -1179,12 +1179,14 @@ NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx, struct netr_DsRGetDCNameInfo **info) { NTSTATUS status; - char *query_site = NULL; + const char *query_site = NULL; + char *ptr_to_free = NULL; if ((site_name == NULL) || (site_name[0] == '\0')) { - query_site = sitename_fetch(domain_name); + ptr_to_free = sitename_fetch(domain_name); + query_site = ptr_to_free; } else { - query_site = SMB_STRDUP(site_name); + query_site = site_name; } status = dsgetdcname_internal(mem_ctx, @@ -1195,7 +1197,22 @@ NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx, flags, info); - SAFE_FREE(query_site); + SAFE_FREE(ptr_to_free); + + if (!NT_STATUS_EQUAL(status, NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND)) { + return status; + } + + /* Should we try again with site_name == NULL ? */ + if ((site_name == NULL) || (site_name[0] == '\0')) { + status = dsgetdcname_internal(mem_ctx, + msg_ctx, + domain_name, + domain_guid, + NULL, + flags, + info); + } return status; } |