def build_s4(t):
'''build samba4'''
t.info('Building s4')
- t.chdir('${SOURCETREE}/source4')
+ t.chdir('${SOURCETREE}')
t.putenv('CC', 'ccache gcc')
t.run_cmd('make reconfigure || ./configure --enable-auto-reconfigure --enable-developer --prefix=${PREFIX} -C')
t.run_cmd('make -j')
if t.getvar('INTERFACE_IPV6'):
provision.append('--host-ip6=${INTERFACE_IPV6}')
t.run_cmd(provision)
- t.run_cmd('bin/samba-tool newuser testallowed ${PASSWORD1}')
- t.run_cmd('bin/samba-tool newuser testdenied ${PASSWORD1}')
+ t.run_cmd('bin/samba-tool user add testallowed ${PASSWORD1}')
+ t.run_cmd('bin/samba-tool user add testdenied ${PASSWORD1}')
t.run_cmd('bin/samba-tool group addmembers "Allowed RODC Password Replication Group" testallowed')
t.chdir("${PREFIX}")
t.run_cmd('killall -9 -q samba smbd nmbd winbindd', checkfail=False)
t.run_cmd(['sbin/samba',
- '--option', 'panic action=gnome-terminal -e "gdb --pid %PID%"'])
+ '--option', 'panic action=gnome-terminal -e "gdb --pid %d"'])
t.port_wait("${INTERFACE_IP}", 139)
def test_smbclient(t):
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:
+ child.sendline("echo off")
+ child.sendline("echo START DCPROMO log")
+ child.sendline("more c:\windows\debug\dcpromoui.log")
+ child.sendline("echo END DCPROMO log")
+ child.expect("END DCPROMO")
raise Exception("dcpromo failed")
t.wait_reboot()
child.expect("was successful")
t.info("Checking if new users propogate to windows")
- t.retry_cmd('bin/samba-tool newuser test2 ${PASSWORD2}', ["created successfully"])
+ t.retry_cmd('bin/samba-tool user add 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'])
''')
child.expect("copied.")
child.sendline("dcpromo /answer:answers.txt")
- i = child.expect(["You must restart this computer", "failed"], timeout=120)
+ i = child.expect(["You must restart this computer", "failed", "could not be located in this domain"], timeout=120)
if i != 0:
+ child.sendline("echo off")
+ child.sendline("echo START DCPROMO log")
+ child.sendline("more c:\windows\debug\dcpromoui.log")
+ child.sendline("echo END DCPROMO log")
+ child.expect("END DCPROMO")
raise Exception("dcpromo failed")
child.sendline("shutdown -r -t 0")
t.wait_reboot()
regex=True)
t.info("Checking if new users are available on windows")
- t.run_cmd('bin/samba-tool newuser test2 ${PASSWORD2}')
+ t.run_cmd('bin/samba-tool user add test2 ${PASSWORD2}')
t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC'])
t.retry_cmd("bin/samba-tool drs replicate ${WIN_HOSTNAME}.${LCREALM} ${HOSTNAME}.${LCREALM} ${BASEDN}", ["was successful"])
t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC'])
def prep_join_as_dc(t, vm):
'''start VM and shutdown Samba in preperation to join a windows domain as a DC'''
- t.info("Starting VMs for 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 domain join DC")
t.chdir('${PREFIX}')
t.run_cmd('killall -9 -q samba smbd nmbd winbindd', checkfail=False)
t.rndc_cmd('flush')
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.info("Joining ${WIN_VM} as a second DC using samba-tool domain 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 domain 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}')
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("ipconfig /flushdns")
+ child.expect("Successfully flushed")
+
retries = 10
i = 1
while i == 1 and retries > 0:
child.expect("was successful")
t.info("Checking if new users propogate to windows")
- t.retry_cmd('bin/samba-tool newuser test2 ${PASSWORD2}', ["created successfully"])
+ t.retry_cmd('bin/samba-tool user add 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'])
t.retry_cmd("bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Utest3%${PASSWORD3} -k no", ['LOGON_FAILURE'])
t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${WIN_REALM} -Utest2%${PASSWORD2} -k yes", ['LOGON_FAILURE'])
t.retry_cmd("bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Utest3%${PASSWORD3} -k yes", ['LOGON_FAILURE'])
+
+ t.run_cmd('bin/samba-tool domain demote -Uadministrator@${WIN_REALM}%${WIN_PASS}')
+
t.vm_poweroff("${WIN_VM}")
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.info("Joining ${WIN_VM} as a RODC using samba-tool domain 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} RODC -Uadministrator%${WIN_PASS} -d${DEBUGLEVEL} --option=interfaces=${INTERFACE}')
+ t.run_cmd('bin/samba-tool domain 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}')
# should this work?
t.info("Checking if new users propogate to windows")
- t.cmd_contains('bin/samba-tool newuser test2 ${PASSWORD2}', ['No RID Set DN'])
+ t.cmd_contains('bin/samba-tool user add test2 ${PASSWORD2}', ['No RID Set DN'])
t.info("Checking propogation of user deletion")
child.sendline("net user test3 /del")
t.test_remote_smbclient("WINXP", "administrator", "${PASSWORD1}")
t.vm_poweroff("${WIN_VM}")
+ if t.have_vm('W2K3C') and not t.skip("win2k3_member"):
+ t.start_winvm("W2K3C")
+ run_winjoin(t, "W2K3C")
+ test_winjoin(t, "W2K3C")
+ t.test_remote_smbclient("W2K3C", "administrator", "${PASSWORD1}")
+ t.vm_poweroff("${WIN_VM}")
+
if t.have_vm('W2K8R2C') and not t.skip("dcpromo_rodc"):
t.info("Testing w2k8r2 RODC dcpromo")
t.start_winvm("W2K8R2C")
test_join_as_rodc(t, "W2K8R2A")
if t.have_vm('W2K3A') and not t.skip("join_w2k3"):
+ t.start_winvm("W2K3A")
prep_join_as_dc(t, "W2K3A")
t.run_dcpromo_as_first_dc("W2K3A", func_level='2003')
join_as_dc(t, "W2K3A")