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):
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)