5 Usage: renamedc.sh PREFIX
13 samba4bindir
="$BINDIR"
15 if [ -x "$samba4bindir/ldbsearch" ]; then
16 ldbsearch
="$samba4bindir/ldbsearch"
19 .
`dirname $0`/subunit.sh
21 if [ ! -d $PREFIX/renamedc_test
]; then
22 mkdir
-p $PREFIX/renamedc_test
26 $PYTHON $BINDIR/samba-tool domain provision
--host-name=bar
--domain=FOO
--realm=foo.example.com
--targetdir="$PREFIX/renamedc_test" --server-role="dc" --use-ntvfs
30 $PYTHON $SRCDIR/source4/scripting
/bin
/renamedc \
32 --newname="RAYMONBAR" \
33 -s $PREFIX/renamedc_test
/etc
/smb.conf
37 $ldbsearch -H $PREFIX/renamedc_test
/private
/sam.ldb
-s base
-b 'cn=RAYMONBAR,ou=domain controllers,dc=foo,dc=example,dc=com'
40 confirmrenamedc_server
() {
41 $ldbsearch -H $PREFIX/renamedc_test
/private
/sam.ldb
-s base
-b 'cn=RAYMONBAR,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=configuration,dc=foo,dc=example,dc=com'
44 confirmrenamedc_sAMAccountName
() {
45 $ldbsearch -H $PREFIX/renamedc_test
/private
/sam.ldb
-s base
-b 'cn=RAYMONBAR,ou=domain controllers,dc=foo,dc=example,dc=com' sAMAccountName |
grep 'sAMAccountName: RAYMONBAR\$'
48 confirmrenamedc_dNSHostName
() {
49 $ldbsearch -H $PREFIX/renamedc_test
/private
/sam.ldb
-s base
-b 'cn=RAYMONBAR,ou=domain controllers,dc=foo,dc=example,dc=com' dNSHostName |
grep 'dNSHostName: RAYMONBAR.foo.example.com'
52 confirmrenamedc_rootdse_dnsHostName
() {
53 $ldbsearch -H $PREFIX/renamedc_test
/private
/sam.ldb
-s base
-b '' dNSHostName |
grep 'dnsHostName: RAYMONBAR.foo.example.com'
56 confirmrenamedc_rootdse_dsServiceName
() {
57 $ldbsearch -H $PREFIX/renamedc_test
/private
/sam.ldb
--show-binary -s base
-b '' dsServiceName |
grep 'dsServiceName: CN=NTDS Settings,CN=RAYMONBAR,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=foo,DC=example,DC=com'
61 $PYTHON $SRCDIR/source4/scripting
/bin
/renamedc \
62 --oldname="RAYMONBAR" \
64 -s $PREFIX/renamedc_test
/etc
/smb.conf
68 $BINDIR/samba-tool dbcheck
--cross-ncs -s $PREFIX/renamedc_test
/etc
/smb.conf
72 testit
"renameprovision" testprovision || failed
=`expr $failed + 1`
73 testit
"renamedc" testrenamedc || failed
=`expr $failed + 1`
74 testit
"confirmrenamedc" confirmrenamedc || failed
=`expr $failed + 1`
75 testit
"confirmrenamedc_server" confirmrenamedc_server || failed
=`expr $failed + 1`
76 testit
"confirmrenamedc_sAMAccountName" confirmrenamedc_sAMAccountName || failed
=`expr $failed + 1`
77 testit
"confirmrenamedc_dNSHostName" confirmrenamedc_dNSHostName || failed
=`expr $failed + 1`
78 testit
"confirmrenamedc_rootdse_dnsHostName" confirmrenamedc_rootdse_dnsHostName || failed
=`expr $failed + 1`
79 testit
"confirmrenamedc_rootdse_dsServiceName" confirmrenamedc_rootdse_dsServiceName || failed
=`expr $failed + 1`
80 testit
"dbcheck" dbcheck || failed
=`expr $failed + 1`
81 testit
"renamedc2" testrenamedc2 || failed
=`expr $failed + 1`
83 if [ $failed -eq 0 ]; then
84 rm -rf $PREFIX/renamedc_test