mirror of
https://github.com/samba-team/samba.git
synced 2025-07-29 15:42:04 +03:00
s4-python: factorize the definition of get_dsServiceName
This commit is contained in:
@ -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])
|
||||
|
||||
|
Reference in New Issue
Block a user