summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2013-09-03 17:41:42 +1200
committerStefan Metzmacher <metze@samba.org>2013-09-16 19:35:21 +0200
commitccb1beb9a30a413fcf5b85b273b789db15b6be56 (patch)
tree62dfdd87a07837d6c10fc6aed5058f07a00be3c0
parent20999fcaa192517b12eb3334963d58c6fb436ede (diff)
downloadsamba-ccb1beb9a30a413fcf5b85b273b789db15b6be56.tar.gz
samba-ccb1beb9a30a413fcf5b85b273b789db15b6be56.tar.bz2
samba-ccb1beb9a30a413fcf5b85b273b789db15b6be56.zip
join.py: Handle exceptions when looking for GUID in a DN
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
-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