diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-11-30 21:18:34 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-12-01 16:09:59 +1100 |
commit | d48b66e1e8228918ff8a6330da93caeea8bdc762 (patch) | |
tree | 7966e8a3c7bb6a2992161a51d6a0892a710b8c06 /wintest | |
parent | ca79bc7373d86f5ef6e87527203f13d902889ec3 (diff) | |
download | samba-d48b66e1e8228918ff8a6330da93caeea8bdc762.tar.gz samba-d48b66e1e8228918ff8a6330da93caeea8bdc762.tar.bz2 samba-d48b66e1e8228918ff8a6330da93caeea8bdc762.zip |
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
Diffstat (limited to 'wintest')
-rw-r--r-- | wintest/wintest.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/wintest/wintest.py b/wintest/wintest.py index c9bd87554e..5f7bd0a8d5 100644 --- a/wintest/wintest.py +++ b/wintest/wintest.py @@ -341,12 +341,25 @@ class wintest(): def get_is_dc(self, child): 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: 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]+') hostname = child.after - if hostname.upper() == self.getvar("WIN_HOSTNAME").upper: + if hostname.upper() == self.getvar("WIN_HOSTNAME").upper(): return True def run_tlntadmn(self, child): |