Revert "s3: vfs: add user_vfs_evg to connection_struct"
[Samba.git] / testprogs / blackbox / renamedc.sh
blob31b9c9d4a8e8c4d75bdbfa55ae9ebb1a799cb14a
1 #!/bin/sh
3 if [ $# -lt 1 ]; then
4 cat <<EOF
5 Usage: renamedc.sh PREFIX
6 EOF
7 exit 1;
8 fi
10 PREFIX="$1"
11 shift 1
13 samba4bindir="$BINDIR"
14 ldbsearch="ldbsearch"
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
25 testprovision() {
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
29 testrenamedc() {
30 $PYTHON $SRCDIR/source4/scripting/bin/renamedc \
31 --oldname="BAR" \
32 --newname="RAYMONBAR" \
33 -s $PREFIX/renamedc_test/etc/smb.conf
36 confirmrenamedc() {
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'
60 testrenamedc2() {
61 $PYTHON $SRCDIR/source4/scripting/bin/renamedc \
62 --oldname="RAYMONBAR" \
63 --newname="BAR" \
64 -s $PREFIX/renamedc_test/etc/smb.conf
67 dbcheck_fix() {
68 # Unlike most calls to dbcheck --fix, this will not trigger an error, as
69 # we do not flag an error count for this old DN string case.
70 $PYTHON $BINDIR/samba-tool dbcheck --cross-ncs -s $PREFIX/renamedc_test/etc/smb.conf --fix \
71 --quiet --yes fix_all_old_dn_string_component_mismatch \
72 --attrs="fsmoRoleOwner interSiteTopologyGenerator msDS-NC-Replica-Locations"
75 dbcheck() {
76 $PYTHON $BINDIR/samba-tool dbcheck --cross-ncs -s $PREFIX/renamedc_test/etc/smb.conf
80 testit "renameprovision" testprovision || failed=`expr $failed + 1`
81 testit "renamedc" testrenamedc || failed=`expr $failed + 1`
82 testit "confirmrenamedc" confirmrenamedc || failed=`expr $failed + 1`
83 testit "confirmrenamedc_server" confirmrenamedc_server || failed=`expr $failed + 1`
84 testit "confirmrenamedc_sAMAccountName" confirmrenamedc_sAMAccountName || failed=`expr $failed + 1`
85 testit "confirmrenamedc_dNSHostName" confirmrenamedc_dNSHostName || failed=`expr $failed + 1`
86 testit "confirmrenamedc_rootdse_dnsHostName" confirmrenamedc_rootdse_dnsHostName || failed=`expr $failed + 1`
87 testit "confirmrenamedc_rootdse_dsServiceName" confirmrenamedc_rootdse_dsServiceName || failed=`expr $failed + 1`
88 testit "dbcheck_fix" dbcheck_fix || failed=`expr $failed + 1`
89 testit "dbcheck" dbcheck || failed=`expr $failed + 1`
90 testit "renamedc2" testrenamedc2 || failed=`expr $failed + 1`
92 if [ $failed -eq 0 ]; then
93 rm -rf $PREFIX/renamedc_test
96 exit $failed