summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/lib/netapi/joindomain.c17
-rw-r--r--source3/libnet/libnet_join.c10
-rw-r--r--source3/winbindd/winbindd_cm.c8
-rw-r--r--source3/winbindd/winbindd_locator.c7
4 files changed, 21 insertions, 21 deletions
diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c
index 74ed8f2302..b7c9fa5acc 100644
--- a/source3/lib/netapi/joindomain.c
+++ b/source3/lib/netapi/joindomain.c
@@ -47,6 +47,7 @@ WERROR NetJoinDomain_l(struct libnetapi_ctx *mem_ctx,
if (r->in.join_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) {
NTSTATUS status;
struct netr_DsRGetDCNameInfo *info = NULL;
+ const char *dc = NULL;
uint32_t flags = DS_DIRECTORY_SERVICE_REQUIRED |
DS_WRITABLE_REQUIRED |
DS_RETURN_DNS_NAME;
@@ -57,8 +58,9 @@ WERROR NetJoinDomain_l(struct libnetapi_ctx *mem_ctx,
"%s", get_friendly_nt_error_msg(status));
return ntstatus_to_werror(status);
}
- j->in.dc_name = talloc_strdup(mem_ctx,
- info->dc_unc);
+
+ dc = strip_hostname(info->dc_unc);
+ j->in.dc_name = talloc_strdup(mem_ctx, dc);
W_ERROR_HAVE_NO_MEMORY(j->in.dc_name);
}
@@ -174,6 +176,7 @@ WERROR NetUnjoinDomain_l(struct libnetapi_ctx *mem_ctx,
} else {
NTSTATUS status;
struct netr_DsRGetDCNameInfo *info = NULL;
+ const char *dc = NULL;
uint32_t flags = DS_DIRECTORY_SERVICE_REQUIRED |
DS_WRITABLE_REQUIRED |
DS_RETURN_DNS_NAME;
@@ -186,8 +189,9 @@ WERROR NetUnjoinDomain_l(struct libnetapi_ctx *mem_ctx,
get_friendly_nt_error_msg(status));
return ntstatus_to_werror(status);
}
- u->in.dc_name = talloc_strdup(mem_ctx,
- info->dc_unc);
+
+ dc = strip_hostname(info->dc_unc);
+ u->in.dc_name = talloc_strdup(mem_ctx, dc);
W_ERROR_HAVE_NO_MEMORY(u->in.dc_name);
u->in.domain_name = domain;
@@ -352,6 +356,7 @@ WERROR NetGetJoinableOUs_l(struct libnetapi_ctx *ctx,
ADS_STATUS ads_status;
ADS_STRUCT *ads = NULL;
struct netr_DsRGetDCNameInfo *info = NULL;
+ const char *dc = NULL;
uint32_t flags = DS_DIRECTORY_SERVICE_REQUIRED |
DS_RETURN_DNS_NAME;
@@ -363,7 +368,9 @@ WERROR NetGetJoinableOUs_l(struct libnetapi_ctx *ctx,
return ntstatus_to_werror(status);
}
- ads = ads_init(r->in.domain, r->in.domain, info->dc_unc);
+ dc = strip_hostname(info->dc_unc);
+
+ ads = ads_init(r->in.domain, r->in.domain, dc);
if (!ads) {
return WERR_GENERAL_FAILURE;
}
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index 7e348e25a5..8e503382f4 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -1620,6 +1620,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx,
if (!r->in.dc_name) {
struct netr_DsRGetDCNameInfo *info;
+ const char *dc;
status = dsgetdcname(mem_ctx,
r->in.domain_name,
NULL,
@@ -1636,8 +1637,8 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx,
return WERR_DOMAIN_CONTROLLER_NOT_FOUND;
}
- r->in.dc_name = talloc_strdup(mem_ctx,
- info->dc_unc);
+ dc = strip_hostname(info->dc_unc);
+ r->in.dc_name = talloc_strdup(mem_ctx, dc);
W_ERROR_HAVE_NO_MEMORY(r->in.dc_name);
}
@@ -1775,6 +1776,7 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx,
if (!r->in.dc_name) {
struct netr_DsRGetDCNameInfo *info;
+ const char *dc;
status = dsgetdcname(mem_ctx,
r->in.domain_name,
NULL,
@@ -1791,8 +1793,8 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx,
return WERR_DOMAIN_CONTROLLER_NOT_FOUND;
}
- r->in.dc_name = talloc_strdup(mem_ctx,
- info->dc_unc);
+ dc = strip_hostname(info->dc_unc);
+ r->in.dc_name = talloc_strdup(mem_ctx, dc);
W_ERROR_HAVE_NO_MEMORY(r->in.dc_name);
}
diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c
index 0b0de5ad4f..377b1b2d21 100644
--- a/source3/winbindd/winbindd_cm.c
+++ b/source3/winbindd/winbindd_cm.c
@@ -655,13 +655,7 @@ static bool get_dc_name_via_netlogon(struct winbindd_domain *domain,
}
/* rpccli_netr_GetAnyDCName gives us a name with \\ */
- p = tmp;
- if (*p == '\\') {
- p+=1;
- }
- if (*p == '\\') {
- p+=1;
- }
+ p = strip_hostname(tmp);
fstrcpy(dcname, p);
diff --git a/source3/winbindd/winbindd_locator.c b/source3/winbindd/winbindd_locator.c
index 10a6c5afeb..f154f36c85 100644
--- a/source3/winbindd/winbindd_locator.c
+++ b/source3/winbindd/winbindd_locator.c
@@ -75,14 +75,11 @@ static enum winbindd_result dual_dsgetdcname(struct winbindd_domain *domain,
}
if (info->dc_address) {
- dc = info->dc_address;
- if ((dc[0] == '\\') && (dc[1] == '\\')) {
- dc += 2;
- }
+ dc = strip_hostname(info->dc_address);
}
if ((!dc || !is_ipaddress_v4(dc)) && info->dc_unc) {
- dc = info->dc_unc;
+ dc = strip_hostname(info->dc_unc);
}
if (!dc || !*dc) {