summaryrefslogtreecommitdiff
path: root/source4/scripting/python
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2011-11-22 22:26:06 +0100
committerStefan Metzmacher <metze@samba.org>2011-11-26 10:34:58 +0100
commit179bf9b51c9de5f9f8e78893bd20b9821e39e7e4 (patch)
tree59721053b3f28f14f9fcbe8ac6b8a293cd034652 /source4/scripting/python
parentdec1435a42e16269d1e343707e924256ee8a5050 (diff)
downloadsamba-179bf9b51c9de5f9f8e78893bd20b9821e39e7e4.tar.gz
samba-179bf9b51c9de5f9f8e78893bd20b9821e39e7e4.tar.bz2
samba-179bf9b51c9de5f9f8e78893bd20b9821e39e7e4.zip
s4:libnet/py_net.c: "py_net_finddc" - add an "address" parameter
This is useful for a new "samba-tool domain info" command. Patch inspired by Matthieu Patou. Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source4/scripting/python')
-rw-r--r--source4/scripting/python/samba/join.py2
-rw-r--r--source4/scripting/python/samba/netcmd/common.py13
2 files changed, 9 insertions, 6 deletions
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