summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-04-22 01:54:49 +0200
committerGünther Deschner <gd@samba.org>2008-04-22 01:54:49 +0200
commitc27e661ad11dcf08f91f48758c8d66a3fcb88bfd (patch)
treeef47790b84ac83205fa1b1ad85489fbe04afc9a0
parentaba7809188025f09b10631f822fedbe8671acddb (diff)
downloadsamba-c27e661ad11dcf08f91f48758c8d66a3fcb88bfd.tar.gz
samba-c27e661ad11dcf08f91f48758c8d66a3fcb88bfd.tar.bz2
samba-c27e661ad11dcf08f91f48758c8d66a3fcb88bfd.zip
libnetjoin: identify type of domain early.
This finally enables joining AD using workgroup or realm name. Guenther (This used to be commit 0cf16e6b47f5978bdcb84ac8a29ef13ff2b5cca8)
-rw-r--r--source3/libnet/libnet_join.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index d22fbc21b9..7e348e25a5 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -142,8 +142,8 @@ static ADS_STATUS libnet_join_connect_ads(TALLOC_CTX *mem_ctx,
{
ADS_STATUS status;
- status = libnet_connect_ads(r->in.domain_name,
- r->in.domain_name,
+ status = libnet_connect_ads(r->out.dns_domain_name,
+ r->out.netbios_domain_name,
r->in.dc_name,
r->in.admin_account,
r->in.admin_password,
@@ -1641,8 +1641,21 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx,
W_ERROR_HAVE_NO_MEMORY(r->in.dc_name);
}
+ status = libnet_join_lookup_dc_rpc(mem_ctx, r, &cli);
+ if (!NT_STATUS_IS_OK(status)) {
+ libnet_join_set_error_string(mem_ctx, r,
+ "failed to lookup DC info for domain '%s' over rpc: %s",
+ r->in.domain_name, get_friendly_nt_error_msg(status));
+ return ntstatus_to_werror(status);
+ }
+
+ werr = libnet_join_check_config(mem_ctx, r);
+ if (!W_ERROR_IS_OK(werr)) {
+ goto done;
+ }
+
#ifdef WITH_ADS
- if (r->in.account_ou) {
+ if (r->out.domain_is_ad && r->in.account_ou) {
ads_status = libnet_join_connect_ads(mem_ctx, r);
if (!ADS_ERR_OK(ads_status)) {
@@ -1662,19 +1675,6 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx,
}
#endif /* WITH_ADS */
- status = libnet_join_lookup_dc_rpc(mem_ctx, r, &cli);
- if (!NT_STATUS_IS_OK(status)) {
- libnet_join_set_error_string(mem_ctx, r,
- "failed to lookup DC info for domain '%s' over rpc: %s",
- r->in.domain_name, get_friendly_nt_error_msg(status));
- return ntstatus_to_werror(status);
- }
-
- werr = libnet_join_check_config(mem_ctx, r);
- if (!W_ERROR_IS_OK(werr)) {
- goto done;
- }
-
status = libnet_join_joindomain_rpc(mem_ctx, r, cli);
if (!NT_STATUS_IS_OK(status)) {
libnet_join_set_error_string(mem_ctx, r,