[SCM] Samba Shared Repository - branch master updated
Andrew Tridgell
tridge at samba.org
Tue Nov 30 22:55:01 MST 2010
The branch, master has been updated
via 9c84f98 wintest: make command matching case insensitive by default
via 60e1a2c wintest: we don't need the WIN_BASEDN vars any more
via bd86dda wintest: fixed formatting of wintest in emacs python mode
via 4072455 wintest Wipe the BIND data directory just before we restart bind
via d48b66e wintest Another way to work out if a Windows machine is a DC
via ca79bc7 wintest Add more retries and fix up RODC handling after auto-dcpromo
via a565eff9 wintest Allow 'samba-tool newuser' to run a few times waiting for the RID Set
via c1fa6be s4-samba-tool Show when we have created the user successfully
via 0b2ec0a wintest Make the new --vms option default to running all tests.
via 86c3c42 wintest Set WIN_LCREALM and WIN_BASEDN automatically
via 7ecf6b2 wintest Add a function to shut down all the managed VMs at the start
via b5bab49 wintest Fix case of BASEDN variables
via f5382d5 wintest Add automatic dcpromo is the host isn't a DC yet
via b0ed6c2 wintest Add more VMs and correct titles
via 2b1c259 wintest: cope with delays in w2k3 starting its DRS server
via c2fb350 s4-drs: the options attribute is optional on NTDSDSA objects
via 90215c5 wintest: wait for the windows DC to register its DNS name
via a940d5d s4-provision: remove the disabled bit in the dns-$HOSTNAME account
via a36e4b2 wintest: fixed casefold handling in expect calls
via 380739e waf: less verbose message for failing to resolve a syslib path
via bbf9534 waf: use Logs.warn() instead of print() in the symbol check code
from 8428311 pygensec: Fix initialization.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 9c84f987acb5ffc97a612839e13e8b8042e6120e
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed Dec 1 16:07:56 2010 +1100
wintest: make command matching case insensitive by default
the new BASEDN changes break the RODC join otherwise
Autobuild-User: Andrew Tridgell <tridge at samba.org>
Autobuild-Date: Wed Dec 1 06:54:13 CET 2010 on sn-devel-104
commit 60e1a2c8cb49b774952b86ae8cdd4a5d6473c3ea
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed Dec 1 15:08:33 2010 +1100
wintest: we don't need the WIN_BASEDN vars any more
they are based on the realm now
commit bd86dda8e66438617205f74468123703deddc350
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed Dec 1 15:08:15 2010 +1100
wintest: fixed formatting of wintest in emacs python mode
commit 4072455c00f183fd50291f1447343e56766793f9
Author: Andrew Bartlett <abartlet at samba.org>
Date: Wed Dec 1 10:07:38 2010 +1100
wintest Wipe the BIND data directory just before we restart bind
This will hopefully mean we don't end up with stale zone info in the
new server.
Andrew Bartlett
commit d48b66e1e8228918ff8a6330da93caeea8bdc762
Author: Andrew Bartlett <abartlet at samba.org>
Date: Tue Nov 30 21:18:34 2010 +1100
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
commit ca79bc7373d86f5ef6e87527203f13d902889ec3
Author: Andrew Bartlett <abartlet at samba.org>
Date: Tue Nov 30 16:00:15 2010 +1100
wintest Add more retries and fix up RODC handling after auto-dcpromo
The extra looping allows some time for the system to settle down while
we connect to the server for the first time.
Andrew Bartlett
commit a565eff9699b7061236b753b6dc09bc36b837563
Author: Andrew Bartlett <abartlet at samba.org>
Date: Tue Nov 30 12:48:51 2010 +1100
wintest Allow 'samba-tool newuser' to run a few times waiting for the RID Set
Pair-Programmed-With: Andrew Tridgell <tridge at samba.org>
commit c1fa6be92514cec35033fa8486e30316de13319a
Author: Andrew Bartlett <abartlet at samba.org>
Date: Tue Nov 30 12:48:30 2010 +1100
s4-samba-tool Show when we have created the user successfully
commit 0b2ec0abb98d6ce1198a2addb802afae2711eaad
Author: Andrew Bartlett <abartlet at samba.org>
Date: Tue Nov 30 12:37:01 2010 +1100
wintest Make the new --vms option default to running all tests.
Andrew Bartlett
commit 86c3c427456431d49529a358e3f754b1fa812b6e
Author: Andrew Bartlett <abartlet at samba.org>
Date: Tue Nov 30 11:58:05 2010 +1100
wintest Set WIN_LCREALM and WIN_BASEDN automatically
Also this uppper cases WIN_REALM, to avoid this being sensitive based
on the configuration file.
Andrew Bartlett
commit 7ecf6b245113ada9d1c572b059e61db2b61e23cd
Author: Andrew Bartlett <abartlet at samba.org>
Date: Tue Nov 30 11:55:32 2010 +1100
wintest Add a function to shut down all the managed VMs at the start
This helps ensure that old virtual machines don't interfer with a new
test run.
Andrew Bartlett
commit b5bab49dc965bbda2dc5a8a2608b34808d7dfae8
Author: Andrew Bartlett <abartlet at samba.org>
Date: Mon Nov 29 22:30:41 2010 +1100
wintest Fix case of BASEDN variables
This needs to be automatically calculated.
Andrew Bartlett
commit f5382d5d3f8c6483eecc04d11bf88dcd50d624dd
Author: Andrew Bartlett <abartlet at samba.org>
Date: Mon Nov 29 19:03:34 2010 +1100
wintest Add automatic dcpromo is the host isn't a DC yet
This is slow, and requires an extra reboot, but should be consistent
and reproducible.
Andrew Bartlett
commit b0ed6c2b6f7d3424c8bdae496714d30f9bad6d99
Author: Andrew Bartlett <abartlet at samba.org>
Date: Mon Nov 29 19:02:56 2010 +1100
wintest Add more VMs and correct titles
commit 2b1c259d51599e33498ad2ee25f5b443ff4ab453
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed Dec 1 15:00:50 2010 +1100
wintest: cope with delays in w2k3 starting its DRS server
w2k3 brings up its DRS server quite a long time after its other
services
commit c2fb3502186b06a10f3493ca25b583d3a3133608
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed Dec 1 14:31:04 2010 +1100
s4-drs: the options attribute is optional on NTDSDSA objects
commit 90215c53df47728ea42faee15a9391ad0625b676
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed Dec 1 14:27:07 2010 +1100
wintest: wait for the windows DC to register its DNS name
after a windows DC uses dcpromo to join our domain, it can take a
while for it to register its DNS name
Pair-Programmed-With: Andrew Bartlett <abartlet at samba.org>
commit a940d5d344991968d2a6383bdfcd93e9aaa15285
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed Dec 1 13:54:29 2010 +1100
s4-provision: remove the disabled bit in the dns-$HOSTNAME account
commit a36e4b28c7970b2248f9722498f68fa8707b024e
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed Dec 1 13:24:35 2010 +1100
wintest: fixed casefold handling in expect calls
commit 380739e9bec7c67e57f277ed170e3c4b7787806a
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed Dec 1 11:42:35 2010 +1100
waf: less verbose message for failing to resolve a syslib path
commit bbf953464e8d3d876373b7ac2f1bfb80530352a6
Author: Andrew Tridgell <tridge at samba.org>
Date: Wed Dec 1 11:28:26 2010 +1100
waf: use Logs.warn() instead of print() in the symbol check code
-----------------------------------------------------------------------
Summary of changes:
buildtools/wafsamba/symbols.py | 2 +-
source4/scripting/python/samba/netcmd/drs.py | 2 +-
source4/scripting/python/samba/netcmd/newuser.py | 1 +
source4/setup/provision_dns_add.ldif | 2 +-
wintest/conf/abartlet.conf | 28 ++++-
wintest/conf/tridge.conf | 2 -
wintest/test-s4-howto.py | 143 ++++++++++++++++++----
wintest/wintest.py | 56 ++++++++-
8 files changed, 201 insertions(+), 35 deletions(-)
Changeset truncated at 500 lines:
diff --git a/buildtools/wafsamba/symbols.py b/buildtools/wafsamba/symbols.py
index e90eb88..5681440 100644
--- a/buildtools/wafsamba/symbols.py
+++ b/buildtools/wafsamba/symbols.py
@@ -146,7 +146,7 @@ def build_syslib_sets(bld, tgt_list):
for lib in syslibs:
path = find_syslib_path(bld, lib, syslibs[lib])
if path is None:
- print("Unable to find syslib path for %s used by %s" % lib)
+ Logs.warn("Unable to find syslib path for %s" % lib)
if path is not None:
syslib_paths.append(path)
objmap[path] = lib.lower()
diff --git a/source4/scripting/python/samba/netcmd/drs.py b/source4/scripting/python/samba/netcmd/drs.py
index 6f5b5b8..7cdb0e8 100644
--- a/source4/scripting/python/samba/netcmd/drs.py
+++ b/source4/scripting/python/samba/netcmd/drs.py
@@ -146,7 +146,7 @@ class cmd_drs_showrepl(Command):
conn = self.samdb.search(base=ntds_dn, expression="(objectClass=nTDSConnection)")
print("%s\\%s" % (site, server))
- print("DSA Options: 0x%08x" % int(ntds[0]["options"][0]))
+ print("DSA Options: 0x%08x" % int(attr_default(ntds[0], "options", 0)))
print("DSA object GUID: %s" % self.samdb.schema_format_value("objectGUID", ntds[0]["objectGUID"][0]))
print("DSA invocationId: %s\n" % self.samdb.schema_format_value("objectGUID", ntds[0]["invocationId"][0]))
diff --git a/source4/scripting/python/samba/netcmd/newuser.py b/source4/scripting/python/samba/netcmd/newuser.py
index 05c7bfc..3581340 100644
--- a/source4/scripting/python/samba/netcmd/newuser.py
+++ b/source4/scripting/python/samba/netcmd/newuser.py
@@ -94,3 +94,4 @@ class cmd_newuser(Command):
except Exception, e:
raise CommandError('Failed to create user "%s"' % username, e)
+ print("User %s created successfully" % username)
diff --git a/source4/setup/provision_dns_add.ldif b/source4/setup/provision_dns_add.ldif
index 04898e2..2263fcb 100644
--- a/source4/setup/provision_dns_add.ldif
+++ b/source4/setup/provision_dns_add.ldif
@@ -97,7 +97,7 @@ objectClass: person
objectClass: organizationalPerson
objectClass: user
description: DNS Service Account for ${HOSTNAME}
-userAccountControl: 514
+userAccountControl: 512
accountExpires: 9223372036854775807
sAMAccountName: dns-${HOSTNAME}
servicePrincipalName: DNS/${DNSNAME}
diff --git a/wintest/conf/abartlet.conf b/wintest/conf/abartlet.conf
index 00578f4..fe75408 100644
--- a/wintest/conf/abartlet.conf
+++ b/wintest/conf/abartlet.conf
@@ -31,7 +31,7 @@ BIND_USER : named
REALM : S4.HOWTO.ABARTLET.NET
LCREALM : s4.howto.abartlet.net
DOMAIN : s4-howto
-BASEDN : DC=S4,DC=howto,DC=abartlet,DC=net
+BASEDN : DC=s4,DC=howto,DC=abartlet,DC=net
PASSWORD1 : p at ssw0rd
PASSWORD2 : p at ssw0rd2
PASSWORD3 : p at ssw0rd3
@@ -51,12 +51,36 @@ WINXP_USER : administrator
WINXP_PASS : penguin
# Samba will join this w2k8r2 VM as a DC and then as a RODC
+W2K8R2A_HOSTNAME : Win2008R2-3
+W2K8R2A_VM : Win2008R2-3
+W2K8R2A_REALM : 2008R2.HOWTO.ABARTLET.NET
+W2K8R2A_DOMAIN : 2008R2HOWTO
+W2K8R2A_PASS : penguin12#
+W2K8R2A_SNAPSHOT : 1291076421
+W2K8R2A_IP : 192.168.122.108
+
+# this w2k8r2 VM will become a DC in the samba domain
W2K8R2B_HOSTNAME : Win2008R2-1
W2K8R2B_VM : Win2008R2-1
W2K8R2B_PASS : penguin12#
-W2K8R2B_SNAPSHOT : 1290382773
+W2K8R2B_SNAPSHOT : 1291077001
+
+# this w2k8r2 VM will become a RODC in the samba domain
+W2K8R2C_HOSTNAME : Win2008R2-4
+W2K8R2C_VM : Win2008R2-4
+W2K8R2C_PASS : penguin12#
+W2K8R2C_SNAPSHOT : 1291076693
# Samba will join this w2k3 VM as a DC
+W2K3A_HOSTNAME : Win2003R2-2
+W2K3A_VM : Win2003R2-2
+W2K3A_REALM : 2003.HOWTO.ABARTLET.NET
+W2K3A_DOMAIN : 2003HOWTO
+W2K3A_PASS : penguin
+W2K3A_SNAPSHOT : 1291097054
+W2K3A_IP : 192.168.122.155
+
+# this w2k3 VM will become a DC in the samba domain
W2K3B_HOSTNAME : Win2003R2-1
W2K3B_VM : Win2003R2-1
W2K3B_PASS : penguin
diff --git a/wintest/conf/tridge.conf b/wintest/conf/tridge.conf
index 72b54d8..f9ab1dc 100644
--- a/wintest/conf/tridge.conf
+++ b/wintest/conf/tridge.conf
@@ -53,7 +53,6 @@ WINXP_PASS : penguin
# Samba will join this w2k8r2 VM as a DC and then as a RODC
W2K8R2A_HOSTNAME : w2k8
W2K8R2A_VM : w2k8r2
-W2K8R2A_BASEDN : DC=v2,DC=tridgell,DC=net
W2K8R2A_REALM : v2.tridgell.net
W2K8R2A_DOMAIN : v2
W2K8R2A_PASS : p at ssw0rd5
@@ -76,7 +75,6 @@ W2K8R2C_SNAPSHOT : howto-test2
# Samba will join this w2k3 VM as a DC
W2K3A_HOSTNAME : w2k3
W2K3A_VM : w2003
-W2K3A_BASEDN : DC=vsofs3,DC=com
W2K3A_REALM : vsofs3.com
W2K3A_DOMAIN : vsofs3
W2K3A_PASS : penguin
diff --git a/wintest/test-s4-howto.py b/wintest/test-s4-howto.py
index 185a86d..d653d5f 100755
--- a/wintest/test-s4-howto.py
+++ b/wintest/test-s4-howto.py
@@ -4,7 +4,7 @@
import sys, os
import optparse
-import wintest, pexpect
+import wintest, pexpect, time
def check_prerequesites(t):
t.info("Checking prerequesites")
@@ -63,6 +63,13 @@ def start_s4(t):
'--option', 'panic action=gnome-terminal -e "gdb --pid %PID%"'])
t.port_wait("${INTERFACE_IP}", 139)
+def stop_vms(t):
+ '''Shut down any existing alive VMs, so they do not collide with what we are doing'''
+ t.info('Shutting down any of our VMs already running')
+ vms = t.get_vms()
+ for v in vms:
+ t.vm_poweroff(v, checkfail=False)
+
def test_smbclient(t):
'''test smbclient'''
t.info('Testing smbclient')
@@ -134,8 +141,6 @@ def restart_bind(t):
t.putenv('KEYTAB_FILE', '${PREFIX}/private/dns.keytab')
t.putenv('KRB5_KTNAME', '${PREFIX}/private/dns.keytab')
t.chdir('${PREFIX}')
- t.run_cmd("mkdir -p var/named/data")
- t.run_cmd("chown -R ${BIND_USER} var/named")
nameserver = t.get_nameserver()
if nameserver == t.getvar('INTERFACE_IP'):
@@ -218,6 +223,11 @@ options {
rndc_cmd(t, "stop", checkfail=False)
t.port_wait("${INTERFACE_IP}", 53, wait_for_fail=True)
+
+ t.run_cmd("rm -rf var/named")
+ t.run_cmd("mkdir -p var/named/data")
+ t.run_cmd("chown -R ${BIND_USER} var/named")
+
t.bind_child = t.run_child("${BIND9} -u ${BIND_USER} -n 1 -c ${PREFIX}/etc/named.conf -g")
t.port_wait("${INTERFACE_IP}", 53)
@@ -326,12 +336,15 @@ def test_dcpromo(t, vm):
t.info("Checking the dcpromo join is OK")
t.chdir('${PREFIX}')
t.port_wait("${WIN_IP}", 139)
+ t.retry_cmd("host -t A ${WIN_HOSTNAME}.${LCREALM}. ${INTERFACE_IP}",
+ ['${WIN_HOSTNAME}.${LCREALM} has address'],
+ retries=30, delay=10, casefold=True)
t.retry_cmd('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Uadministrator@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
t.cmd_contains("host -t A ${WIN_HOSTNAME}.${LCREALM}.", ['has address'])
t.cmd_contains('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])
t.cmd_contains("bin/samba-tool drs kcc ${HOSTNAME}.${LCREALM} -Uadministrator@${LCREALM}%${PASSWORD1}", ['Consistency check', 'successful'])
- t.cmd_contains("bin/samba-tool drs kcc ${WIN_HOSTNAME}.${LCREALM} -Uadministrator@${LCREALM}%${PASSWORD1}", ['Consistency check', 'successful'])
+ t.retry_cmd("bin/samba-tool drs kcc ${WIN_HOSTNAME}.${LCREALM} -Uadministrator@${LCREALM}%${PASSWORD1}", ['Consistency check', 'successful'])
t.kinit("administrator@${REALM}", "${PASSWORD1}")
@@ -380,7 +393,15 @@ def test_dcpromo(t, vm):
child = t.open_telnet("${WIN_HOSTNAME}", "${DOMAIN}\\administrator", "${PASSWORD1}", set_time=True)
child.sendline("net use t: \\\\${HOSTNAME}.${LCREALM}\\test")
- child.expect("The command completed successfully")
+
+ retries = 10
+ i = child.expect(["The command completed successfully", "The network path was not found"])
+ while i == 1 and retries > 0:
+ child.expect("C:")
+ time.sleep(2)
+ child.sendline("net use t: \\\\${HOSTNAME}.${LCREALM}\\test")
+ i = child.expect(["The command completed successfully", "The network path was not found"])
+ retries -=1
t.run_net_time(child)
@@ -394,7 +415,7 @@ def test_dcpromo(t, vm):
child.expect("was successful")
t.info("Checking if new users propogate to windows")
- t.run_cmd('bin/samba-tool newuser test2 ${PASSWORD2}')
+ t.retry_cmd('bin/samba-tool newuser test2 ${PASSWORD2}', ["created successfully"])
t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC'])
t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC'])
@@ -498,10 +519,10 @@ def test_dcpromo_rodc(t, vm):
t.vm_poweroff("${WIN_VM}")
-def join_as_dc(t, vm):
- '''join a windows domain as a DC'''
+def prep_join_as_dc(t, vm):
+ '''start VM and shutdown Samba in preperation to join a windows domain as a DC'''
t.setwinvars(vm)
- t.info("Joining ${WIN_VM} as a second DC using samba-tool join DC")
+ t.info("Starting VMs for joining ${WIN_VM} as a second DC using samba-tool join DC")
t.chdir('${PREFIX}')
t.run_cmd('killall -9 -q samba smbd nmbd winbindd', checkfail=False)
t.vm_poweroff("${WIN_VM}", checkfail=False)
@@ -510,6 +531,14 @@ def join_as_dc(t, vm):
t.run_cmd("rm -rf etc/smb.conf private")
child = t.open_telnet("${WIN_HOSTNAME}", "${WIN_DOMAIN}\\administrator", "${WIN_PASS}", set_time=True)
t.get_ipconfig(child)
+
+def join_as_dc(t, vm):
+ '''join a windows domain as a DC'''
+ t.setwinvars(vm)
+ t.info("Joining ${WIN_VM} as a second DC using samba-tool join DC")
+ t.port_wait("${WIN_IP}", 389)
+ t.retry_cmd("host -t SRV _ldap._tcp.${WIN_REALM} ${WIN_IP}", ['has SRV record'] )
+
t.retry_cmd("bin/samba-tool drs showrepl ${WIN_HOSTNAME}.${WIN_REALM} -Uadministrator%${WIN_PASS}", ['INBOUND NEIGHBORS'] )
t.run_cmd('bin/samba-tool join ${WIN_REALM} DC -Uadministrator%${WIN_PASS} -d${DEBUGLEVEL} --option=interfaces=${INTERFACE}')
t.run_cmd('bin/samba-tool drs kcc ${WIN_HOSTNAME}.${WIN_REALM} -Uadministrator@${WIN_REALM}%${WIN_PASS}')
@@ -532,8 +561,15 @@ def test_join_as_dc(t, vm):
t.cmd_contains("bin/samba-tool drs replicate ${HOSTNAME}.${WIN_REALM} ${WIN_HOSTNAME}.${WIN_REALM} %s -k yes" % nc, ["was successful"])
t.cmd_contains("bin/samba-tool drs replicate ${WIN_HOSTNAME}.${WIN_REALM} ${HOSTNAME}.${WIN_REALM} %s -k yes" % nc, ["was successful"])
- child.sendline("net use t: \\\\${HOSTNAME}.${WIN_REALM}\\test")
- child.expect("The command completed successfully")
+ retries = 10
+ i = 1
+ while i == 1 and retries > 0:
+ child.sendline("net use t: \\\\${HOSTNAME}.${WIN_REALM}\\test")
+ i = child.expect(["The command completed successfully", "The network path was not found"])
+ child.expect("C:")
+ if i == 1:
+ time.sleep(2)
+ retries -=1
t.info("Checking if showrepl is happy")
child.sendline("repadmin /showrepl")
@@ -545,7 +581,7 @@ def test_join_as_dc(t, vm):
child.expect("was successful")
t.info("Checking if new users propogate to windows")
- t.run_cmd('bin/samba-tool newuser test2 ${PASSWORD2}')
+ t.retry_cmd('bin/samba-tool newuser test2 ${PASSWORD2}', ["created successfully"])
t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${WIN_REALM} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC'])
t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${WIN_REALM} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC'])
@@ -571,14 +607,8 @@ def join_as_rodc(t, vm):
'''join a windows domain as a RODC'''
t.setwinvars(vm)
t.info("Joining ${WIN_VM} as a RODC using samba-tool join DC")
- t.chdir('${PREFIX}')
- t.run_cmd('killall -9 -q samba smbd nmbd winbindd', checkfail=False)
- t.vm_poweroff("${WIN_VM}", checkfail=False)
- t.vm_restore("${WIN_VM}", "${WIN_SNAPSHOT}")
- rndc_cmd(t, 'flush')
- t.run_cmd("rm -rf etc/smb.conf private")
- child = t.open_telnet("${WIN_HOSTNAME}", "${WIN_DOMAIN}\\administrator", "${WIN_PASS}", set_time=True)
- t.get_ipconfig(child)
+ t.port_wait("${WIN_IP}", 389)
+ t.retry_cmd("host -t SRV _ldap._tcp.${WIN_REALM} ${WIN_IP}", ['has SRV record'] )
t.retry_cmd("bin/samba-tool drs showrepl ${WIN_HOSTNAME}.${WIN_REALM} -Uadministrator%${WIN_PASS}", ['INBOUND NEIGHBORS'] )
t.run_cmd('bin/samba-tool join ${WIN_REALM} RODC -Uadministrator%${WIN_PASS} -d${DEBUGLEVEL} --option=interfaces=${INTERFACE}')
t.run_cmd('bin/samba-tool drs kcc ${WIN_HOSTNAME}.${WIN_REALM} -Uadministrator@${WIN_REALM}%${WIN_PASS}')
@@ -600,8 +630,15 @@ def test_join_as_rodc(t, vm):
for nc in [ '${WIN_BASEDN}', 'CN=Configuration,${WIN_BASEDN}', 'CN=Schema,CN=Configuration,${WIN_BASEDN}' ]:
t.cmd_contains("bin/samba-tool drs replicate ${HOSTNAME}.${WIN_REALM} ${WIN_HOSTNAME}.${WIN_REALM} %s -k yes" % nc, ["was successful"])
- child.sendline("net use t: \\\\${HOSTNAME}.${WIN_REALM}\\test")
- child.expect("The command completed successfully")
+ retries = 10
+ i = 1
+ while i == 1 and retries > 0:
+ child.sendline("net use t: \\\\${HOSTNAME}.${WIN_REALM}\\test")
+ i = child.expect(["The command completed successfully", "The network path was not found"])
+ child.expect("C:")
+ if i == 1:
+ time.sleep(2)
+ retries -=1
t.info("Checking if showrepl is happy")
child.sendline("repadmin /showrepl")
@@ -638,6 +675,58 @@ def test_join_as_rodc(t, vm):
t.vm_poweroff("${WIN_VM}")
+def run_dcpromo_as_first_dc(t, vm, func_level=None):
+ t.setwinvars(vm)
+ t.info("Configuring a windows VM ${WIN_VM} at the first DC in the domain using dcpromo")
+ child = t.open_telnet("${WIN_HOSTNAME}", "administrator", "${WIN_PASS}", set_time=True)
+ child.sendline("dcdiag");
+ if t.get_is_dc(child):
+ return
+
+ if func_level == '2008r2':
+ t.setvar("FUNCTION_LEVEL_INT", str(4))
+ elif func_level == '2003':
+ t.setvar("FUNCTION_LEVEL_INT", str(1))
+ else:
+ t.setvar("FUNCTION_LEVEL_INT", str(0))
+
+ child = t.open_telnet("${WIN_HOSTNAME}", "administrator", "${WIN_PASS}", set_ip=True)
+ child.sendline("dcdiag");
+
+ """This server must therefore not yet be a directory server, so we must promote it"""
+ child.sendline("copy /Y con answers.txt")
+ child.sendline('''
+[DCInstall]
+; New forest promotion
+ReplicaOrNewDomain=Domain
+NewDomain=Forest
+NewDomainDNSName=${WIN_REALM}
+ForestLevel=${FUNCTION_LEVEL_INT}
+DomainNetbiosName=${WIN_DOMAIN}
+DomainLevel=${FUNCTION_LEVEL_INT}
+InstallDNS=Yes
+ConfirmGc=Yes
+CreateDNSDelegation=No
+DatabasePath="C:\Windows\NTDS"
+LogPath="C:\Windows\NTDS"
+SYSVOLPath="C:\Windows\SYSVOL"
+; Set SafeModeAdminPassword to the correct value prior to using the unattend file
+SafeModeAdminPassword=${WIN_PASS}
+; Run-time flags (optional)
+RebootOnCompletion=No
+
+''')
+ child.expect("copied.")
+ child.expect("C:")
+ child.expect("C:")
+ child.sendline("dcpromo /answer:answers.txt")
+ i = child.expect(["You must restart this computer", "failed", "Active Directory Domain Services was not installed", "C:"], timeout=120)
+ if i == 1 or i == 2:
+ raise Exception("dcpromo failed")
+ child.sendline("shutdown -r -t 0")
+ t.port_wait("${WIN_IP}", 139, wait_for_fail=True)
+ t.port_wait("${WIN_IP}", 139)
+
def test_howto(t):
'''test the Samba4 howto'''
@@ -657,6 +746,8 @@ def test_howto(t):
if not t.skip("starts4"):
start_s4(t)
+ if not t.skip("stop_vms"):
+ stop_vms(t)
if not t.skip("smbclient"):
test_smbclient(t)
if not t.skip("startbind"):
@@ -706,6 +797,8 @@ def test_howto(t):
test_dcpromo(t, "W2K3B")
if t.have_vm('W2K8R2A') and not t.skip("join_w2k8r2"):
+ prep_join_as_dc(t, "W2K8R2A")
+ run_dcpromo_as_first_dc(t, "W2K8R2A", func_level='2008r2')
join_as_dc(t, "W2K8R2A")
create_shares(t)
start_s4(t)
@@ -713,6 +806,8 @@ def test_howto(t):
test_join_as_dc(t, "W2K8R2A")
if t.have_vm('W2K8R2A') and not t.skip("join_rodc"):
+ prep_join_as_dc(t, "W2K8R2A")
+ run_dcpromo_as_first_dc(t, "W2K8R2A", func_level='2008r2')
join_as_rodc(t, "W2K8R2A")
create_shares(t)
start_s4(t)
@@ -720,6 +815,8 @@ def test_howto(t):
test_join_as_rodc(t, "W2K8R2A")
if t.have_vm('W2K3A') and not t.skip("join_w2k3"):
+ prep_join_as_dc(t, "W2K3A")
+ run_dcpromo_as_first_dc(t, "W2K3A", func_level='2003')
join_as_dc(t, "W2K3A")
create_shares(t)
start_s4(t)
@@ -741,7 +838,7 @@ if __name__ == '__main__':
parser = optparse.OptionParser("test-howto.py")
parser.add_option("--conf", type='string', default='', help='config file')
parser.add_option("--skip", type='string', default='', help='list of steps to skip (comma separated)')
- parser.add_option("--vms", type='string', default='', help='list of VMs to use (comma separated)')
+ parser.add_option("--vms", type='string', default=None, help='list of VMs to use (comma separated)')
parser.add_option("--list", action='store_true', default=False, help='list the available steps')
parser.add_option("--rebase", action='store_true', default=False, help='do a git pull --rebase')
parser.add_option("--clean", action='store_true', default=False, help='clean the tree')
diff --git a/wintest/wintest.py b/wintest/wintest.py
index cc24c0d..4ba4b4d 100644
--- a/wintest/wintest.py
+++ b/wintest/wintest.py
@@ -26,13 +26,19 @@ class wintest():
def setwinvars(self, vm, prefix='WIN'):
'''setup WIN_XX vars based on a vm name'''
- for v in ['VM', 'HOSTNAME', 'USER', 'PASS', 'SNAPSHOT', 'BASEDN', 'REALM', 'DOMAIN', 'IP']:
+ for v in ['VM', 'HOSTNAME', 'USER', 'PASS', 'SNAPSHOT', 'REALM', 'DOMAIN', 'IP']:
vname = '%s_%s' % (vm, v)
if vname in self.vars:
self.setvar("%s_%s" % (prefix,v), self.substitute("${%s}" % vname))
else:
self.vars.pop("%s_%s" % (prefix,v), None)
+ if self.getvar("WIN_REALM"):
+ self.setvar("WIN_REALM", self.getvar("WIN_REALM").upper())
+ self.setvar("WIN_LCREALM", self.getvar("WIN_REALM").lower())
+ dnsdomain = self.getvar("WIN_REALM")
+ self.setvar("WIN_BASEDN", "DC=" + dnsdomain.replace(".", ",DC="))
+
def info(self, msg):
'''print some information'''
if not self.list_mode:
@@ -62,7 +68,8 @@ class wintest():
def set_vms(self, vms):
'''set a list of VMs to test'''
- self.vms = vms.split(',')
+ if vms is not None:
+ self.vms = vms.split(',')
def skip(self, step):
'''return True if we should skip a step'''
@@ -170,7 +177,7 @@ class wintest():
return self.run_cmd(cmd, output=True)
def cmd_contains(self, cmd, contains, nomatch=False, ordered=False, regex=False,
- casefold=False):
+ casefold=True):
'''check that command output contains the listed strings'''
if isinstance(contains, str):
@@ -180,6 +187,9 @@ class wintest():
self.info(out)
for c in self.substitute(contains):
if regex:
+ if casefold:
+ c = c.upper()
+ out = out.upper()
m = re.search(c, out)
if m is None:
start = -1
@@ -203,7 +213,7 @@ class wintest():
out = out[end:]
def retry_cmd(self, cmd, contains, retries=30, delay=2, wait_for_fail=False,
- ordered=False, regex=False, casefold=False):
+ ordered=False, regex=False, casefold=True):
'''retry a command a number of times'''
while retries > 0:
try:
@@ -231,7 +241,12 @@ class wintest():
def expect_sub(line, timeout=ret.timeout, casefold=casefold):
line = self.substitute(line)
if casefold:
- line = "(?i)" + line
+ if isinstance(line, list):
+ for i in range(len(line)):
+ if isinstance(line[i], str):
+ line[i] = '(?i)' + line[i]
+ elif isinstance(line, str):
+ line = '(?i)' + line
return ret.old_expect(line, timeout=timeout)
ret.old_sendline = ret.sendline
@@ -327,6 +342,29 @@ class wintest():
self.setvar('WIN_DEFAULT_GATEWAY', child.after)
child.expect("C:")
+ def get_is_dc(self, child):
+ child.sendline("dcdiag")
+ 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:
--
Samba Shared Repository
More information about the samba-cvs
mailing list