summaryrefslogtreecommitdiffstats
path: root/source4/scripting/python/samba/netcmd
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2011-12-04 14:23:34 +0100
committerMatthieu Patou <mat@matws.net>2011-12-05 18:23:07 +0100
commitfc42b0ab4135295fd23af5ab0cc0b410655bc376 (patch)
tree01ff8cc0159fb4952c39f1d686b94c4cb5ade8e1 /source4/scripting/python/samba/netcmd
parent093dac43312c97a90b68f18ccc80716db84c25f5 (diff)
downloadsamba-fc42b0ab4135295fd23af5ab0cc0b410655bc376.tar.gz
samba-fc42b0ab4135295fd23af5ab0cc0b410655bc376.tar.xz
samba-fc42b0ab4135295fd23af5ab0cc0b410655bc376.zip
s4-python: factorize the definition of get_dsServiceName
Diffstat (limited to 'source4/scripting/python/samba/netcmd')
-rw-r--r--source4/scripting/python/samba/netcmd/drs.py9
-rw-r--r--source4/scripting/python/samba/netcmd/rodc.py7
2 files changed, 3 insertions, 13 deletions
diff --git a/source4/scripting/python/samba/netcmd/drs.py b/source4/scripting/python/samba/netcmd/drs.py
index c508e2f331..0d93298e97 100644
--- a/source4/scripting/python/samba/netcmd/drs.py
+++ b/source4/scripting/python/samba/netcmd/drs.py
@@ -80,11 +80,6 @@ def drs_parse_ntds_dn(ntds_dn):
-def get_dsServiceName(samdb):
- '''get the NTDS DN from the rootDSE'''
- res = samdb.search(base="", scope=ldb.SCOPE_BASE, attrs=["dsServiceName"])
- return res[0]["dsServiceName"][0]
-
class cmd_drs_showrepl(Command):
@@ -133,7 +128,7 @@ class cmd_drs_showrepl(Command):
samdb_connect(self)
# show domain information
- ntds_dn = get_dsServiceName(self.samdb)
+ ntds_dn = self.samdb.get_dsServiceName()
server_dns = self.samdb.search(base="", scope=ldb.SCOPE_BASE, attrs=["dnsHostName"])[0]['dnsHostName'][0]
(site, server) = drs_parse_ntds_dn(ntds_dn)
@@ -446,7 +441,7 @@ class cmd_drs_options(Command):
samdb_connect(self)
- ntds_dn = get_dsServiceName(self.samdb)
+ ntds_dn = self.samdb.get_dsServiceName()
res = self.samdb.search(base=ntds_dn, scope=ldb.SCOPE_BASE, attrs=["options"])
dsa_opts = int(res[0]["options"][0])
diff --git a/source4/scripting/python/samba/netcmd/rodc.py b/source4/scripting/python/samba/netcmd/rodc.py
index 77d469a5dd..b0500362ef 100644
--- a/source4/scripting/python/samba/netcmd/rodc.py
+++ b/source4/scripting/python/samba/netcmd/rodc.py
@@ -59,11 +59,6 @@ class cmd_rodc_preload(Command):
return str(res[0]["dn"])
- def get_dsServiceName(self, samdb):
- res = samdb.search(base="", scope=ldb.SCOPE_BASE, attrs=["dsServiceName"])
- return res[0]["dsServiceName"][0]
-
-
def run(self, account, sambaopts=None,
credopts=None, versionopts=None, server=None):
@@ -83,7 +78,7 @@ class cmd_rodc_preload(Command):
credentials=creds, lp=lp)
# work out the source and destination GUIDs
- dc_ntds_dn = self.get_dsServiceName(samdb)
+ dc_ntds_dn = samdb.get_dsServiceName()
res = samdb.search(base=dc_ntds_dn, scope=ldb.SCOPE_BASE, attrs=["invocationId"])
source_dsa_invocation_id = misc.GUID(local_samdb.schema_format_value("objectGUID", res[0]["invocationId"][0]))