diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-09-09 18:02:08 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-09-09 21:39:24 +1000 |
commit | b9c0b59034726f1114fb8696a3be012b6fd3a622 (patch) | |
tree | 5ce984b925f51de52254eae316e2ebc9c6447a29 /source4/scripting | |
parent | c95c3863dfec8e0160ff3bb217c6922666feed05 (diff) | |
download | samba-b9c0b59034726f1114fb8696a3be012b6fd3a622.tar.gz samba-b9c0b59034726f1114fb8696a3be012b6fd3a622.tar.bz2 samba-b9c0b59034726f1114fb8696a3be012b6fd3a622.zip |
s4-rodc: get the domain name from the partitions DN
don't rely on the netbios domain name being the first part of the
realm
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/scripting')
-rw-r--r-- | source4/scripting/python/samba/join.py | 14 | ||||
-rw-r--r-- | source4/scripting/python/samba/netcmd/join.py | 2 |
2 files changed, 9 insertions, 7 deletions
diff --git a/source4/scripting/python/samba/join.py b/source4/scripting/python/samba/join.py index b0feee375d..ecc225ae3b 100644 --- a/source4/scripting/python/samba/join.py +++ b/source4/scripting/python/samba/join.py @@ -40,7 +40,7 @@ class join_ctx: pass def join_rodc(server=None, creds=None, lp=None, site=None, netbios_name=None, - targetdir=None): + targetdir=None, domain=None): """join as a RODC""" if server is None: @@ -77,16 +77,18 @@ def join_rodc(server=None, creds=None, lp=None, site=None, netbios_name=None, res = samdb.search(base="", scope=ldb.SCOPE_BASE, attrs=["dnsHostName"]) return res[0]["dnsHostName"][0] + def get_domain_name(samdb): + '''get netbios name of the domain from the partitions record''' + partitions_dn = samdb.get_partitions_dn() + res = samdb.search(base=partitions_dn, scope=ldb.SCOPE_ONELEVEL, attrs=["nETBIOSName"], + expression='ncName=%s' % samdb.get_default_basedn()) + return res[0]["nETBIOSName"][0] + def get_mysid(samdb): res = samdb.search(base="", scope=ldb.SCOPE_BASE, attrs=["tokenGroups"]) binsid = res[0]["tokenGroups"][0] return samdb.schema_format_value("objectSID", binsid) - def get_domain_name(samdb): - # this should be done via CLDAP - res = samdb.search(base=samdb.get_default_basedn(), scope=ldb.SCOPE_BASE, attrs=["name"]) - return res[0]["name"][0] - def join_add_objects(ctx): '''add the various objects needed for the join''' print "Adding %s" % ctx.acct_dn diff --git a/source4/scripting/python/samba/netcmd/join.py b/source4/scripting/python/samba/netcmd/join.py index 34fd5dec3d..ec8cd11122 100644 --- a/source4/scripting/python/samba/netcmd/join.py +++ b/source4/scripting/python/samba/netcmd/join.py @@ -64,7 +64,7 @@ class cmd_join(Command): elif role == "MEMBER": secure_channel_type = SEC_CHAN_WKSTA elif role == "RODC": - join_rodc(server=server, creds=creds, lp=lp, + join_rodc(server=server, creds=creds, lp=lp, domain=domain, site=site, netbios_name=netbios_name) return else: |