diff options
author | Uri Simchoni <urisimchoni@gmail.com> | 2015-06-28 14:36:22 +0300 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2015-07-09 12:33:25 +0200 |
commit | ed2ed1ad694ad1cc9e618baf1398ee26a4cdbde8 (patch) | |
tree | 369428d867dda6874f33cc31043ebb1b60c739d4 /source3/utils | |
parent | f9cc2de6129a7f998132cdc56c4c742d25b47f27 (diff) | |
download | samba-ed2ed1ad694ad1cc9e618baf1398ee26a4cdbde8.tar.gz |
net: fix the order of DC lookup methods when joining a domain
The dsgetdcname() function is able to try just DNS lookup, just NetBIOS,
or start with DNS and fall back to NetBIOS. For "net ads join", we know
most of the time whether the name of the domain we're joining is a DNS
name or a NetBIOS name. In that case, it makes no sense to try both lookup
methods, especially that DNS may fail and we want to fall back from site-aware
DNS lookup to site-less DNS lookup, with no NetBIOS lookup in between.
This change lets "net ads join" tell libnet what is the type of the domain
name, if it is known.
Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net_ads.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c index a8f3892bb29..28553fcadc8 100644 --- a/source3/utils/net_ads.c +++ b/source3/utils/net_ads.c @@ -1439,6 +1439,7 @@ int net_ads_join(struct net_context *c, int argc, const char **argv) const char *os_version = NULL; const char *os_servicepack = NULL; bool modify_config = lp_config_backend_is_registry(); + enum libnetjoin_JoinDomNameType domain_name_type = JoinDomNameTypeDNS; if (c->display_usage) return net_ads_join_usage(c, argc, argv); @@ -1511,6 +1512,11 @@ int net_ads_join(struct net_context *c, int argc, const char **argv) } else { domain = argv[i]; + if (strchr(domain, '.') == NULL) { + domain_name_type = JoinDomNameTypeUnknown; + } else { + domain_name_type = JoinDomNameTypeDNS; + } } } @@ -1530,6 +1536,7 @@ int net_ads_join(struct net_context *c, int argc, const char **argv) /* Do the domain join here */ r->in.domain_name = domain; + r->in.domain_name_type = domain_name_type; r->in.create_upn = createupn; r->in.upn = machineupn; r->in.account_ou = create_in_ou; @@ -1552,6 +1559,7 @@ int net_ads_join(struct net_context *c, int argc, const char **argv) if (W_ERROR_EQUAL(werr, WERR_DCNOTFOUND) && strequal(domain, lp_realm())) { r->in.domain_name = lp_workgroup(); + r->in.domain_name_type = JoinDomNameTypeNBT; werr = libnet_Join(ctx, r); } if (!W_ERROR_IS_OK(werr)) { |