summaryrefslogtreecommitdiff
path: root/wintest/wintest.py
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-12-14 10:53:34 +1100
committerAndrew Bartlett <abartlet@samba.org>2010-12-14 01:54:46 +0100
commit6510414ef0e48aaea9918cce87c0850d8f74fccd (patch)
tree1331137bd2f870bc16f05dbadb13a7bf750d4ab4 /wintest/wintest.py
parentd97492e42a65540febae93dd0255b91d034f9def (diff)
downloadsamba-6510414ef0e48aaea9918cce87c0850d8f74fccd.tar.gz
samba-6510414ef0e48aaea9918cce87c0850d8f74fccd.tar.bz2
samba-6510414ef0e48aaea9918cce87c0850d8f74fccd.zip
wintest Add testing of kerberos connections to Windows members of an AD domain
This improves the Samba3 wintest script to test against Windows7 and WinXP domain members, and Windows7 standalone servers. To do this, more of the samba4 script is put in common, and we splut up the starting of the VMs from the preperation of the VM. This also improves the nmblookup command parsing to cope with both the samba3 and samba4 nmblookup commands. A krb5.conf is now provided for both s3 and s4 tests. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Tue Dec 14 01:54:46 CET 2010 on sn-devel-104
Diffstat (limited to 'wintest/wintest.py')
-rw-r--r--wintest/wintest.py45
1 files changed, 42 insertions, 3 deletions
diff --git a/wintest/wintest.py b/wintest/wintest.py
index af4588f5c8..10bc562955 100644
--- a/wintest/wintest.py
+++ b/wintest/wintest.py
@@ -57,6 +57,8 @@ class wintest():
self.setvar("WIN_LCREALM", self.getvar("WIN_REALM").lower())
dnsdomain = self.getvar("WIN_REALM")
self.setvar("WIN_BASEDN", "DC=" + dnsdomain.replace(".", ",DC="))
+ if self.getvar("WIN_USER") is None:
+ self.setvar("WIN_USER", "administrator")
def info(self, msg):
'''print some information'''
@@ -343,7 +345,6 @@ nameserver %s
'''tkey-gssapi-credential "DNS/${LCREALM}";
tkey-domain "${LCREALM}";
''')
- self.putenv("KRB5_CONFIG", '${PREFIX}/private/krb5.conf')
self.putenv('KEYTAB_FILE', '${PREFIX}/private/dns.keytab')
self.putenv('KRB5_KTNAME', '${PREFIX}/private/dns.keytab')
@@ -621,8 +622,12 @@ options {
'''resolve an IP given a hostname, assuming NBT'''
while retries > 0:
child = self.pexpect_spawn("bin/nmblookup %s" % hostname)
- i = child.expect(['\d+.\d+.\d+.\d+', "Lookup failed"])
- if i == 0:
+ i = 0
+ while i == 0:
+ i = child.expect(["querying", '\d+.\d+.\d+.\d+', hostname, "Lookup failed"])
+ if i == 0:
+ child.expect("\r")
+ if i == 1:
return child.after
retries -= 1
time.sleep(delay)
@@ -802,6 +807,40 @@ RebootOnCompletion=No
child.sendline("shutdown -r -t 0")
self.port_wait("${WIN_IP}", 139, wait_for_fail=True)
self.port_wait("${WIN_IP}", 139)
+ self.retry_cmd("host -t SRV _ldap._tcp.${WIN_REALM} ${WIN_IP}", ['has SRV record'] )
+
+
+ def start_winvm(self, vm):
+ '''start a Windows VM'''
+ self.setwinvars(vm)
+
+ self.info("Joining a windows box to the domain")
+ self.vm_poweroff("${WIN_VM}", checkfail=False)
+ self.vm_restore("${WIN_VM}", "${WIN_SNAPSHOT}")
+
+ def run_winjoin(self, vm, domain, username="administrator", password="${PASSWORD1}"):
+ '''join a windows box to a domain'''
+ child = self.open_telnet("${WIN_HOSTNAME}", "${WIN_USER}", "${WIN_PASS}", set_time=True, set_ip=True, set_noexpire=True)
+ child.sendline("ipconfig /flushdns")
+ child.expect("C:")
+ child.sendline("netdom join ${WIN_HOSTNAME} /Domain:%s /UserD:%s /PasswordD:%s" % (domain, username, password))
+ child.expect("The command completed successfully")
+ child.expect("C:")
+ child.sendline("shutdown /r -t 0")
+ self.wait_reboot()
+ child = self.open_telnet("${WIN_HOSTNAME}", "${WIN_USER}", "${WIN_PASS}", set_time=True, set_ip=True)
+ child.sendline("ipconfig /registerdns")
+ child.expect("Registration of the DNS resource records for all adapters of this computer has been initiated. Any errors will be reported in the Event Viewer")
+ child.expect("C:")
+
+
+ def test_remote_smbclient(self, vm, username="${WIN_USER}", password="${WIN_PASS}", args=""):
+ '''test smbclient against remote server'''
+ self.setwinvars(vm)
+ self.info('Testing smbclient')
+ self.chdir('${PREFIX}')
+ self.cmd_contains("bin/smbclient --version", ["${SAMBA_VERSION}"])
+ self.retry_cmd('bin/smbclient -L ${WIN_HOSTNAME} -U%s%%%s %s' % (username, password, args), ["IPC"])
def setup(self, testname, subdir):