mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
wintest Another way to work out if a Windows machine is a DC
it's not perfect (may fail on member servers) but it's picks up the difference between standalone and DC OK. Andrew Bartlett
This commit is contained in:
parent
ca79bc7373
commit
d48b66e1e8
@ -341,12 +341,25 @@ class wintest():
|
|||||||
|
|
||||||
def get_is_dc(self, child):
|
def get_is_dc(self, child):
|
||||||
child.sendline("dcdiag")
|
child.sendline("dcdiag")
|
||||||
i = child.expect(["is not a Directory Server", "Home Server = "])
|
i = child.expect(["is not a Directory Server", "is not recognized as an internal or external command", "Home Server = "])
|
||||||
if i == 0:
|
if i == 0:
|
||||||
return False
|
return False
|
||||||
|
if i == 1:
|
||||||
|
child.expect("C:")
|
||||||
|
child.sendline("net config Workstation")
|
||||||
|
child.expect("Workstation domain")
|
||||||
|
child.expect('[\S]+')
|
||||||
|
domain = child.after
|
||||||
|
i = child.expect(["Workstation Domain DNS Name", "Logon domain"])
|
||||||
|
'''If we get the Logon domain first, we are not in an AD domain'''
|
||||||
|
if i == 1:
|
||||||
|
return False
|
||||||
|
if domain.upper() == self.getvar("WIN_DOMAIN").upper():
|
||||||
|
return True
|
||||||
|
|
||||||
child.expect('[\S]+')
|
child.expect('[\S]+')
|
||||||
hostname = child.after
|
hostname = child.after
|
||||||
if hostname.upper() == self.getvar("WIN_HOSTNAME").upper:
|
if hostname.upper() == self.getvar("WIN_HOSTNAME").upper():
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def run_tlntadmn(self, child):
|
def run_tlntadmn(self, child):
|
||||||
|
Loading…
Reference in New Issue
Block a user