gp: Test with binary content for certificate data
[Samba.git] / testprogs / blackbox / dbcheck-oldrelease.sh
blobb3450f75f20b99ceaff6b0e4869761de6d076703
1 #!/bin/sh
3 if [ $# -lt 1 ]; then
4 cat <<EOF
5 Usage: dbcheck.sh PREFIX RELEASE
6 EOF
7 exit 1
8 fi
10 PREFIX_ABS="$1"
11 RELEASE="$2"
12 shift 2
14 failed=0
16 . $(dirname $0)/subunit.sh
17 . $(dirname $0)/common_test_fns.inc
19 release_dir=$(dirname $0)/../../source4/selftest/provisions/$RELEASE
21 ldbadd=$(system_or_builddir_binary ldbadd "${BINDIR}")
22 ldbmodify=$(system_or_builddir_binary ldbmodify "${BINDIR}")
23 ldbdel=$(system_or_builddir_binary ldbdel "${BINDIR}")
24 ldbsearch=$(system_or_builddir_binary ldbsearch "${BINDIR}")
25 ldbrename=$(system_or_builddir_binary ldbrename "${BINDIR}")
26 samba_tdbrestore=$(system_or_builddir_binary tdbrestore "${BINDIR}")
28 samba_undump="$SRCDIR_ABS/source4/selftest/provisions/undump.sh"
29 if [ ! -x $samba_undump ] || [ ! -d $release_dir ]; then
30 subunit_start_test $RELEASE
31 subunit_skip_test $RELEASE <<EOF
32 no test provision
33 EOF
35 subunit_start_test "reindex"
36 subunit_skip_test "reindex" <<EOF
37 no test provision
38 EOF
39 subunit_start_test check_expected_before_values
40 subunit_skip_test check_expected_before_values <<EOF
41 no test provision
42 EOF
43 subunit_start_test "dbcheck"
44 subunit_skip_test "dbcheck" <<EOF
45 no test provision
46 EOF
47 subunit_start_test "dbcheck_clean"
48 subunit_skip_test "dbcheck_clean" <<EOF
49 no test provision
50 EOF
51 subunit_start_test check_expected_after_values
52 subunit_skip_test check_expected_after_values <<EOF
53 no test provision
54 EOF
55 subunit_start_test "dbcheck_acl_reset"
56 subunit_skip_test "dbcheck_acl_reset" <<EOF
57 no test provision
58 EOF
59 subunit_start_test "dbcheck_clean_acl_reset"
60 subunit_skip_test "dbcheck_clean_acl_reset" <<EOF
61 no test provision
62 EOF
63 subunit_start_test add_userparameters0
64 subunit_skip_test add_userparameters0 <<EOF
65 no test provision
66 EOF
68 subunit_start_test add_userparameters1
69 subunit_skip_test add_userparameters1 <<EOF
70 no test provision
71 EOF
73 subunit_start_test add_userparameters2
74 subunit_skip_test add_userparameters2 <<EOF
75 no test provision
76 EOF
78 subunit_start_test add_userparameters3
79 subunit_skip_test add_userparameters3 <<EOF
80 no test provision
81 EOF
83 subunit_start_test check_expected_before_values
84 subunit_skip_test check_expected_before_values <<EOF
85 no test provision
86 EOF
88 subunit_start_test "dbcheck2"
89 subunit_skip_test "dbcheck2" <<EOF
90 no test provision
91 EOF
93 subunit_start_test "referenceprovision"
94 subunit_skip_test "referenceprovision" <<EOF
95 no test provision
96 EOF
97 subunit_start_test "ldapcmp"
98 subunit_skip_test "ldapcmp" <<EOF
99 no test provision
101 subunit_start_test "ldapcmp_sd"
102 subunit_skip_test "ldapcmp_sd" <<EOF
103 no test provision
106 exit 0
109 undump()
111 $samba_undump $release_dir $PREFIX_ABS/$RELEASE $samba_tdbrestore
114 add_userparameters0()
116 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
117 $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb <<EOF
118 dn: cn=localdc,cn=domain controllers,dc=release-4-1-0rc3,dc=samba,dc=corp
119 changetype: modify
120 replace: userParameters
121 userParameters:: IAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAC
122 AAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAUAAQABoACAAB
123 AEMAdAB4AEMAZgBnAFAAcgBlAHMAZQBuAHQANTUxZTBiYjAYAAgAAQBDAHQAeABDAGYAZw
124 BGAGwAYQBnAHMAMQAwMGUwMDAxMBYACAABAEMAdAB4AEMAYQBsAGwAYgBhAGMAawAwMDAw
125 MDAwMBIACAABAEMAdAB4AFMAaABhAGQAbwB3ADAxMDAwMDAwKAAIAAEAQwB0AHgATQBhAH
126 gAQwBvAG4AbgBlAGMAdABpAG8AbgBUAGkAbQBlADAwMDAwMDAwLgAIAAEAQwB0AHgATQBh
127 AHgARABpAHMAYwBvAG4AbgBlAGMAdABpAG8AbgBUAGkAbQBlADAwMDAwMDAwHAAIAAEAQw
128 B0AHgATQBhAHgASQBkAGwAZQBUAGkAbQBlADAwMDAwMDAwIgAIAAEAQwB0AHgASwBlAHkA
129 YgBvAGEAcgBkAEwAYQB5AG8AdQB0ADAwMDAwMDAwKgACAAEAQwB0AHgATQBpAG4ARQBuAG
130 MAcgB5AHAAdABpAG8AbgBMAGUAdgBlAGwAMDAgAAIAAQBDAHQAeABXAG8AcgBrAEQAaQBy
131 AGUAYwB0AG8AcgB5ADAwIAACAAEAQwB0AHgATgBXAEwAbwBnAG8AbgBTAGUAcgB2AGUAcg
132 AwMBgAJAABAEMAdAB4AFcARgBIAG8AbQBlAEQAaQByADVjNWM3MzYxNzQ3NTcyNmU2NTVj
133 NzAyZTYyNjk2NDZmNmUwMCIABgABAEMAdAB4AFcARgBIAG8AbQBlAEQAaQByAEQAcgBpAH
134 YAZQA1MDNhMDAgADoAAQBDAHQAeABXAEYAUAByAG8AZgBpAGwAZQBQAGEAdABoADVjNWM3
135 MzYxNzQ3NTcyNmU2NTVjNzA3MjZmNjY2OTZjNjU3NDczNjU1YzcwMmU2MjY5NjQ2ZjZlMD
136 AiAAIAAQBDAHQAeABJAG4AaQB0AGkAYQBsAFAAcgBvAGcAcgBhAG0AMDAiAAIAAQBDAHQA
137 eABDAGEAbABsAGIAYQBjAGsATgB1AG0AYgBlAHIAMDA=
142 add_userparameters1()
144 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
145 $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb <<EOF
146 dn: cn=administrator,cn=users,dc=release-4-1-0rc3,dc=samba,dc=corp
147 changetype: modify
148 replace: userParameters
149 userParameters: IAAgACAAIAAgACAAIAAgACAAIAAgACAA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AHQAeABJAG4AaQB0AGkAYQBsAFAAcgBvAGcAcgBhAG0AMDAiAAIAAQBDAHQA
165 eABDAGEAbABsAGIAYQBjAGsATgB1AG0AYgBlAHIAMDA=
170 add_userparameters2()
172 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
173 $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb <<EOF
174 dn: cn=krbtgt,cn=users,dc=release-4-1-0rc3,dc=samba,dc=corp
175 changetype: modify
176 replace: userParameters
177 userParameters:: Q3R4Q2ZnUHJlc2VudCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI
178 CAgUAsaCAFDdHhDZmdQcmVzZW5045S15pSx5oiw44GiIAIBQ3R4V0ZQcm9maWxlUGF0aOOAsBgCAU
179 N0eFdGSG9tZURpcuOAsCICAUN0eFdGSG9tZURpckRyaXZl44CwEggBQ3R4U2hhZG9344Sw44Cw44C
180 w44CwLggBQ3R4TWF4RGlzY29ubmVjdGlvblRpbWXjgaXjjLnjkLDjgLAoCAFDdHhNYXhDb25uZWN0
181 aW9uVGltZeOAtOOct+aIseOAsBwIAUN0eE1heElkbGVUaW1l44Gj45yy46Sw44CwIAIBQ3R4V29ya
182 0RpcmVjdG9yeeOAsBgIAUN0eENmZ0ZsYWdzMeOAsOOBpuOYsuOAuCICAUN0eEluaXRpYWxQcm9ncm
183 Ft44Cw
189 add_userparameters3()
191 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
192 $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb <<EOF
193 dn: cn=guest,cn=users,dc=release-4-1-0rc3,dc=samba,dc=corp
194 changetype: modify
195 replace: userParameters
196 userParameters:: QwAAAHQAAAB4AAAAQwAAAGYAAABnAAAAUAAAAHIAAABlAAAAcwAAAGUAAABuA
197 AAAdAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAA
198 AgAAAAIAAAACAAAAAgAAAA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AHgAAABXAAAA
212 bwAAAHIAAABrAAAARAAAAGkAAAByAAAAZQAAAGMAAAB0AAAAbwAAAHIAAAB5AAAAMAAwABgAAAAIA
213 AAAAQAAAEMAAAB0AAAAeAAAAEMAAABmAAAAZwAAAEYAAABsAAAAYQAAAGcAAABzAAAAMQAAADAAMA
214 BmADAAMgA2ADgAMAAiAAAAAgAAAAEAAABDAAAAdAAAAHgAAABJAAAAbgAAAGkAAAB0AAAAaQAAAGE
215 AAABsAAAAUAAAAHIAAABvAAAAZwAAAHIAAABhAAAAbQAAADAAMAA=
221 check_expected_userparameters()
223 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
224 tmpldif=$PREFIX_ABS/$RELEASE/expected-userParameters-after-dbcheck.ldif.tmp
225 TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb userParameters=* --scope=sub -b DC=release-4-1-0rc3,DC=samba,DC=corp userParameters --sorted | grep -v \# >$tmpldif
226 diff -u $tmpldif $release_dir/expected-userParameters-after-dbcheck.ldif
227 if [ "$?" != "0" ]; then
228 return 1
231 return 0
234 reindex()
236 $PYTHON $BINDIR/samba-tool dbcheck --reindex -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb "$@"
239 do_current_version_mod()
241 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
242 # Confirm (in combination with the ldbsearch below) that
243 # changing the attribute with current Samba fixes it, and that
244 # a fixed attriute isn't unfixed by dbcheck.
245 tmpldif=$release_dir/sudoers2-mod.ldif
246 $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $tmpldif
248 return 0
251 check_expected_before_values()
253 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
254 tmpldif=$PREFIX_ABS/$RELEASE/expected-replpropertymetadata-before-dbcheck.ldif.tmp
255 TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb cn=ops_run_anything --scope=one -b OU=SUDOers,DC=release-4-1-0rc3,DC=samba,DC=corp \* replpropertymetadata --sorted --show-binary >$tmpldif
256 diff -u $tmpldif $release_dir/expected-replpropertymetadata-before-dbcheck.ldif
257 if [ "$?" != "0" ]; then
258 return 1
261 TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb cn=ops_run_anything2 --scope=one -b OU=SUDOers,DC=release-4-1-0rc3,DC=samba,DC=corp \* replpropertymetadata --sorted --show-binary | grep -v originating_change_time | grep -v whenChanged >$tmpldif
263 # Here we remove originating_change_time and whenChanged as
264 # these are time-dependent, caused by the ldbmodify above.
266 diff -u $tmpldif $release_dir/expected-replpropertymetadata-before-dbcheck2.ldif
267 if [ "$?" != "0" ]; then
268 return 1
271 TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb cn=ops_run_anything3 --scope=one -b OU=SUDOers,DC=release-4-1-0rc3,DC=samba,DC=corp \* replpropertymetadata --sorted --show-binary >$tmpldif
272 diff -u $tmpldif $release_dir/expected-replpropertymetadata-before-dbcheck3.ldif
273 if [ "$?" != "0" ]; then
274 return 1
276 elif [ x$RELEASE = x"release-4-5-0-pre1" ]; then
277 tmpldif=$PREFIX_ABS/$RELEASE/rootdse-version.initial.txt.tmp
278 TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb --scope=base -b '' | grep highestCommittedUSN >$tmpldif
279 diff -u $tmpldif $release_dir/rootdse-version.initial.txt
280 if [ "$?" != "0" ]; then
281 return 1
284 return 0
287 # This should 'fail', because it returns the number of modified records
288 dbcheck_objectclass()
290 if [ x$RELEASE = x"release-4-1-6-partial-object" ]; then
291 $PYTHON $BINDIR/samba-tool dbcheck --selftest-check-expired-tombstones --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb --attrs=objectclass "$@"
292 else
293 return 1
297 # This should 'fail', because it returns the number of wrong records, which it must if we did not skip the deleted objects
298 dbcheck_deleted_objects()
300 if [ x$RELEASE = x"alpha13" ]; then
301 basedn=$($ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb --scope base -b "" defaultNamingContext | grep -i defaultNamingContext | cut -d\ -f 2)
303 $PYTHON $BINDIR/samba-tool dbcheck -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb "cn=deleted objects,$basedn" --scope base "$@"
304 else
305 return 1
309 # This should 'fail', because it returns the number of modified records
310 dbcheck()
312 $PYTHON $BINDIR/samba-tool dbcheck --selftest-check-expired-tombstones --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb "$@"
315 check_expected_after_values()
317 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
318 tmpldif=$PREFIX_ABS/$RELEASE/expected-replpropertymetadata-after-dbcheck.ldif.tmp
319 TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb cn=ops_run_anything --scope=one -b OU=SUDOers,DC=release-4-1-0rc3,DC=samba,DC=corp \* replpropertymetadata --sorted --show-binary >$tmpldif
320 diff -u $tmpldif $release_dir/expected-replpropertymetadata-after-dbcheck.ldif
321 if [ "$?" != "0" ]; then
322 return 1
324 TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb cn=ops_run_anything2 --scope=one -b OU=SUDOers,DC=release-4-1-0rc3,DC=samba,DC=corp \* replpropertymetadata --sorted --show-binary | grep -v originating_change_time | grep -v whenChanged >$tmpldif
325 diff -u $tmpldif $release_dir/expected-replpropertymetadata-after-dbcheck2.ldif
326 if [ "$?" != "0" ]; then
327 return 1
329 TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb cn=ops_run_anything3 --scope=one -b OU=SUDOers,DC=release-4-1-0rc3,DC=samba,DC=corp \* replpropertymetadata --sorted --show-binary >$tmpldif
330 diff -u $tmpldif $release_dir/expected-replpropertymetadata-after-dbcheck3.ldif
331 if [ "$?" != "0" ]; then
332 return 1
334 # Check DomainDNS partition for replica locations
335 tmpldif=$PREFIX_ABS/$RELEASE/expected-replica-locations-after-dbcheck.ldif.tmp
336 $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb cn=49a69498-9a85-48af-9be4-aa0b3e0054f9 --scope=one -b CN=Partitions,CN=Configuration,DC=release-4-1-0rc3,DC=samba,DC=corp msDS-NC-Replica-Locations >$tmpldif
337 diff -u $tmpldif $release_dir/expected-replica-locations-after-dbcheck.ldif
338 if [ "$?" != "0" ]; then
339 return 1
341 # Check ForestDNS partition for replica locations
342 $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb cn=7d2a15af-c0d4-487c-847e-e036292bcc65 --scope=one -b CN=Partitions,CN=Configuration,DC=release-4-1-0rc3,DC=samba,DC=corp msDS-NC-Replica-Locations >$tmpldif
343 diff -u $tmpldif $release_dir/expected-replica-locations-after-dbcheck2.ldif
344 if [ "$?" != "0" ]; then
345 return 1
347 elif [ x$RELEASE = x"release-4-5-0-pre1" ]; then
348 echo $RELEASE checking after values
349 tmpldif=$PREFIX_ABS/$RELEASE/expected-links-after-dbcheck.ldif.tmp
350 $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb --show-recycled --show-deleted --show-deactivated-link --reveal member memberOf lastKnownParent objectCategory lastKnownParent wellKnownObjects legacyExchangeDN sAMAccountType uSNChanged --sorted >$tmpldif
351 diff -u $tmpldif $release_dir/expected-links-after-dbcheck.ldif
352 if [ "$?" != "0" ]; then
353 return 1
356 # If in the future dbcheck has to make a change recorded in replPropertyMetadata,
357 # this test will fail and can be removed.
358 tmpversion=$PREFIX_ABS/$RELEASE/rootdse-version.final.txt.tmp
359 TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb --scope=base -b '' | grep highestCommittedUSN >$tmpversion
360 diff -u $tmpversion $release_dir/rootdse-version.final.txt
361 if [ "$?" != "0" ]; then
362 return 1
365 return 0
368 check_forced_duplicate_values()
370 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
371 ldif=$release_dir/forced-duplicate-value-for-dbcheck.ldif
372 TZ=UTC $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb.d/DC%3DRELEASE-4-1-0RC3,DC%3DSAMBA,DC%3DCORP.ldb $ldif
373 if [ "$?" != "0" ]; then
374 return 1
376 else
377 return 0
381 # This should 'fail', because it returns the number of modified records
382 dbcheck_after_dup()
384 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
385 $PYTHON $BINDIR/samba-tool dbcheck --selftest-check-expired-tombstones --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb cn=administrator,cn=users,DC=release-4-1-0rc3,DC=samba,DC=corp "$@"
386 else
387 return 1
391 check_expected_after_dup_values()
393 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
394 tmpldif=$PREFIX_ABS/$RELEASE/expected-otherphone-after-dbcheck.ldif.tmp
395 TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb cn=administrator --scope=base -b cn=administrator,cn=users,DC=release-4-1-0rc3,DC=samba,DC=corp otherHomePhone --sorted --show-binary | grep -v \# | sort >$tmpldif
396 diff -u $tmpldif $release_dir/expected-otherphone-after-dbcheck.ldif
397 if [ "$?" != "0" ]; then
398 return 1
401 return 0
404 # But having fixed it all up, this should pass
405 dbcheck_clean()
407 $PYTHON $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb "$@"
410 # This should 'fail', because it returns the number of modified records.
411 # We need to run this against all versions without adprep 2016 (before Samba 4.19)
412 dbcheck_acl_reset()
414 $PYTHON $BINDIR/samba-tool dbcheck --reset-well-known-acls --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb "$@"
416 # But having fixed it all up, this should pass.
417 # We don't need to run this against 4.1.0rc3
418 dbcheck_acl_reset_clean()
420 if [ x$RELEASE != x"release-4-1-0rc3" ]; then
421 $PYTHON $BINDIR/samba-tool dbcheck --reset-well-known-acls --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb "$@"
425 # This should 'fail', because it returns the number of modified records
426 dbcheck2()
428 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
429 $PYTHON $BINDIR/samba-tool dbcheck --selftest-check-expired-tombstones --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb "$@"
430 else
431 exit 1
434 # But having fixed it all up, this should pass
435 dbcheck_clean2()
437 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
438 $PYTHON $BINDIR/samba-tool dbcheck --selftest-check-expired-tombstones --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb "$@"
442 rm_deleted_objects()
444 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
445 TZ=UTC $ldbdel -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb.d/DC%3DRELEASE-4-1-0RC3,DC%3DSAMBA,DC%3DCORP.ldb 'CN=Deleted Objects,DC=RELEASE-4-1-0RC3,DC=SAMBA,DC=CORP'
446 if [ "$?" != "0" ]; then
447 return 1
449 else
450 return 0
453 # This should 'fail', because it returns the number of modified records
454 dbcheck3()
456 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
457 $PYTHON $BINDIR/samba-tool dbcheck --selftest-check-expired-tombstones --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb "$@"
458 else
459 exit 1
462 # But having fixed it all up, this should pass
463 dbcheck_clean3()
465 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
466 $PYTHON $BINDIR/samba-tool dbcheck --selftest-check-expired-tombstones --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb "$@"
470 check_expected_after_deleted_objects()
472 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
473 tmpldif=$PREFIX_ABS/$RELEASE/expected-deleted_objects-after-dbcheck.ldif.tmp
474 TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb cn=deleted\ objects --scope=base -b cn=deleted\ objects,DC=release-4-1-0rc3,DC=samba,DC=corp objectClass description isDeleted isCriticalSystemObject objectGUID showInAdvancedViewOnly systemFlags --sorted --show-binary --show-deleted | grep -v \# | sort >$tmpldif
475 diff -u $tmpldif $release_dir/expected-deleted_objects-after-dbcheck.ldif
476 if [ "$?" != "0" ]; then
477 return 1
480 return 0
483 referenceprovision()
485 if [ x$RELEASE = x"release-4-0-0" ]; then
486 $PYTHON $BINDIR/samba-tool domain provision --server-role="dc" --domain=SAMBA --host-name=ares --realm=${RELEASE}.samba.corp --targetdir=$PREFIX_ABS/${RELEASE}_reference --use-ntvfs --host-ip=127.0.0.1 --host-ip6=::1 --function-level=2003 --base-schema=2008_R2_old
488 # on top of this, also apply 2008R2 changes we accidentally missed in the past
489 $PYTHON $BINDIR/samba-tool domain schemaupgrade -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb --ldf-file=samba-4.7-missing-for-schema45.ldif,fix-forest-rev.ldf
493 ldapcmp()
495 if [ x$RELEASE = x"release-4-0-0" ]; then
496 $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/${RELEASE}_reference/private/sam.ldb tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb --two --skip-missing-dn --filter=dnsRecord,displayName,msDS-SupportedEncryptionTypes,servicePrincipalName
500 ldapcmp_sd()
502 if [ x$RELEASE = x"release-4-0-0" ]; then
503 $PYTHON $BINDIR/samba-tool ldapcmp tdb://$PREFIX_ABS/${RELEASE}_reference/private/sam.ldb tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb --two --sd --skip-missing-dn --filter=servicePrincipalName
507 remove_directory $PREFIX_ABS/${RELEASE}_reference
509 testit $RELEASE undump || failed=$(expr $failed + 1)
510 testit "reindex" reindex || failed=$(expr $failed + 1)
511 testit "current_version_mod" do_current_version_mod || failed=$(expr $failed + 1)
512 testit "check_expected_before_values" check_expected_before_values || failed=$(expr $failed + 1)
513 testit_expect_failure "dbcheck_deleted_objects" dbcheck_deleted_objects || failed=$(expr $failed + 1)
514 testit_expect_failure "dbcheck_objectclass" dbcheck_objectclass || failed=$(expr $failed + 1)
515 testit_expect_failure "dbcheck" dbcheck || failed=$(expr $failed + 1)
516 testit "check_expected_after_values" check_expected_after_values || failed=$(expr $failed + 1)
517 testit "check_forced_duplicate_values" check_forced_duplicate_values || failed=$(expr $failed + 1)
518 testit_expect_failure "dbcheck_after_dup" dbcheck_after_dup || failed=$(expr $failed + 1)
519 testit "check_expected_after_dup_values" check_expected_after_dup_values || failed=$(expr $failed + 1)
520 testit "dbcheck_clean" dbcheck_clean || failed=$(expr $failed + 1)
521 testit_expect_failure "dbcheck_acl_reset" dbcheck_acl_reset || failed=$(expr $failed + 1)
522 testit "dbcheck_acl_reset_clean" dbcheck_acl_reset_clean || failed=$(expr $failed + 1)
523 testit "add_userparameters0" add_userparameters1 || failed=$(expr $failed + 1)
524 testit "add_userparameters1" add_userparameters1 || failed=$(expr $failed + 1)
525 testit "add_userparameters2" add_userparameters2 || failed=$(expr $failed + 1)
526 testit "add_userparameters3" add_userparameters3 || failed=$(expr $failed + 1)
527 testit_expect_failure "dbcheck2" dbcheck2 || failed=$(expr $failed + 1)
528 testit "dbcheck_clean2" dbcheck_clean2 || failed=$(expr $failed + 1)
529 testit "check_expected_userparameters" check_expected_userparameters || failed=$(expr $failed + 1)
530 testit "rm_deleted_objects" rm_deleted_objects || failed=$(expr $failed + 1)
531 # We must re-index again because rm_deleted_objects went behind
532 # the back of the main sam.ldb.
533 testit "reindex2" reindex || failed=$(expr $failed + 1)
534 testit_expect_failure "dbcheck3" dbcheck3 || failed=$(expr $failed + 1)
535 testit "dbcheck_clean3" dbcheck_clean3 || failed=$(expr $failed + 1)
536 testit "check_expected_after_deleted_objects" check_expected_after_deleted_objects || failed=$(expr $failed + 1)
537 testit "referenceprovision" referenceprovision || failed=$(expr $failed + 1)
538 testit "ldapcmp" ldapcmp || failed=$(expr $failed + 1)
539 testit "ldapcmp_sd" ldapcmp_sd || failed=$(expr $failed + 1)
541 if [ -d $PREFIX_ABS/${RELEASE} ]; then
542 rm -fr $PREFIX_ABS/${RELEASE}
545 remove_directory $PREFIX_ABS/${RELEASE}_reference
547 exit $failed