diff options
Diffstat (limited to 'source4/scripting')
| -rwxr-xr-x | source4/scripting/bin/samba_spnupdate | 2 | ||||
| -rw-r--r-- | source4/scripting/python/samba/join.py | 2 | ||||
| -rw-r--r-- | source4/scripting/python/samba/netcmd/common.py | 13 | 
3 files changed, 10 insertions, 7 deletions
diff --git a/source4/scripting/bin/samba_spnupdate b/source4/scripting/bin/samba_spnupdate index 10da1d917b..52a51d8b81 100755 --- a/source4/scripting/bin/samba_spnupdate +++ b/source4/scripting/bin/samba_spnupdate @@ -190,7 +190,7 @@ def call_rodc_update(d):      net = Net(creds=creds, lp=lp)      try: -        cldap_ret = net.finddc(domain, nbt.NBT_SERVER_DS | nbt.NBT_SERVER_WRITABLE) +        cldap_ret = net.finddc(domain=domain, flags=nbt.NBT_SERVER_DS | nbt.NBT_SERVER_WRITABLE)      except Exception, reason:          print("Unable to find writeable DC for domain '%s' to send DRS writeSPN to : %s" % (domain, reason))          sys.exit(1) diff --git a/source4/scripting/python/samba/join.py b/source4/scripting/python/samba/join.py index 4252a2d7d4..3ae1a2c81d 100644 --- a/source4/scripting/python/samba/join.py +++ b/source4/scripting/python/samba/join.py @@ -195,7 +195,7 @@ class dc_join(object):      def find_dc(ctx, domain):          '''find a writeable DC for the given domain'''          try: -            ctx.cldap_ret = ctx.net.finddc(domain, nbt.NBT_SERVER_LDAP | nbt.NBT_SERVER_DS | nbt.NBT_SERVER_WRITABLE) +            ctx.cldap_ret = ctx.net.finddc(domain=domain, flags=nbt.NBT_SERVER_LDAP | nbt.NBT_SERVER_DS | nbt.NBT_SERVER_WRITABLE)          except Exception:              raise Exception("Failed to find a writeable DC for domain '%s'" % domain)          if ctx.cldap_ret.client_site is not None and ctx.cldap_ret.client_site != "": diff --git a/source4/scripting/python/samba/netcmd/common.py b/source4/scripting/python/samba/netcmd/common.py index 234fad3c03..cc97fc523f 100644 --- a/source4/scripting/python/samba/netcmd/common.py +++ b/source4/scripting/python/samba/netcmd/common.py @@ -52,10 +52,13 @@ def netcmd_dnsname(lp):      return lp.get('netbios name').lower() + "." + lp.get('realm').lower() -def netcmd_finddc(lp, creds): -    '''return domain-name of a writable/ldap-capable DC for the domain.''' +def netcmd_finddc(lp, creds, realm=None): +    '''Return domain-name of a writable/ldap-capable DC for the default +       domain (parameter "realm" in smb.conf) unless another realm has been +       specified as argument'''      net = Net(creds=creds, lp=lp) -    realm = lp.get('realm') -    cldap_ret = net.finddc(realm, -                nbt.NBT_SERVER_LDAP | nbt.NBT_SERVER_DS | nbt.NBT_SERVER_WRITABLE) +    if realm is None: +        realm = lp.get('realm') +    cldap_ret = net.finddc(domain=realm, +                flags=nbt.NBT_SERVER_LDAP | nbt.NBT_SERVER_DS | nbt.NBT_SERVER_WRITABLE)      return cldap_ret.pdc_dns_name  | 
