Changeset 988 for vendor/current/wintest
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- Location:
- vendor/current/wintest
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/wintest/conf/abartlet.conf
r740 r988 17 17 # interfaces to create 18 18 INTERFACE : virbr0:0 19 NAMED_INTERFACE : virbr0:1 19 20 20 21 # this is an additional IP that will be used for named to listen 21 # on. It should not be the primary IP of the interface 22 INTERFACE_IP : 192.168.122.2 23 INTERFACE_NET : 192.168.122.2/24 22 # on. It should not be the primary IP of the interface. We need one 23 # for BIND (which redirects to the other hosts) and one for Samba, 24 # which might be running our own DNS 25 26 INTERFACE_IP : 192.168.122.3 27 INTERFACE_NET : 192.168.122.3/24 28 NAMED_INTERFACE_IP : 192.168.122.2 29 NAMED_INTERFACE_NET : 192.168.122.2/24 24 30 25 31 # how to run bind9 … … 39 45 40 46 # a Windows7 VM 41 WINDOWS7_HOSTNAME : Windows7- 142 WINDOWS7_VM : Windows7- 143 WINDOWS7_SNAPSHOT : 1 29038959447 WINDOWS7_HOSTNAME : Windows7-3 48 WINDOWS7_VM : Windows7-3 49 WINDOWS7_SNAPSHOT : 1329351855 44 50 WINDOWS7_USER : administrator 45 51 WINDOWS7_PASS : penguin … … 48 54 WINXP_HOSTNAME : WinXP-1 49 55 WINXP_VM : WinXP-1 50 WINXP_SNAPSHOT : 1 29038622756 WINXP_SNAPSHOT : 1329361864 51 57 WINXP_USER : administrator 52 58 WINXP_PASS : penguin … … 58 64 W2K8R2A_DOMAIN : 2008R2HOWTO 59 65 W2K8R2A_PASS : penguin12# 60 W2K8R2A_SNAPSHOT : 1 29107642161 W2K8R2A_IP : 192.168.122. 10866 W2K8R2A_SNAPSHOT : 1329218595 67 W2K8R2A_IP : 192.168.122.57 62 68 63 69 # this w2k8r2 VM will become a DC in the samba domain 64 W2K8R2B_HOSTNAME : Win2008R2- 165 W2K8R2B_VM : Win2008R2- 170 W2K8R2B_HOSTNAME : Win2008R2-7 71 W2K8R2B_VM : Win2008R2-7 66 72 W2K8R2B_PASS : penguin12# 67 W2K8R2B_SNAPSHOT : 1 29107700173 W2K8R2B_SNAPSHOT : 1329964204 68 74 69 75 # this w2k8r2 VM will become a RODC in the samba domain 70 W2K8R2C_HOSTNAME : Win2008R2- 471 W2K8R2C_VM : Win2008R2- 476 W2K8R2C_HOSTNAME : Win2008R2-6 77 W2K8R2C_VM : Win2008R2-6 72 78 W2K8R2C_PASS : penguin12# 73 W2K8R2C_SNAPSHOT : 1 29107669379 W2K8R2C_SNAPSHOT : 1329785556 74 80 75 81 # Samba will join this w2k3 VM as a DC … … 79 85 W2K3A_DOMAIN : 2003HOWTO 80 86 W2K3A_PASS : penguin 81 W2K3A_SNAPSHOT : 1 29790174187 W2K3A_SNAPSHOT : 1314652035 82 88 W2K3A_IP : 192.168.122.91 83 89 84 90 # this w2k3 VM will become a DC in the samba domain 85 W2K3B_HOSTNAME : Win2003R2- 186 W2K3B_VM : Win2003R2- 191 W2K3B_HOSTNAME : Win2003R2-4 92 W2K3B_VM : Win2003R2-4 87 93 W2K3B_PASS : penguin 88 W2K3B_SNAPSHOT : 1 29790137689 W2K3B_IP : 192.168.122.1 5594 W2K3B_SNAPSHOT : 1331186260 95 W2K3B_IP : 192.168.122.164 90 96 91 97 # this w2k3 VM will become a member in the samba domain 92 W2K3C_HOSTNAME : Win2003 -193 W2K3C_VM : Win2003 -198 W2K3C_HOSTNAME : Win2003R2-3 99 W2K3C_VM : Win2003R2-3 94 100 W2K3C_PASS : penguin 95 W2K3C_SNAPSHOT : 1 29790064996 W2K3C_IP : 192.168.122. 38101 W2K3C_SNAPSHOT : 1329451062 102 W2K3C_IP : 192.168.122.162 97 103 98 104 -
vendor/current/wintest/test-s3.py
r740 r988 44 44 t.info('Testing wbinfo') 45 45 t.chdir('${PREFIX}') 46 t.cmd_contains("bin/wbinfo --version", ["Version 3."])46 t.cmd_contains("bin/wbinfo --version", ["Version 4."]) 47 47 t.cmd_contains("bin/wbinfo -p", ["Ping to winbindd succeeded"]) 48 48 t.retry_cmd("bin/wbinfo --online-status", … … 71 71 "challenge/response password authentication succeeded"]) 72 72 73 t.retry_cmd("bin/wbinfo --krb5auth=${WIN_DOMAIN}/administrator%${WIN_PASS}", 74 ["succeeded"]) 75 73 76 74 77 def test_smbclient(t): 75 78 t.info('Testing smbclient') 76 t.chdir('${PREFIX}') 77 t.cmd_contains("bin/smbclient --version", ["Version 3."]) 78 t.cmd_contains('bin/smbclient -L ${INTERFACE_IP} -U%', ["Domain=[${WIN_DOMAIN}]", "test", "IPC$", "Samba 3."], 79 smbclient = t.getvar("smbclient") 80 t.chdir('${PREFIX}') 81 t.cmd_contains("%s --version" % (smbclient), ["Version 4."]) 82 t.cmd_contains('%s -L ${INTERFACE_IP} -U%%' % (smbclient), ["Domain=[${WIN_DOMAIN}]", "test", "IPC$", "Samba 4."], 79 83 casefold=True) 80 child = t.pexpect_spawn(' bin/smbclient //${HOSTNAME}.${WIN_REALM}/test -Uroot@${WIN_REALM}%${PASSWORD2}')84 child = t.pexpect_spawn('%s //${HOSTNAME}.${WIN_REALM}/test -Uroot@${WIN_REALM}%%${PASSWORD2}' % (smbclient)) 81 85 child.expect("smb:") 82 86 child.sendline("dir") … … 89 93 child.sendline("rmdir testdir") 90 94 91 child = t.pexpect_spawn(' bin/smbclient //${HOSTNAME}.${WIN_REALM}/test -Uroot@${WIN_REALM}%${PASSWORD2} -k')95 child = t.pexpect_spawn('%s //${HOSTNAME}.${WIN_REALM}/test -Uroot@${WIN_REALM}%%${PASSWORD2} -k' % (smbclient)) 92 96 child.expect("smb:") 93 97 child.sendline("dir") … … 100 104 child.sendline("rmdir testdir") 101 105 102 103 106 def create_shares(t): 104 107 t.info("Adding test shares") 105 108 t.chdir('${PREFIX}') 106 t.write_file(" lib/smb.conf", '''109 t.write_file("etc/smb.conf", ''' 107 110 [test] 108 111 path = ${PREFIX}/test … … 124 127 t.get_ipconfig(child) 125 128 t.del_files(["var", "private"]) 126 t.write_file(" lib/smb.conf", '''129 t.write_file("etc/smb.conf", ''' 127 130 [global] 128 131 netbios name = ${HOSTNAME} … … 157 160 ['${HOSTNAME}.${WIN_REALM} has address']) 158 161 159 160 def test_join_as_member(t, vm): 161 '''test the domain join''' 162 t.setwinvars(vm) 163 t.info('Testing join as member') 162 def create_root_account(t, vm): 163 t.setwinvars(vm) 164 t.info("Creating 'root' account for testing Samba3 member server") 164 165 t.chdir('${PREFIX}') 165 166 t.run_cmd('bin/net ads user add root -Uadministrator%${WIN_PASS}') … … 173 174 child.sendline("user edit disabled root no") 174 175 child.expect("Set root's disabled flag") 176 177 def test_join_as_member(t, vm): 178 '''test the domain join''' 179 t.setwinvars(vm) 180 t.info('Testing join as member') 181 t.chdir('${PREFIX}') 175 182 test_wbinfo(t) 176 183 test_smbclient(t) … … 180 187 '''basic s3 testing''' 181 188 182 t.setvar("SAMBA_VERSION", "Version 3") 189 t.setvar("SAMBA_VERSION", "Version 4") 190 t.setvar("smbclient", "bin/smbclient") 183 191 t.check_prerequesites() 184 192 set_libpath(t) … … 209 217 create_shares(t) 210 218 start_s3(t) 219 create_root_account(t, "W2K8R2A") 211 220 test_join_as_member(t, "W2K8R2A") 212 221 … … 229 238 t.test_remote_smbclient('WINDOWS7', "%s@%s" % (dom_username, dom_realm), dom_password, args="-k") 230 239 t.test_remote_smbclient('WINDOWS7', "%s@%s" % (dom_username, dom_realm), dom_password, args="-k --option=clientusespnegoprincipal=yes") 240 t.test_net_use('WINDOWS7', dom_realm, t.getvar("W2K8R2A_DOMAIN"), 'root', '${PASSWORD2}') 231 241 232 242 if t.have_var('WINXP_VM') and t.have_var('W2K8R2A_VM') and not t.skip("join_winxp_2008r2"): … … 247 257 t.test_remote_smbclient('WINXP', "%s@%s" % (dom_username, dom_realm), dom_password, args="-k") 248 258 t.test_remote_smbclient('WINXP', "%s@%s" % (dom_username, dom_realm), dom_password, args="-k --clientusespnegoprincipal=yes") 259 t.test_net_use('WINXP', dom_realm, t.getvar("W2K8R2A_DOMAIN"), 'root', '${PASSWORD2}') 249 260 250 261 t.info("S3 test: All OK") -
vendor/current/wintest/test-s4-howto.py
r740 r988 26 26 t.del_files(["var", "private"]) 27 27 t.run_cmd("rm -f etc/smb.conf") 28 provision=['sbin/provision', 28 provision=['bin/samba-tool', 29 'domain', 30 'provision', 29 31 '--realm=${LCREALM}', 30 32 '--domain=${DOMAIN}', … … 36 38 '--host-ip=${INTERFACE_IP}', 37 39 '--option=bind interfaces only=yes', 38 '--option=rndc command=${RNDC} -c${PREFIX}/etc/rndc.conf'] 40 '--option=rndc command=${RNDC} -c${PREFIX}/etc/rndc.conf', 41 '--dns-backend=${NAMESERVER_BACKEND}', 42 '${DNS_FORWARDER}'] 43 if t.getvar('USE_NTVFS'): 44 provision.append('${USE_NTVFS}') 45 39 46 if t.getvar('INTERFACE_IPV6'): 40 47 provision.append('--host-ip6=${INTERFACE_IPV6}') 41 48 t.run_cmd(provision) 42 t.run_cmd('bin/samba-tool newusertestallowed ${PASSWORD1}')43 t.run_cmd('bin/samba-tool newusertestdenied ${PASSWORD1}')49 t.run_cmd('bin/samba-tool user add testallowed ${PASSWORD1}') 50 t.run_cmd('bin/samba-tool user add testdenied ${PASSWORD1}') 44 51 t.run_cmd('bin/samba-tool group addmembers "Allowed RODC Password Replication Group" testallowed') 45 52 … … 51 58 t.run_cmd('killall -9 -q samba smbd nmbd winbindd', checkfail=False) 52 59 t.run_cmd(['sbin/samba', 53 '--option', 'panic action=gnome-terminal -e "gdb --pid % PID%"'])60 '--option', 'panic action=gnome-terminal -e "gdb --pid %d"', '--option', 'max protocol=nt1']) 54 61 t.port_wait("${INTERFACE_IP}", 139) 55 62 … … 57 64 '''test smbclient against localhost''' 58 65 t.info('Testing smbclient') 59 t.chdir('${PREFIX}') 60 t.cmd_contains("bin/smbclient --version", ["Version 4.0"]) 61 t.retry_cmd('bin/smbclient -L ${INTERFACE_IP} -U%', ["netlogon", "sysvol", "IPC Service"]) 62 child = t.pexpect_spawn('bin/smbclient //${INTERFACE_IP}/netlogon -Uadministrator%${PASSWORD1}') 66 smbclient = t.getvar("smbclient") 67 t.chdir('${PREFIX}') 68 t.cmd_contains("%s --version" % (smbclient), ["Version 4.1"]) 69 t.retry_cmd('%s -L ${INTERFACE_IP} -U%%' % (smbclient), ["netlogon", "sysvol", "IPC Service"]) 70 child = t.pexpect_spawn('%s //${INTERFACE_IP}/netlogon -Uadministrator%%${PASSWORD1}' % (smbclient)) 63 71 child.expect("smb:") 64 72 child.sendline("dir") … … 112 120 t.chdir('${PREFIX}') 113 121 t.run_cmd("sbin/samba_dnsupdate --fail-immediately") 114 t.rndc_cmd("flush") 122 if not t.getvar('NAMESERVER_BACKEND') == 'SAMBA_INTERNAL': 123 t.rndc_cmd("flush") 115 124 116 125 … … 123 132 def test_winjoin(t, vm): 124 133 t.info("Checking the windows join is OK") 134 smbclient = t.getvar("smbclient") 125 135 t.chdir('${PREFIX}') 126 136 t.port_wait("${WIN_IP}", 139) 127 t.retry_cmd(' bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Uadministrator@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"], retries=100)137 t.retry_cmd('%s -L ${WIN_HOSTNAME}.${LCREALM} -Uadministrator@${LCREALM}%%${PASSWORD1}' % (smbclient), ["C$", "IPC$", "Sharename"], retries=100) 128 138 t.cmd_contains("host -t A ${WIN_HOSTNAME}.${LCREALM}.", ['has address']) 129 t.cmd_contains(' bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])130 t.cmd_contains(' bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -k no -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])131 t.cmd_contains(' bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -k yes -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])139 t.cmd_contains('%s -L ${WIN_HOSTNAME}.${LCREALM} -Utestallowed@${LCREALM}%%${PASSWORD1}' % (smbclient), ["C$", "IPC$", "Sharename"]) 140 t.cmd_contains('%s -L ${WIN_HOSTNAME}.${LCREALM} -k no -Utestallowed@${LCREALM}%%${PASSWORD1}' % (smbclient), ["C$", "IPC$", "Sharename"]) 141 t.cmd_contains('%s -L ${WIN_HOSTNAME}.${LCREALM} -k yes -Utestallowed@${LCREALM}%%${PASSWORD1}' % (smbclient), ["C$", "IPC$", "Sharename"]) 132 142 child = t.open_telnet("${WIN_HOSTNAME}", "${DOMAIN}\\administrator", "${PASSWORD1}") 133 143 child.sendline("net use t: \\\\${HOSTNAME}.${LCREALM}\\test") … … 165 175 child.expect("C:") 166 176 child.sendline("dcpromo /answer:answers.txt") 167 i = child.expect(["You must restart this computer", "failed", "Active Directory Domain Services was not installed", "C:"], timeout= 120)177 i = child.expect(["You must restart this computer", "failed", "Active Directory Domain Services was not installed", "C:"], timeout=240) 168 178 if i == 1 or i == 2: 169 179 child.sendline("echo off") … … 179 189 '''test that dcpromo worked''' 180 190 t.info("Checking the dcpromo join is OK") 191 smbclient = t.getvar("smbclient") 181 192 t.chdir('${PREFIX}') 182 193 t.port_wait("${WIN_IP}", 139) 183 t.retry_cmd("host -t A ${WIN_HOSTNAME}.${LCREALM}. ${ INTERFACE_IP}",194 t.retry_cmd("host -t A ${WIN_HOSTNAME}.${LCREALM}. ${NAMED_INTERFACE_IP}", 184 195 ['${WIN_HOSTNAME}.${LCREALM} has address'], 185 196 retries=30, delay=10, casefold=True) 186 t.retry_cmd(' bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Uadministrator@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])197 t.retry_cmd('%s -L ${WIN_HOSTNAME}.${LCREALM} -Uadministrator@${LCREALM}%%${PASSWORD1}' % (smbclient), ["C$", "IPC$", "Sharename"]) 187 198 t.cmd_contains("host -t A ${WIN_HOSTNAME}.${LCREALM}.", ['has address']) 188 t.cmd_contains(' bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])199 t.cmd_contains('%s -L ${WIN_HOSTNAME}.${LCREALM} -Utestallowed@${LCREALM}%%${PASSWORD1}' % (smbclient), ["C$", "IPC$", "Sharename"]) 189 200 190 201 t.cmd_contains("bin/samba-tool drs kcc ${HOSTNAME}.${LCREALM} -Uadministrator@${LCREALM}%${PASSWORD1}", ['Consistency check', 'successful']) … … 260 271 261 272 t.info("Checking if new users propogate to windows") 262 t.retry_cmd('bin/samba-tool newusertest2 ${PASSWORD2}', ["created successfully"])263 t.retry_cmd(" bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC'])264 t.retry_cmd(" bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC'])273 t.retry_cmd('bin/samba-tool user add test2 ${PASSWORD2}', ["created successfully"]) 274 t.retry_cmd("%s -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%%${PASSWORD2} -k no" % (smbclient), ['Sharename', 'Remote IPC']) 275 t.retry_cmd("%s -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%%${PASSWORD2} -k yes" % (smbclient), ['Sharename', 'Remote IPC']) 265 276 266 277 t.info("Checking if new users on windows propogate to samba") … … 273 284 time.sleep(2) 274 285 275 t.retry_cmd(" bin/smbclient -L ${HOSTNAME}.${LCREALM} -Utest3%${PASSWORD3} -k no", ['Sharename', 'IPC'])276 t.retry_cmd(" bin/smbclient -L ${HOSTNAME}.${LCREALM} -Utest3%${PASSWORD3} -k yes", ['Sharename', 'IPC'])286 t.retry_cmd("%s -L ${HOSTNAME}.${LCREALM} -Utest3%%${PASSWORD3} -k no" % (smbclient), ['Sharename', 'IPC']) 287 t.retry_cmd("%s -L ${HOSTNAME}.${LCREALM} -Utest3%%${PASSWORD3} -k yes" % (smbclient), ['Sharename', 'IPC']) 277 288 278 289 t.info("Checking propogation of user deletion") … … 281 292 child.expect("The command completed successfully") 282 293 283 t.retry_cmd(" bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE'])284 t.retry_cmd(" bin/smbclient -L ${HOSTNAME}.${LCREALM} -Utest3%${PASSWORD3} -k no", ['LOGON_FAILURE'])285 t.retry_cmd(" bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%${PASSWORD2} -k yes", ['LOGON_FAILURE'])286 t.retry_cmd(" bin/smbclient -L ${HOSTNAME}.${LCREALM} -Utest3%${PASSWORD3} -k yes", ['LOGON_FAILURE'])294 t.retry_cmd("%s -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%%${PASSWORD2} -k no" % (smbclient), ['LOGON_FAILURE']) 295 t.retry_cmd("%s -L ${HOSTNAME}.${LCREALM} -Utest3%%${PASSWORD3} -k no" % (smbclient), ['LOGON_FAILURE']) 296 t.retry_cmd("%s -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%%${PASSWORD2} -k yes" % (smbclient), ['LOGON_FAILURE']) 297 t.retry_cmd("%s -L ${HOSTNAME}.${LCREALM} -Utest3%%${PASSWORD3} -k yes" % (smbclient), ['LOGON_FAILURE']) 287 298 t.vm_poweroff("${WIN_VM}") 288 299 … … 339 350 '''test the RODC dcpromo worked''' 340 351 t.info("Checking the w2k8 RODC join is OK") 352 smbclient = t.getvar("smbclient") 341 353 t.chdir('${PREFIX}') 342 354 t.port_wait("${WIN_IP}", 139) 343 355 child = t.open_telnet("${WIN_HOSTNAME}", "${DOMAIN}\\administrator", "${PASSWORD1}", set_time=True) 344 356 child.sendline("ipconfig /registerdns") 345 t.retry_cmd(' bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Uadministrator@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])357 t.retry_cmd('%s -L ${WIN_HOSTNAME}.${LCREALM} -Uadministrator@${LCREALM}%%${PASSWORD1}' % (smbclient), ["C$", "IPC$", "Sharename"]) 346 358 t.cmd_contains("host -t A ${WIN_HOSTNAME}.${LCREALM}.", ['has address']) 347 t.cmd_contains(' bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utestallowed@${LCREALM}%${PASSWORD1}', ["C$", "IPC$", "Sharename"])359 t.cmd_contains('%s -L ${WIN_HOSTNAME}.${LCREALM} -Utestallowed@${LCREALM}%%${PASSWORD1}' % (smbclient), ["C$", "IPC$", "Sharename"]) 348 360 child.sendline("net use t: \\\\${HOSTNAME}.${LCREALM}\\test") 349 361 child.expect("The command completed successfully") … … 374 386 375 387 t.info("Checking if new users are available on windows") 376 t.run_cmd('bin/samba-tool newusertest2 ${PASSWORD2}')377 t.retry_cmd(" bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC'])388 t.run_cmd('bin/samba-tool user add test2 ${PASSWORD2}') 389 t.retry_cmd("%s -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%%${PASSWORD2} -k yes" % (smbclient), ['Sharename', 'Remote IPC']) 378 390 t.retry_cmd("bin/samba-tool drs replicate ${WIN_HOSTNAME}.${LCREALM} ${HOSTNAME}.${LCREALM} ${BASEDN}", ["was successful"]) 379 t.retry_cmd(" bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC'])391 t.retry_cmd("%s -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%%${PASSWORD2} -k no" % (smbclient), ['Sharename', 'Remote IPC']) 380 392 t.run_cmd('bin/samba-tool user delete test2 -Uadministrator@${LCREALM}%${PASSWORD1}') 381 t.retry_cmd(" bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%${PASSWORD2} -k yes", ['LOGON_FAILURE'])382 t.retry_cmd(" bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE'])393 t.retry_cmd("%s -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%%${PASSWORD2} -k yes" % (smbclient), ['LOGON_FAILURE']) 394 t.retry_cmd("%s -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%%${PASSWORD2} -k no" % (smbclient), ['LOGON_FAILURE']) 383 395 t.vm_poweroff("${WIN_VM}") 384 396 … … 386 398 def prep_join_as_dc(t, vm): 387 399 '''start VM and shutdown Samba in preperation to join a windows domain as a DC''' 388 t.info("Starting VMs for joining ${WIN_VM} as a second DC using samba-tool join DC")400 t.info("Starting VMs for joining ${WIN_VM} as a second DC using samba-tool domain join DC") 389 401 t.chdir('${PREFIX}') 390 402 t.run_cmd('killall -9 -q samba smbd nmbd winbindd', checkfail=False) 391 t.rndc_cmd('flush') 403 if not t.getvar('NAMESERVER_BACKEND') == 'SAMBA_INTERNAL': 404 t.rndc_cmd('flush') 392 405 t.run_cmd("rm -rf etc/smb.conf private") 393 406 child = t.open_telnet("${WIN_HOSTNAME}", "${WIN_DOMAIN}\\administrator", "${WIN_PASS}", set_time=True) … … 397 410 '''join a windows domain as a DC''' 398 411 t.setwinvars(vm) 399 t.info("Joining ${WIN_VM} as a second DC using samba-tool join DC")412 t.info("Joining ${WIN_VM} as a second DC using samba-tool domain join DC") 400 413 t.port_wait("${WIN_IP}", 389) 401 414 t.retry_cmd("host -t SRV _ldap._tcp.${WIN_REALM} ${WIN_IP}", ['has SRV record'] ) 402 415 403 416 t.retry_cmd("bin/samba-tool drs showrepl ${WIN_HOSTNAME}.${WIN_REALM} -Uadministrator%${WIN_PASS}", ['INBOUND NEIGHBORS'] ) 404 t.run_cmd('bin/samba-tool join ${WIN_REALM} DC -Uadministrator%${WIN_PASS} -d${DEBUGLEVEL} --option=interfaces=${INTERFACE}')417 t.run_cmd('bin/samba-tool domain join ${WIN_REALM} DC -Uadministrator%${WIN_PASS} -d${DEBUGLEVEL} --option=interfaces=${INTERFACE}') 405 418 t.run_cmd('bin/samba-tool drs kcc ${WIN_HOSTNAME}.${WIN_REALM} -Uadministrator@${WIN_REALM}%${WIN_PASS}') 406 419 … … 409 422 '''test the join of a windows domain as a DC''' 410 423 t.info("Checking the DC join is OK") 411 t.chdir('${PREFIX}') 412 t.retry_cmd('bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Uadministrator@${WIN_REALM}%${WIN_PASS}', ["C$", "IPC$", "Sharename"]) 424 smbclient = t.getvar("smbclient") 425 t.chdir('${PREFIX}') 426 t.retry_cmd('%s -L ${HOSTNAME}.${WIN_REALM} -Uadministrator@${WIN_REALM}%%${WIN_PASS}' % (smbclient), ["C$", "IPC$", "Sharename"]) 413 427 t.cmd_contains("host -t A ${HOSTNAME}.${WIN_REALM}.", ['has address']) 414 428 child = t.open_telnet("${WIN_HOSTNAME}", "${WIN_DOMAIN}\\administrator", "${WIN_PASS}", set_time=True) … … 422 436 t.cmd_contains("bin/samba-tool drs replicate ${HOSTNAME}.${WIN_REALM} ${WIN_HOSTNAME}.${WIN_REALM} %s -k yes" % nc, ["was successful"]) 423 437 t.cmd_contains("bin/samba-tool drs replicate ${WIN_HOSTNAME}.${WIN_REALM} ${HOSTNAME}.${WIN_REALM} %s -k yes" % nc, ["was successful"]) 438 439 child.sendline("ipconfig /flushdns") 440 child.expect("Successfully flushed") 424 441 425 442 retries = 10 … … 443 460 444 461 t.info("Checking if new users propogate to windows") 445 t.retry_cmd('bin/samba-tool newusertest2 ${PASSWORD2}', ["created successfully"])446 t.retry_cmd(" bin/smbclient -L ${WIN_HOSTNAME}.${WIN_REALM} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC'])447 t.retry_cmd(" bin/smbclient -L ${WIN_HOSTNAME}.${WIN_REALM} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC'])462 t.retry_cmd('bin/samba-tool user add test2 ${PASSWORD2}', ["created successfully"]) 463 t.retry_cmd("%s -L ${WIN_HOSTNAME}.${WIN_REALM} -Utest2%%${PASSWORD2} -k no" % (smbclient), ['Sharename', 'Remote IPC']) 464 t.retry_cmd("%s -L ${WIN_HOSTNAME}.${WIN_REALM} -Utest2%%${PASSWORD2} -k yes" % (smbclient), ['Sharename', 'Remote IPC']) 448 465 449 466 t.info("Checking if new users on windows propogate to samba") 450 467 child.sendline("net user test3 ${PASSWORD3} /add") 451 468 child.expect("The command completed successfully") 452 t.retry_cmd(" bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Utest3%${PASSWORD3} -k no", ['Sharename', 'IPC'])453 t.retry_cmd(" bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Utest3%${PASSWORD3} -k yes", ['Sharename', 'IPC'])469 t.retry_cmd("%s -L ${HOSTNAME}.${WIN_REALM} -Utest3%%${PASSWORD3} -k no" % (smbclient), ['Sharename', 'IPC']) 470 t.retry_cmd("%s -L ${HOSTNAME}.${WIN_REALM} -Utest3%%${PASSWORD3} -k yes" % (smbclient), ['Sharename', 'IPC']) 454 471 455 472 t.info("Checking propogation of user deletion") … … 458 475 child.expect("The command completed successfully") 459 476 460 t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${WIN_REALM} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE']) 461 t.retry_cmd("bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Utest3%${PASSWORD3} -k no", ['LOGON_FAILURE']) 462 t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${WIN_REALM} -Utest2%${PASSWORD2} -k yes", ['LOGON_FAILURE']) 463 t.retry_cmd("bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Utest3%${PASSWORD3} -k yes", ['LOGON_FAILURE']) 477 t.retry_cmd("%s -L ${WIN_HOSTNAME}.${WIN_REALM} -Utest2%%${PASSWORD2} -k no" % (smbclient), ['LOGON_FAILURE']) 478 t.retry_cmd("%s -L ${HOSTNAME}.${WIN_REALM} -Utest3%%${PASSWORD3} -k no" % (smbclient), ['LOGON_FAILURE']) 479 t.retry_cmd("%s -L ${WIN_HOSTNAME}.${WIN_REALM} -Utest2%%${PASSWORD2} -k yes" % (smbclient), ['LOGON_FAILURE']) 480 t.retry_cmd("%s -L ${HOSTNAME}.${WIN_REALM} -Utest3%%${PASSWORD3} -k yes" % (smbclient), ['LOGON_FAILURE']) 481 482 t.run_cmd('bin/samba-tool domain demote -Uadministrator@${WIN_REALM}%${WIN_PASS}') 483 464 484 t.vm_poweroff("${WIN_VM}") 465 485 … … 468 488 '''join a windows domain as a RODC''' 469 489 t.setwinvars(vm) 470 t.info("Joining ${WIN_VM} as a RODC using samba-tool join DC")490 t.info("Joining ${WIN_VM} as a RODC using samba-tool domain join DC") 471 491 t.port_wait("${WIN_IP}", 389) 472 492 t.retry_cmd("host -t SRV _ldap._tcp.${WIN_REALM} ${WIN_IP}", ['has SRV record'] ) 473 493 t.retry_cmd("bin/samba-tool drs showrepl ${WIN_HOSTNAME}.${WIN_REALM} -Uadministrator%${WIN_PASS}", ['INBOUND NEIGHBORS'] ) 474 t.run_cmd('bin/samba-tool join ${WIN_REALM} RODC -Uadministrator%${WIN_PASS} -d${DEBUGLEVEL} --option=interfaces=${INTERFACE}')494 t.run_cmd('bin/samba-tool domain join ${WIN_REALM} RODC -Uadministrator%${WIN_PASS} -d${DEBUGLEVEL} --option=interfaces=${INTERFACE}') 475 495 t.run_cmd('bin/samba-tool drs kcc ${WIN_HOSTNAME}.${WIN_REALM} -Uadministrator@${WIN_REALM}%${WIN_PASS}') 476 496 … … 479 499 '''test a windows domain RODC join''' 480 500 t.info("Checking the RODC join is OK") 481 t.chdir('${PREFIX}') 482 t.retry_cmd('bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Uadministrator@${WIN_REALM}%${WIN_PASS}', ["C$", "IPC$", "Sharename"]) 501 smbclient = t.getvar("smbclient") 502 t.chdir('${PREFIX}') 503 t.retry_cmd('%s -L ${HOSTNAME}.${WIN_REALM} -Uadministrator@${WIN_REALM}%%${WIN_PASS}' % (smbclient), ["C$", "IPC$", "Sharename"]) 483 504 t.cmd_contains("host -t A ${HOSTNAME}.${WIN_REALM}.", ['has address']) 484 505 child = t.open_telnet("${WIN_HOSTNAME}", "${WIN_DOMAIN}\\administrator", "${WIN_PASS}", set_time=True) … … 521 542 child.sendline("net user test3 ${PASSWORD3} /add") 522 543 child.expect("The command completed successfully") 523 t.retry_cmd(" bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Utest3%${PASSWORD3} -k no", ['Sharename', 'IPC'])524 t.retry_cmd(" bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Utest3%${PASSWORD3} -k yes", ['Sharename', 'IPC'])544 t.retry_cmd("%s -L ${HOSTNAME}.${WIN_REALM} -Utest3%%${PASSWORD3} -k no" % (smbclient), ['Sharename', 'IPC']) 545 t.retry_cmd("%s -L ${HOSTNAME}.${WIN_REALM} -Utest3%%${PASSWORD3} -k yes" % (smbclient), ['Sharename', 'IPC']) 525 546 526 547 # should this work? 527 548 t.info("Checking if new users propogate to windows") 528 t.cmd_contains('bin/samba-tool newusertest2 ${PASSWORD2}', ['No RID Set DN'])549 t.cmd_contains('bin/samba-tool user add test2 ${PASSWORD2}', ['No RID Set DN']) 529 550 530 551 t.info("Checking propogation of user deletion") … … 532 553 child.expect("The command completed successfully") 533 554 534 t.retry_cmd(" bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Utest3%${PASSWORD3} -k no", ['LOGON_FAILURE'])535 t.retry_cmd(" bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Utest3%${PASSWORD3} -k yes", ['LOGON_FAILURE'])555 t.retry_cmd("%s -L ${HOSTNAME}.${WIN_REALM} -Utest3%%${PASSWORD3} -k no" % (smbclient), ['LOGON_FAILURE']) 556 t.retry_cmd("%s -L ${HOSTNAME}.${WIN_REALM} -Utest3%%${PASSWORD3} -k yes" % (smbclient), ['LOGON_FAILURE']) 536 557 t.vm_poweroff("${WIN_VM}") 537 558 … … 541 562 542 563 t.setvar("SAMBA_VERSION", "Version 4") 564 t.setvar("smbclient", "bin/smbclient4") 543 565 t.check_prerequesites() 544 566 … … 550 572 if not t.skip("stop_bind"): 551 573 t.stop_bind() 574 552 575 if not t.skip("stop_vms"): 553 576 t.stop_vms() … … 568 591 if not t.skip("smbclient"): 569 592 test_smbclient(t) 593 570 594 if not t.skip("configure_bind2"): 571 595 t.configure_bind(kerberos_support=True, include='${PREFIX}/private/named.conf') 572 596 if not t.skip("start_bind"): 573 597 t.start_bind() 598 574 599 if not t.skip("dns"): 575 600 test_dns(t) … … 658 683 659 684 if t.have_vm('W2K3A') and not t.skip("join_w2k3"): 685 t.start_winvm("W2K3A") 660 686 prep_join_as_dc(t, "W2K3A") 661 687 t.run_dcpromo_as_first_dc("W2K3A", func_level='2003') -
vendor/current/wintest/wintest.py
r740 r988 26 26 self.run_cmd('ifconfig ${INTERFACE} inet6 del ${INTERFACE_IPV6}/64', checkfail=False) 27 27 self.run_cmd('ifconfig ${INTERFACE} inet6 add ${INTERFACE_IPV6}/64 up') 28 29 self.run_cmd('ifconfig ${NAMED_INTERFACE} ${NAMED_INTERFACE_NET} up') 30 if self.getvar('NAMED_INTERFACE_IPV6'): 31 self.run_cmd('ifconfig ${NAMED_INTERFACE} inet6 del ${NAMED_INTERFACE_IPV6}/64', checkfail=False) 32 self.run_cmd('ifconfig ${NAMED_INTERFACE} inet6 add ${NAMED_INTERFACE_IPV6}/64 up') 28 33 29 34 def stop_vms(self): … … 326 331 self.chdir('${PREFIX}') 327 332 328 nameserver = self.get_nameserver() 329 if nameserver == self.getvar('INTERFACE_IP'): 330 raise RuntimeError("old /etc/resolv.conf must not contain %s as a nameserver, this will create loops with the generated dns configuration" % nameserver) 331 self.setvar('DNSSERVER', nameserver) 332 333 if self.getvar('INTERFACE_IPV6'): 334 ipv6_listen = 'listen-on-v6 port 53 { ${INTERFACE_IPV6}; };' 333 if self.getvar('NAMED_INTERFACE_IPV6'): 334 ipv6_listen = 'listen-on-v6 port 53 { ${NAMED_INTERFACE_IPV6}; };' 335 335 else: 336 336 ipv6_listen = '' … … 339 339 if not kerberos_support: 340 340 self.setvar("NAMED_TKEY_OPTION", "") 341 el se:341 elif self.getvar('NAMESERVER_BACKEND') != 'SAMBA_INTERNAL': 342 342 if self.named_supports_gssapi_keytab(): 343 343 self.setvar("NAMED_TKEY_OPTION", … … 351 351 self.putenv('KEYTAB_FILE', '${PREFIX}/private/dns.keytab') 352 352 self.putenv('KRB5_KTNAME', '${PREFIX}/private/dns.keytab') 353 354 if include: 353 else: 354 self.setvar("NAMED_TKEY_OPTION", "") 355 356 if include and self.getvar('NAMESERVER_BACKEND') != 'SAMBA_INTERNAL': 355 357 self.setvar("NAMED_INCLUDE", 'include "%s";' % include) 356 358 else: … … 361 363 self.write_file("etc/named.conf", ''' 362 364 options { 363 listen-on port 53 { ${ INTERFACE_IP}; };365 listen-on port 53 { ${NAMED_INTERFACE_IP}; }; 364 366 ${BIND_LISTEN_IPV6} 365 367 directory "${PREFIX}/var/named"; … … 387 389 388 390 controls { 389 inet ${ INTERFACE_IP} port 953391 inet ${NAMED_INTERFACE_IP} port 953 390 392 allow { any; } keys { "rndc-key"; }; 391 393 }; … … 393 395 ${NAMED_INCLUDE} 394 396 ''') 397 398 if self.getvar('NAMESERVER_BACKEND') == 'SAMBA_INTERNAL': 399 self.write_file('etc/named.conf', 400 ''' 401 zone "%s" IN { 402 type forward; 403 forward only; 404 forwarders { 405 %s; 406 }; 407 }; 408 ''' % (self.getvar('LCREALM'), self.getvar('INTERFACE_IP')), 409 mode='a') 410 395 411 396 412 # add forwarding for the windows domains 397 413 domains = self.get_domains() 414 398 415 for d in domains: 399 416 self.write_file('etc/named.conf', … … 419 436 options { 420 437 default-key "rndc-key"; 421 default-server ${ INTERFACE_IP};438 default-server ${NAMED_INTERFACE_IP}; 422 439 default-port 953; 423 440 }; … … 428 445 '''Stop our private BIND from listening and operating''' 429 446 self.rndc_cmd("stop", checkfail=False) 430 self.port_wait("${ INTERFACE_IP}", 53, wait_for_fail=True)447 self.port_wait("${NAMED_INTERFACE_IP}", 53, wait_for_fail=True) 431 448 432 449 self.run_cmd("rm -rf var/named") … … 438 455 self.chdir('${PREFIX}') 439 456 440 self.set_nameserver(self.getvar(' INTERFACE_IP'))457 self.set_nameserver(self.getvar('NAMED_INTERFACE_IP')) 441 458 442 459 self.run_cmd("mkdir -p var/named/data") … … 445 462 self.bind_child = self.run_child("${BIND9} -u ${BIND_USER} -n 1 -c ${PREFIX}/etc/named.conf -g") 446 463 447 self.port_wait("${ INTERFACE_IP}", 53)464 self.port_wait("${NAMED_INTERFACE_IP}", 53) 448 465 self.rndc_cmd("flush") 449 466 … … 492 509 def port_wait(self, hostname, port, retries=200, delay=3, wait_for_fail=False): 493 510 '''wait for a host to come up on the network''' 494 self.retry_cmd("nc -v -z -w 1 %s %u" % (hostname, port), ['succeeded'], 495 retries=retries, delay=delay, wait_for_fail=wait_for_fail) 511 512 while retries > 0: 513 child = self.pexpect_spawn("nc -v -z -w 1 %s %u" % (hostname, port), crlf=False, timeout=1) 514 child.expect([pexpect.EOF, pexpect.TIMEOUT]) 515 child.close() 516 i = child.exitstatus 517 if wait_for_fail: 518 #wait for timeout or fail 519 if i == None or i > 0: 520 return 521 else: 522 if i == 0: 523 return 524 525 time.sleep(delay) 526 retries -= 1 527 self.info("retrying (retries=%u delay=%u)" % (retries, delay)) 528 529 raise RuntimeError("gave up waiting for %s:%d" % (hostname, port)) 496 530 497 531 def run_net_time(self, child): … … 532 566 self.setvar('WIN_SUBNET_MASK', child.after) 533 567 child.expect('Default Gateway') 534 child.expect('\d+.\d+.\d+.\d+') 535 self.setvar('WIN_DEFAULT_GATEWAY', child.after) 536 child.expect("C:") 568 i = child.expect(['\d+.\d+.\d+.\d+', "C:"]) 569 if i == 0: 570 self.setvar('WIN_DEFAULT_GATEWAY', child.after) 571 child.expect("C:") 537 572 538 573 def get_is_dc(self, child): 539 574 '''check if a windows machine is a domain controller''' 540 575 child.sendline("dcdiag") 541 i = child.expect(["is not a Directory Server",576 i = child.expect(["is not a [Directory Server|DC]", 542 577 "is not recognized as an internal or external command", 543 578 "Home Server = ", … … 564 599 565 600 def set_noexpire(self, child, username): 566 '''Ensure this user's password does not expire'''601 """Ensure this user's password does not expire""" 567 602 child.sendline('wmic useraccount where name="%s" set PasswordExpires=FALSE' % username) 568 603 child.expect("update successful") … … 572 607 '''remove the annoying telnet restrictions''' 573 608 child.sendline('tlntadmn config maxconn=1024') 574 child.expect( "The settings were successfully updated")609 child.expect(["The settings were successfully updated", "Access is denied"]) 575 610 child.expect("C:") 576 611 … … 578 613 '''remove the annoying firewall''' 579 614 child.sendline('netsh advfirewall set allprofiles state off') 580 i = child.expect(["Ok", "The following command was not found: advfirewall set allprofiles state off" ])615 i = child.expect(["Ok", "The following command was not found: advfirewall set allprofiles state off", "The requested operation requires elevation", "Access is denied"]) 581 616 child.expect("C:") 582 617 if i == 1: 583 618 child.sendline('netsh firewall set opmode mode = DISABLE profile = ALL') 584 i = child.expect(["Ok", "The following command was not found" ])619 i = child.expect(["Ok", "The following command was not found", "Access is denied"]) 585 620 if i != 0: 586 621 self.info("Firewall disable failed - ignoring") … … 588 623 589 624 def set_dns(self, child): 590 child.sendline('netsh interface ip set dns "${WIN_NIC}" static ${ INTERFACE_IP} primary')625 child.sendline('netsh interface ip set dns "${WIN_NIC}" static ${NAMED_INTERFACE_IP} primary') 591 626 i = child.expect(['C:', pexpect.EOF, pexpect.TIMEOUT], timeout=5) 592 627 if i > 0: … … 644 679 set_route = False 645 680 set_dns = False 681 set_telnetclients = True 682 start_telnet = True 646 683 if self.getvar('WIN_IP'): 647 684 ip = self.getvar('WIN_IP') … … 667 704 child.sendline(password) 668 705 i = child.expect(["C:", 706 "TelnetClients", 669 707 "Denying new connections due to the limit on number of connections", 670 708 "No more connections are allowed to telnet server", … … 673 711 "Connection refused", 674 712 pexpect.EOF]) 713 if i == 1: 714 if set_telnetclients: 715 self.run_cmd('bin/net rpc group add TelnetClients -S $WIN_IP -U$WIN_USER%$WIN_PASS') 716 self.run_cmd('bin/net rpc group addmem TelnetClients "authenticated users" -S $WIN_IP -U$WIN_USER%$WIN_PASS') 717 child.close() 718 retries -= 1 719 set_telnetclients = False 720 self.info("retrying (retries=%u delay=%u)" % (retries, delay)) 721 continue 722 else: 723 raise RuntimeError("Failed to connect with telnet due to missing TelnetClients membership") 724 725 if i == 6: 726 # This only works if it is installed and enabled, but not started. Not entirely likely, but possible 727 self.run_cmd('bin/net rpc service start TlntSvr -S $WIN_IP -U$WIN_USER%$WIN_PASS') 728 child.close() 729 start_telnet = False 730 retries -= 1 731 self.info("retrying (retries=%u delay=%u)" % (retries, delay)) 732 continue 733 675 734 if i != 0: 676 735 child.close() … … 805 864 child.expect("C:") 806 865 child.sendline("dcpromo /answer:answers.txt") 807 i = child.expect(["You must restart this computer", "failed", "Active Directory Domain Services was not installed", "C:" ], timeout=240)866 i = child.expect(["You must restart this computer", "failed", "Active Directory Domain Services was not installed", "C:", pexpect.TIMEOUT], timeout=240) 808 867 if i == 1 or i == 2: 809 868 raise Exception("dcpromo failed") 869 if i == 4: # timeout 870 child = self.open_telnet("${WIN_HOSTNAME}", "administrator", "${WIN_PASS}") 871 810 872 child.sendline("shutdown -r -t 0") 811 873 self.port_wait("${WIN_IP}", 139, wait_for_fail=True) 812 874 self.port_wait("${WIN_IP}", 139) 813 self.retry_cmd("host -t SRV _ldap._tcp.${WIN_REALM} ${WIN_IP}", ['has SRV record'] ) 875 876 child = self.open_telnet("${WIN_HOSTNAME}", "administrator", "${WIN_PASS}") 877 # Check if we became a DC by now 878 if not self.get_is_dc(child): 879 raise Exception("dcpromo failed (and wasn't a DC even after rebooting)") 880 # Give DNS registration a kick 881 child.sendline("ipconfig /registerdns") 882 883 self.retry_cmd("host -t SRV _ldap._tcp.${WIN_REALM} ${WIN_IP}", ['has SRV record'], retries=60, delay=5 ) 814 884 815 885 … … 825 895 '''join a windows box to a domain''' 826 896 child = self.open_telnet("${WIN_HOSTNAME}", "${WIN_USER}", "${WIN_PASS}", set_time=True, set_ip=True, set_noexpire=True) 827 child.sendline("ipconfig /flushdns") 828 child.expect("C:") 829 child.sendline("netdom join ${WIN_HOSTNAME} /Domain:%s /UserD:%s /PasswordD:%s" % (domain, username, password)) 830 child.expect("The command completed successfully") 897 retries = 5 898 while retries > 0: 899 child.sendline("ipconfig /flushdns") 900 child.expect("C:") 901 child.sendline("netdom join ${WIN_HOSTNAME} /Domain:%s /UserD:%s /PasswordD:%s" % (domain, username, password)) 902 i = child.expect(["The command completed successfully", 903 "The specified domain either does not exist or could not be contacted."], timeout=120) 904 if i == 0: 905 break 906 time.sleep(10) 907 retries -= 1 908 831 909 child.expect("C:") 832 910 child.sendline("shutdown /r -t 0") … … 843 921 self.info('Testing smbclient') 844 922 self.chdir('${PREFIX}') 845 self.cmd_contains("bin/smbclient --version", ["${SAMBA_VERSION}"]) 846 self.retry_cmd('bin/smbclient -L ${WIN_HOSTNAME} -U%s%%%s %s' % (username, password, args), ["IPC"]) 923 smbclient = self.getvar("smbclient") 924 self.cmd_contains("%s --version" % (smbclient), ["${SAMBA_VERSION}"]) 925 self.retry_cmd('%s -L ${WIN_HOSTNAME} -U%s%%%s %s' % (smbclient, username, password, args), ["IPC"], retries=60, delay=5) 926 927 def test_net_use(self, vm, realm, domain, username, password): 928 self.setwinvars(vm) 929 self.info('Testing net use against Samba3 member') 930 child = self.open_telnet("${WIN_HOSTNAME}", "%s\\%s" % (domain, username), password) 931 child.sendline("net use t: \\\\${HOSTNAME}.%s\\test" % realm) 932 child.expect("The command completed successfully") 847 933 848 934 … … 858 944 self.parser.add_option("--sourcetree", type='string', default=None, help='override sourcetree location') 859 945 self.parser.add_option("--nocleanup", action='store_true', default=False, help='disable cleanup code') 946 self.parser.add_option("--use-ntvfs", action='store_true', default=False, help='use NTVFS for the fileserver') 947 self.parser.add_option("--dns-backend", type="choice", 948 choices=["SAMBA_INTERNAL", "BIND9_FLATFILE", "BIND9_DLZ", "NONE"], 949 help="The DNS server backend. SAMBA_INTERNAL is the builtin name server (default), " \ 950 "BIND9_FLATFILE uses bind9 text database to store zone information, " \ 951 "BIND9_DLZ uses samba4 AD to store zone information, " \ 952 "NONE skips the DNS setup entirely (not recommended)", 953 default="SAMBA_INTERNAL") 860 954 861 955 self.opts, self.args = self.parser.parse_args() … … 869 963 870 964 self.load_config(self.opts.conf) 965 966 nameserver = self.get_nameserver() 967 if nameserver == self.getvar('NAMED_INTERFACE_IP'): 968 raise RuntimeError("old /etc/resolv.conf must not contain %s as a nameserver, this will create loops with the generated dns configuration" % nameserver) 969 self.setvar('DNSSERVER', nameserver) 871 970 872 971 self.set_skip(self.opts.skip) … … 891 990 self.chdir('${SOURCETREE}/' + subdir) 892 991 self.run_cmd('make clean') 992 993 if self.opts.use_ntvfs: 994 self.setvar('USE_NTVFS', "--use-ntvfs") 995 else: 996 self.setvar('USE_NTVFS', "") 997 998 self.setvar('NAMESERVER_BACKEND', self.opts.dns_backend) 999 1000 self.setvar('DNS_FORWARDER', "--option=dns forwarder=%s" % nameserver)
Note:
See TracChangeset
for help on using the changeset viewer.