summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-09-06 10:37:18 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-09-06 04:48:55 +0200
commit0d99175f2afb4badd61ba903f3752a0207b049a3 (patch)
tree95d55511ec6eaa554d00a62961967b28e5caa57b
parentf453117569e04087ae461677717b14cdd65a4cd4 (diff)
downloadsamba-0d99175f2afb4badd61ba903f3752a0207b049a3.tar.gz
samba-0d99175f2afb4badd61ba903f3752a0207b049a3.tar.bz2
samba-0d99175f2afb4badd61ba903f3752a0207b049a3.zip
join.py: Only replicate DNS zones if the source DC had DNS zones
This avoid folks needing to specify --dns-backend=NONE Andrew Bartlett Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Thu Sep 6 04:48:55 CEST 2012 on sn-devel-104
-rw-r--r--source4/scripting/python/samba/join.py25
1 files changed, 18 insertions, 7 deletions
diff --git a/source4/scripting/python/samba/join.py b/source4/scripting/python/samba/join.py
index 41d97cb477..ac822fb15b 100644
--- a/source4/scripting/python/samba/join.py
+++ b/source4/scripting/python/samba/join.py
@@ -56,10 +56,6 @@ class dc_join(object):
ctx.netbios_name = netbios_name
ctx.targetdir = targetdir
ctx.use_ntvfs = use_ntvfs
- if dns_backend is None:
- ctx.dns_backend = "NONE"
- else:
- ctx.dns_backend = dns_backend
ctx.promote_existing = promote_existing
ctx.promote_from_dn = None
@@ -118,6 +114,21 @@ class dc_join(object):
ctx.dnsdomain = ctx.samdb.domain_dns_name()
ctx.dnsforest = ctx.samdb.forest_dns_name()
+ ctx.domaindns_zone = 'DC=DomainDnsZones,%s' % ctx.base_dn
+
+ res_domaindns = ctx.samdb.search(scope=ldb.SCOPE_ONELEVEL,
+ attrs=[],
+ base=ctx.samdb.get_partitions_dn(),
+ expression="(&(objectClass=crossRef)(ncName=%s))" % ctx.domaindns_zone)
+ if dns_backend is None:
+ ctx.dns_backend = "NONE"
+ else:
+ if len(res_domaindns) == 0:
+ ctx.dns_backend = "NONE"
+ print "NO DNS zone information found in source domain, not replicating DNS"
+ else:
+ ctx.dns_backend = dns_backend
+
ctx.dnshostname = "%s.%s" % (ctx.myname, ctx.dnsdomain)
ctx.realm = ctx.dnsdomain
@@ -735,8 +746,8 @@ class dc_join(object):
destination_dsa_guid, rodc=ctx.RODC,
replica_flags=ctx.domain_replica_flags)
- if 'DC=DomainDnsZones,%s' % ctx.base_dn in ctx.nc_list:
- repl.replicate('DC=DomainDnsZones,%s' % ctx.base_dn, source_dsa_invocation_id,
+ if ctx.domaindns_zone in ctx.nc_list:
+ repl.replicate(ctx.domaindns_zone, source_dsa_invocation_id,
destination_dsa_guid, rodc=ctx.RODC,
replica_flags=ctx.replica_flags)
@@ -966,7 +977,7 @@ class dc_join(object):
if not ctx.subdomain:
ctx.nc_list += [ctx.base_dn]
if ctx.dns_backend != "NONE":
- ctx.nc_list += ['DC=DomainDnsZones,%s' % ctx.base_dn]
+ ctx.nc_list += [ctx.domaindns_zone]
if ctx.dns_backend != "NONE":
ctx.full_nc_list += ['DC=DomainDnsZones,%s' % ctx.base_dn]