summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/samba/join.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/python/samba/join.py b/python/samba/join.py
index b2f4da4790..cad228a71a 100644
--- a/python/samba/join.py
+++ b/python/samba/join.py
@@ -303,7 +303,11 @@ class dc_join(object):
scope=ldb.SCOPE_BASE, controls=["extended_dn:1:1"])
if not 'fSMORoleOwner' in res[0]:
raise DCJoinException("Can't find naming master on partition DN %s" % ctx.partition_dn)
- master_guid = str(misc.GUID(ldb.Dn(ctx.samdb, res[0]['fSMORoleOwner'][0]).get_extended_component('GUID')))
+ try:
+ master_guid = str(misc.GUID(ldb.Dn(ctx.samdb, res[0]['fSMORoleOwner'][0]).get_extended_component('GUID')))
+ except KeyError:
+ raise DCJoinException("Can't find GUID in naming master on partition DN %s" % res[0]['fSMORoleOwner'][0])
+
master_host = '%s._msdcs.%s' % (master_guid, ctx.dnsforest)
return master_host