torture: smbtorture test case to verify Compound related handling
[Samba.git] / testprogs / blackbox / dbcheck-oldrelease.sh
blob64c08c579812d441dc5862b89f2ac87c981f16de
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 ldbmodify="ldbmodify"
22 if [ -x "$BINDIR/ldbmodify" ]; then
23 ldbmodify="$BINDIR/ldbmodify"
26 ldbdel="ldbdel"
27 if [ -x "$BINDIR/ldbdel" ]; then
28 ldbdel="$BINDIR/ldbdel"
31 ldbsearch="ldbsearch"
32 if [ -x "$BINDIR/ldbsearch" ]; then
33 ldbsearch="$BINDIR/ldbsearch"
36 samba_tdbrestore="tdbrestore"
37 if [ -x "$BINDIR/tdbrestore" ]; then
38 samba_tdbrestore="$BINDIR/tdbrestore"
41 samba_undump="$SRCDIR_ABS/source4/selftest/provisions/undump.sh"
42 if [ ! -x $samba_undump ] || [ ! -d $release_dir ]; then
43 subunit_start_test $RELEASE
44 subunit_skip_test $RELEASE <<EOF
45 no test provision
46 EOF
48 subunit_start_test "reindex"
49 subunit_skip_test "reindex" <<EOF
50 no test provision
51 EOF
52 subunit_start_test check_expected_before_values
53 subunit_skip_test check_expected_before_values<<EOF
54 no test provision
55 EOF
56 subunit_start_test "dbcheck"
57 subunit_skip_test "dbcheck" <<EOF
58 no test provision
59 EOF
60 subunit_start_test "dbcheck_clean"
61 subunit_skip_test "dbcheck_clean" <<EOF
62 no test provision
63 EOF
64 subunit_start_test check_expected_after_values
65 subunit_skip_test check_expected_after_values<<EOF
66 no test provision
67 EOF
68 subunit_start_test "dbcheck_acl_reset"
69 subunit_skip_test "dbcheck_acl_reset" <<EOF
70 no test provision
71 EOF
72 subunit_start_test "dbcheck_clean_acl_reset"
73 subunit_skip_test "dbcheck_clean_acl_reset" <<EOF
74 no test provision
75 EOF
76 subunit_start_test add_userparameters0
77 subunit_skip_test add_userparameters0<<EOF
78 no test provision
79 EOF
81 subunit_start_test add_userparameters1
82 subunit_skip_test add_userparameters1<<EOF
83 no test provision
84 EOF
86 subunit_start_test add_userparameters2
87 subunit_skip_test add_userparameters2<<EOF
88 no test provision
89 EOF
91 subunit_start_test add_userparameters3
92 subunit_skip_test add_userparameters3<<EOF
93 no test provision
94 EOF
96 subunit_start_test check_expected_before_values
97 subunit_skip_test check_expected_before_values<<EOF
98 no test provision
99 EOF
101 subunit_start_test "dbcheck2"
102 subunit_skip_test "dbcheck2" <<EOF
103 no test provision
106 subunit_start_test "referenceprovision"
107 subunit_skip_test "referenceprovision" <<EOF
108 no test provision
110 subunit_start_test "ldapcmp"
111 subunit_skip_test "ldapcmp" <<EOF
112 no test provision
114 subunit_start_test "ldapcmp_sd"
115 subunit_skip_test "ldapcmp_sd" <<EOF
116 no test provision
119 exit 0
122 undump() {
123 $samba_undump $release_dir $PREFIX_ABS/$RELEASE $samba_tdbrestore
126 add_userparameters0() {
127 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
128 $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb <<EOF
129 dn: cn=localdc,cn=domain controllers,dc=release-4-1-0rc3,dc=samba,dc=corp
130 changetype: modify
131 replace: userParameters
132 userParameters:: IAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAC
133 AAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAUAAQABoACAAB
134 AEMAdAB4AEMAZgBnAFAAcgBlAHMAZQBuAHQANTUxZTBiYjAYAAgAAQBDAHQAeABDAGYAZw
135 BGAGwAYQBnAHMAMQAwMGUwMDAxMBYACAABAEMAdAB4AEMAYQBsAGwAYgBhAGMAawAwMDAw
136 MDAwMBIACAABAEMAdAB4AFMAaABhAGQAbwB3ADAxMDAwMDAwKAAIAAEAQwB0AHgATQBhAH
137 gAQwBvAG4AbgBlAGMAdABpAG8AbgBUAGkAbQBlADAwMDAwMDAwLgAIAAEAQwB0AHgATQBh
138 AHgARABpAHMAYwBvAG4AbgBlAGMAdABpAG8AbgBUAGkAbQBlADAwMDAwMDAwHAAIAAEAQw
139 B0AHgATQBhAHgASQBkAGwAZQBUAGkAbQBlADAwMDAwMDAwIgAIAAEAQwB0AHgASwBlAHkA
140 YgBvAGEAcgBkAEwAYQB5AG8AdQB0ADAwMDAwMDAwKgACAAEAQwB0AHgATQBpAG4ARQBuAG
141 MAcgB5AHAAdABpAG8AbgBMAGUAdgBlAGwAMDAgAAIAAQBDAHQAeABXAG8AcgBrAEQAaQBy
142 AGUAYwB0AG8AcgB5ADAwIAACAAEAQwB0AHgATgBXAEwAbwBnAG8AbgBTAGUAcgB2AGUAcg
143 AwMBgAJAABAEMAdAB4AFcARgBIAG8AbQBlAEQAaQByADVjNWM3MzYxNzQ3NTcyNmU2NTVj
144 NzAyZTYyNjk2NDZmNmUwMCIABgABAEMAdAB4AFcARgBIAG8AbQBlAEQAaQByAEQAcgBpAH
145 YAZQA1MDNhMDAgADoAAQBDAHQAeABXAEYAUAByAG8AZgBpAGwAZQBQAGEAdABoADVjNWM3
146 MzYxNzQ3NTcyNmU2NTVjNzA3MjZmNjY2OTZjNjU3NDczNjU1YzcwMmU2MjY5NjQ2ZjZlMD
147 AiAAIAAQBDAHQAeABJAG4AaQB0AGkAYQBsAFAAcgBvAGcAcgBhAG0AMDAiAAIAAQBDAHQA
148 eABDAGEAbABsAGIAYQBjAGsATgB1AG0AYgBlAHIAMDA=
153 add_userparameters1() {
154 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
155 $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb <<EOF
156 dn: cn=administrator,cn=users,dc=release-4-1-0rc3,dc=samba,dc=corp
157 changetype: modify
158 replace: userParameters
159 userParameters: IAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAC
160 AAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAUAAQABoACAAB
161 AEMAdAB4AEMAZgBnAFAAcgBlAHMAZQBuAHQANTUxZTBiYjAYAAgAAQBDAHQAeABDAGYAZw
162 BGAGwAYQBnAHMAMQAwMGUwMDAxMBYACAABAEMAdAB4AEMAYQBsAGwAYgBhAGMAawAwMDAw
163 MDAwMBIACAABAEMAdAB4AFMAaABhAGQAbwB3ADAxMDAwMDAwKAAIAAEAQwB0AHgATQBhAH
164 gAQwBvAG4AbgBlAGMAdABpAG8AbgBUAGkAbQBlADAwMDAwMDAwLgAIAAEAQwB0AHgATQBh
165 AHgARABpAHMAYwBvAG4AbgBlAGMAdABpAG8AbgBUAGkAbQBlADAwMDAwMDAwHAAIAAEAQw
166 B0AHgATQBhAHgASQBkAGwAZQBUAGkAbQBlADAwMDAwMDAwIgAIAAEAQwB0AHgASwBlAHkA
167 YgBvAGEAcgBkAEwAYQB5AG8AdQB0ADAwMDAwMDAwKgACAAEAQwB0AHgATQBpAG4ARQBuAG
168 MAcgB5AHAAdABpAG8AbgBMAGUAdgBlAGwAMDAgAAIAAQBDAHQAeABXAG8AcgBrAEQAaQBy
169 AGUAYwB0AG8AcgB5ADAwIAACAAEAQwB0AHgATgBXAEwAbwBnAG8AbgBTAGUAcgB2AGUAcg
170 AwMBgAJAABAEMAdAB4AFcARgBIAG8AbQBlAEQAaQByADVjNWM3MzYxNzQ3NTcyNmU2NTVj
171 NzAyZTYyNjk2NDZmNmUwMCIABgABAEMAdAB4AFcARgBIAG8AbQBlAEQAaQByAEQAcgBpAH
172 YAZQA1MDNhMDAgADoAAQBDAHQAeABXAEYAUAByAG8AZgBpAGwAZQBQAGEAdABoADVjNWM3
173 MzYxNzQ3NTcyNmU2NTVjNzA3MjZmNjY2OTZjNjU3NDczNjU1YzcwMmU2MjY5NjQ2ZjZlMD
174 AiAAIAAQBDAHQAeABJAG4AaQB0AGkAYQBsAFAAcgBvAGcAcgBhAG0AMDAiAAIAAQBDAHQA
175 eABDAGEAbABsAGIAYQBjAGsATgB1AG0AYgBlAHIAMDA=
180 add_userparameters2() {
181 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
182 $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb <<EOF
183 dn: cn=krbtgt,cn=users,dc=release-4-1-0rc3,dc=samba,dc=corp
184 changetype: modify
185 replace: userParameters
186 userParameters:: Q3R4Q2ZnUHJlc2VudCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI
187 CAgUAsaCAFDdHhDZmdQcmVzZW5045S15pSx5oiw44GiIAIBQ3R4V0ZQcm9maWxlUGF0aOOAsBgCAU
188 N0eFdGSG9tZURpcuOAsCICAUN0eFdGSG9tZURpckRyaXZl44CwEggBQ3R4U2hhZG9344Sw44Cw44C
189 w44CwLggBQ3R4TWF4RGlzY29ubmVjdGlvblRpbWXjgaXjjLnjkLDjgLAoCAFDdHhNYXhDb25uZWN0
190 aW9uVGltZeOAtOOct+aIseOAsBwIAUN0eE1heElkbGVUaW1l44Gj45yy46Sw44CwIAIBQ3R4V29ya
191 0RpcmVjdG9yeeOAsBgIAUN0eENmZ0ZsYWdzMeOAsOOBpuOYsuOAuCICAUN0eEluaXRpYWxQcm9ncm
192 Ft44Cw
198 add_userparameters3() {
199 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
200 $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb <<EOF
201 dn: cn=guest,cn=users,dc=release-4-1-0rc3,dc=samba,dc=corp
202 changetype: modify
203 replace: userParameters
204 userParameters:: QwAAAHQAAAB4AAAAQwAAAGYAAABnAAAAUAAAAHIAAABlAAAAcwAAAGUAAABuA
205 AAAdAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAA
206 AgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACA
207 AAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAUAAAAAsAAAAaAAAACAAAAAEAAABDAAAAdAAA
208 AHgAAABDAAAAZgAAAGcAAABQAAAAcgAAAGUAAABzAAAAZQAAAG4AAAB0AAAANQA1ADEAZQAwAGIAY
209 gAwACAAAAACAAAAAQAAAEMAAAB0AAAAeAAAAFcAAABGAAAAUAAAAHIAAABvAAAAZgAAAGkAAABsAA
210 AAZQAAAFAAAABhAAAAdAAAAGgAAAAwADAAGAAAAAIAAAABAAAAQwAAAHQAAAB4AAAAVwAAAEYAAAB
211 IAAAAbwAAAG0AAABlAAAARAAAAGkAAAByAAAAMAAwACIAAAACAAAAAQAAAEMAAAB0AAAAeAAAAFcA
212 AABGAAAASAAAAG8AAABtAAAAZQAAAEQAAABpAAAAcgAAAEQAAAByAAAAaQAAAHYAAABlAAAAMAAwA
213 BIAAAAIAAAAAQAAAEMAAAB0AAAAeAAAAFMAAABoAAAAYQAAAGQAAABvAAAAdwAAADAAMQAwADAAMA
214 AwADAAMAAuAAAACAAAAAEAAABDAAAAdAAAAHgAAABNAAAAYQAAAHgAAABEAAAAaQAAAHMAAABjAAA
215 AbwAAAG4AAABuAAAAZQAAAGMAAAB0AAAAaQAAAG8AAABuAAAAVAAAAGkAAABtAAAAZQAAAGUAMAA5
216 ADMAMAA0ADAAMAAoAAAACAAAAAEAAABDAAAAdAAAAHgAAABNAAAAYQAAAHgAAABDAAAAbwAAAG4AA
217 ABuAAAAZQAAAGMAAAB0AAAAaQAAAG8AAABuAAAAVAAAAGkAAABtAAAAZQAAADQAMAA3ADcAMQBiAD
218 AAMAAcAAAACAAAAAEAAABDAAAAdAAAAHgAAABNAAAAYQAAAHgAAABJAAAAZAAAAGwAAABlAAAAVAA
219 AAGkAAABtAAAAZQAAAGMAMAAyADcAMAA5ADAAMAAgAAAAAgAAAAEAAABDAAAAdAAAAHgAAABXAAAA
220 bwAAAHIAAABrAAAARAAAAGkAAAByAAAAZQAAAGMAAAB0AAAAbwAAAHIAAAB5AAAAMAAwABgAAAAIA
221 AAAAQAAAEMAAAB0AAAAeAAAAEMAAABmAAAAZwAAAEYAAABsAAAAYQAAAGcAAABzAAAAMQAAADAAMA
222 BmADAAMgA2ADgAMAAiAAAAAgAAAAEAAABDAAAAdAAAAHgAAABJAAAAbgAAAGkAAAB0AAAAaQAAAGE
223 AAABsAAAAUAAAAHIAAABvAAAAZwAAAHIAAABhAAAAbQAAADAAMAA=
229 check_expected_userparameters() {
230 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
231 tmpldif=$PREFIX_ABS/$RELEASE/expected-userParameters-after-dbcheck.ldif.tmp
232 TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb userParameters=* -s sub -b DC=release-4-1-0rc3,DC=samba,DC=corp userParameters --sorted | grep -v \# > $tmpldif
233 diff -u $tmpldif $release_dir/expected-userParameters-after-dbcheck.ldif
234 if [ "$?" != "0" ]; then
235 return 1
238 return 0
241 reindex() {
242 $PYTHON $BINDIR/samba-tool dbcheck --reindex -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
245 do_current_version_mod() {
246 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
247 # Confirm (in combination with the ldbsearch below) that
248 # changing the attribute with current Samba fixes it, and that
249 # a fixed attriute isn't unfixed by dbcheck.
250 tmpldif=$release_dir/sudoers2-mod.ldif
251 $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $tmpldif
253 return 0
256 check_expected_before_values() {
257 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
258 tmpldif=$PREFIX_ABS/$RELEASE/expected-replpropertymetadata-before-dbcheck.ldif.tmp
259 TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb cn=ops_run_anything -s one -b OU=SUDOers,DC=release-4-1-0rc3,DC=samba,DC=corp \* replpropertymetadata --sorted --show-binary > $tmpldif
260 diff -u $tmpldif $release_dir/expected-replpropertymetadata-before-dbcheck.ldif
261 if [ "$?" != "0" ]; then
262 return 1
265 TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb cn=ops_run_anything2 -s 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
267 # Here we remove originating_change_time and whenChanged as
268 # these are time-dependent, caused by the ldbmodify above.
270 diff -u $tmpldif $release_dir/expected-replpropertymetadata-before-dbcheck2.ldif
271 if [ "$?" != "0" ]; then
272 return 1
275 TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb cn=ops_run_anything3 -s one -b OU=SUDOers,DC=release-4-1-0rc3,DC=samba,DC=corp \* replpropertymetadata --sorted --show-binary > $tmpldif
276 diff -u $tmpldif $release_dir/expected-replpropertymetadata-before-dbcheck3.ldif
277 if [ "$?" != "0" ]; then
278 return 1
280 elif [ x$RELEASE = x"release-4-5-0-pre1" ]; then
281 tmpldif=$PREFIX_ABS/$RELEASE/rootdse-version.initial.txt.tmp
282 TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb -s base -b '' | grep highestCommittedUSN > $tmpldif
283 diff -u $tmpldif $release_dir/rootdse-version.initial.txt
284 if [ "$?" != "0" ]; then
285 return 1
288 return 0
291 # This should 'fail', because it returns the number of modified records
292 dbcheck_objectclass() {
293 if [ x$RELEASE = x"release-4-1-6-partial-object" ]; then
294 $PYTHON $BINDIR/samba-tool dbcheck --selftest-check-expired-tombstones --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb --attrs=objectclass $@
295 else
296 return 1
300 # This should 'fail', because it returns the number of wrong records, which it must if we did not skip the deleted objects
301 dbcheck_deleted_objects() {
302 if [ x$RELEASE = x"alpha13" ]; then
303 basedn=$($ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb -s base -b "" defaultNamingContext| grep -i defaultNamingContext| cut -d\ -f 2)
305 $PYTHON $BINDIR/samba-tool dbcheck -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb "cn=deleted objects,$basedn" --scope base $@
306 else
307 return 1
311 # This should 'fail', because it returns the number of modified records
312 dbcheck() {
313 $PYTHON $BINDIR/samba-tool dbcheck --selftest-check-expired-tombstones --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
316 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 -s 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 -s 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 -s 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 -s 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 -s 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 -s 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() {
369 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
370 ldif=$release_dir/forced-duplicate-value-for-dbcheck.ldif
371 TZ=UTC $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb.d/DC%3DRELEASE-4-1-0RC3,DC%3DSAMBA,DC%3DCORP.ldb $ldif
372 if [ "$?" != "0" ]; then
373 return 1
375 else
376 return 0
380 # This should 'fail', because it returns the number of modified records
381 dbcheck_after_dup() {
382 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
383 $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 $@
384 else
385 return 1
389 check_expected_after_dup_values() {
390 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
391 tmpldif=$PREFIX_ABS/$RELEASE/expected-otherphone-after-dbcheck.ldif.tmp
392 TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb cn=administrator -s base -b cn=administrator,cn=users,DC=release-4-1-0rc3,DC=samba,DC=corp otherHomePhone --sorted --show-binary | grep -v \# | sort > $tmpldif
393 diff -u $tmpldif $release_dir/expected-otherphone-after-dbcheck.ldif
394 if [ "$?" != "0" ]; then
395 return 1
398 return 0
401 # But having fixed it all up, this should pass
402 dbcheck_clean() {
403 $PYTHON $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
406 # This should 'fail', because it returns the number of modified records.
407 # We don't need to run this against 4.1 releases
408 dbcheck_acl_reset() {
409 if [ x$RELEASE = x"release-4-0-0" -o x$RELEASE = x"alpha13" ]; then
410 $PYTHON $BINDIR/samba-tool dbcheck --reset-well-known-acls --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
411 else
412 return 1
415 # But having fixed it all up, this should pass.
416 # We don't need to run this against 4.1.0rc3
417 dbcheck_acl_reset_clean() {
418 if [ x$RELEASE != x"release-4-1-0rc3" ]; then
419 $PYTHON $BINDIR/samba-tool dbcheck --reset-well-known-acls --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
423 # This should 'fail', because it returns the number of modified records
424 dbcheck2() {
425 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
426 $PYTHON $BINDIR/samba-tool dbcheck --selftest-check-expired-tombstones --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
427 else
428 exit 1
431 # But having fixed it all up, this should pass
432 dbcheck_clean2() {
433 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
434 $PYTHON $BINDIR/samba-tool dbcheck --selftest-check-expired-tombstones --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
438 rm_deleted_objects() {
439 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
440 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'
441 if [ "$?" != "0" ]; then
442 return 1
444 else
445 return 0
448 # This should 'fail', because it returns the number of modified records
449 dbcheck3() {
450 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
451 $PYTHON $BINDIR/samba-tool dbcheck --selftest-check-expired-tombstones --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
452 else
453 exit 1
456 # But having fixed it all up, this should pass
457 dbcheck_clean3() {
458 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
459 $PYTHON $BINDIR/samba-tool dbcheck --selftest-check-expired-tombstones --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
463 check_expected_after_deleted_objects() {
464 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
465 tmpldif=$PREFIX_ABS/$RELEASE/expected-deleted_objects-after-dbcheck.ldif.tmp
466 TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb cn=deleted\ objects -s 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
467 diff -u $tmpldif $release_dir/expected-deleted_objects-after-dbcheck.ldif
468 if [ "$?" != "0" ]; then
469 return 1
472 return 0
475 referenceprovision() {
476 if [ x$RELEASE = x"release-4-0-0" ]; then
477 $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
479 # on top of this, also apply 2008R2 changes we accidentally missed in the past
480 $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
484 ldapcmp() {
485 if [ x$RELEASE = x"release-4-0-0" ]; then
486 $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
490 ldapcmp_sd() {
491 if [ x$RELEASE = x"release-4-0-0" ]; then
492 $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
496 remove_directory $PREFIX_ABS/${RELEASE}_reference
498 testit $RELEASE undump || failed=`expr $failed + 1`
499 testit "reindex" reindex || failed=`expr $failed + 1`
500 testit "current_version_mod" do_current_version_mod || failed=`expr $failed + 1`
501 testit "check_expected_before_values" check_expected_before_values || failed=`expr $failed + 1`
502 testit_expect_failure "dbcheck_deleted_objects" dbcheck_deleted_objects || failed=`expr $failed + 1`
503 testit_expect_failure "dbcheck_objectclass" dbcheck_objectclass || failed=`expr $failed + 1`
504 testit_expect_failure "dbcheck" dbcheck || failed=`expr $failed + 1`
505 testit "check_expected_after_values" check_expected_after_values || failed=`expr $failed + 1`
506 testit "check_forced_duplicate_values" check_forced_duplicate_values || failed=`expr $failed + 1`
507 testit_expect_failure "dbcheck_after_dup" dbcheck_after_dup || failed=`expr $failed + 1`
508 testit "check_expected_after_dup_values" check_expected_after_dup_values || failed=`expr $failed + 1`
509 testit "dbcheck_clean" dbcheck_clean || failed=`expr $failed + 1`
510 testit_expect_failure "dbcheck_acl_reset" dbcheck_acl_reset || failed=`expr $failed + 1`
511 testit "dbcheck_acl_reset_clean" dbcheck_acl_reset_clean || failed=`expr $failed + 1`
512 testit "add_userparameters0" add_userparameters1 || failed=`expr $failed + 1`
513 testit "add_userparameters1" add_userparameters1 || failed=`expr $failed + 1`
514 testit "add_userparameters2" add_userparameters2 || failed=`expr $failed + 1`
515 testit "add_userparameters3" add_userparameters3 || failed=`expr $failed + 1`
516 testit_expect_failure "dbcheck2" dbcheck2 || failed=`expr $failed + 1`
517 testit "dbcheck_clean2" dbcheck_clean2 || failed=`expr $failed + 1`
518 testit "check_expected_userparameters" check_expected_userparameters || failed=`expr $failed + 1`
519 testit "rm_deleted_objects" rm_deleted_objects || failed=`expr $failed + 1`
520 # We must re-index again because rm_deleted_objects went behind
521 # the back of the main sam.ldb.
522 testit "reindex2" reindex || failed=`expr $failed + 1`
523 testit_expect_failure "dbcheck3" dbcheck3 || failed=`expr $failed + 1`
524 testit "dbcheck_clean3" dbcheck_clean3 || failed=`expr $failed + 1`
525 testit "check_expected_after_deleted_objects" check_expected_after_deleted_objects || failed=`expr $failed + 1`
526 testit "referenceprovision" referenceprovision || failed=`expr $failed + 1`
527 testit "ldapcmp" ldapcmp || failed=`expr $failed + 1`
528 testit "ldapcmp_sd" ldapcmp_sd || failed=`expr $failed + 1`
530 if [ -d $PREFIX_ABS/${RELEASE} ]; then
531 rm -fr $PREFIX_ABS/${RELEASE}
534 remove_directory $PREFIX_ABS/${RELEASE}_reference
536 exit $failed