s4-pyjoin: use new pynet finddc interface
authorAndrew Tridgell <tridge@samba.org>
Wed, 15 Sep 2010 08:52:11 +0000 (18:52 +1000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 15 Sep 2010 21:24:01 +0000 (07:24 +1000)
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

source4/scripting/python/samba/join.py

index 36732d692ddc79c5c98eb6f161130b94384ca37d..2cb1e3da0b0015a400093c2d3972800346e80d91 100644 (file)
@@ -68,7 +68,8 @@ def join_rodc(server=None, creds=None, lp=None, site=None, netbios_name=None,
 
     def find_dc(ctx, domain):
         '''find a writeable DC for the given domain'''
-        return ctx.net.finddc(domain, nbt.NBT_SERVER_LDAP | nbt.NBT_SERVER_DS | nbt.NBT_SERVER_WRITABLE)
+        ctx.cldap_ret = ctx.net.finddc(domain, nbt.NBT_SERVER_LDAP | nbt.NBT_SERVER_DS | nbt.NBT_SERVER_WRITABLE)
+        return ctx.cldap_ret.pdc_dns_name;
 
 
     def get_dsServiceName(samdb):
@@ -309,6 +310,8 @@ def join_rodc(server=None, creds=None, lp=None, site=None, netbios_name=None,
     ctx.domsid = ctx.samdb.get_domain_sid()
     ctx.domain_name = get_domain_name(ctx.samdb)
 
+    lp.set("realm", ctx.domain_name)
+
     ctx.dc_ntds_dn = get_dsServiceName(ctx.samdb)
     ctx.dc_dnsHostName = get_dnsHostName(ctx.samdb)
     ctx.acct_pass = samba.generate_random_password(12, 32)