mirror of
https://github.com/samba-team/samba.git
synced 2025-07-13 08:59:08 +03:00
s4-python: raise an error if unable to bind remote ldap while joining
This commit is contained in:
committed by
Matthieu Patou
parent
8cf14c21b3
commit
c2ac7473f3
@ -36,6 +36,11 @@ import talloc
|
||||
# this makes debugging easier
|
||||
talloc.enable_null_tracking()
|
||||
|
||||
class DCJoinException(Exception):
|
||||
|
||||
def __init__(self, msg):
|
||||
super(DCJoinException, self).__init__("Can't join, error: %s" % msg)
|
||||
|
||||
|
||||
class dc_join(object):
|
||||
'''perform a DC join'''
|
||||
@ -62,6 +67,12 @@ class dc_join(object):
|
||||
session_info=system_session(),
|
||||
credentials=ctx.creds, lp=ctx.lp)
|
||||
|
||||
try:
|
||||
ctx.samdb.search(scope=ldb.SCOPE_ONELEVEL, attrs=["dn"])
|
||||
except ldb.LdbError, (enum, estr):
|
||||
raise DCJoinException(estr)
|
||||
|
||||
|
||||
ctx.myname = netbios_name
|
||||
ctx.samname = "%s$" % ctx.myname
|
||||
ctx.base_dn = str(ctx.samdb.get_default_basedn())
|
||||
|
Reference in New Issue
Block a user