From d5077baee26c593eb55cedf90ae440f50aa32e14 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 25 Sep 2013 17:09:30 -0700 Subject: [PATCH] join.py: Reconnect to the DC based on the DC name in dnsHostName to allow connection to IPC$ The treeConnect&X of the GUID name fails against Windows 2003. Andrew Bartlett Signed-off-by: Andrew Bartlett Reviewed-by: Stefan Metzmacher --- python/samba/join.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/python/samba/join.py b/python/samba/join.py index 2a737bab3c1..1785ab3e886 100644 --- a/python/samba/join.py +++ b/python/samba/join.py @@ -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())