join.py: Reconnect to the DC based on the DC name in dnsHostName to allow connection...
authorAndrew Bartlett <abartlet@samba.org>
Thu, 26 Sep 2013 00:09:30 +0000 (17:09 -0700)
committerStefan Metzmacher <metze@samba.org>
Fri, 11 Oct 2013 06:34:08 +0000 (08:34 +0200)
The treeConnect&X of the GUID name fails against Windows 2003.

Andrew Bartlett

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
python/samba/join.py

index 2a737bab3c122c43b157d03df2c9970ae110efc7..1785ab3e8861e81d7d2d8f7cfc2c8851908624d6 100644 (file)
@@ -1193,6 +1193,10 @@ def join_subdomain(logger=None, server=None, creds=None, lp=None, site=None,
         ctx.samdb = SamDB(url="ldap://%s" % ctx.server,
                           session_info=system_session(),
                           credentials=ctx.creds, lp=ctx.lp)
+        res = ctx.samdb.search(base="", scope=ldb.SCOPE_BASE, attrs=['dnsHostName'],
+                               controls=[])
+        ctx.server = res[0]["dnsHostName"]
+        logger.info("DNS name of new naming master is %s" % ctx.server)
 
     ctx.base_dn = samba.dn_from_dns_name(dnsdomain)
     ctx.domsid = str(security.random_sid())