downgradedatabase: installing script
[Samba.git] / testprogs / blackbox / dbcheck-oldrelease.sh
blob3d0ee2c165ac0ad77cdd9a02ae48cc26b6da2ca2
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 . `dirname $0`/subunit.sh
16 release_dir=`dirname $0`/../../source4/selftest/provisions/$RELEASE
18 ldbmodify="ldbmodify"
19 if [ -x "$BINDIR/ldbmodify" ]; then
20 ldbmodify="$BINDIR/ldbmodify"
23 ldbdel="ldbdel"
24 if [ -x "$BINDIR/ldbdel" ]; then
25 ldbdel="$BINDIR/ldbdel"
28 ldbsearch="ldbsearch"
29 if [ -x "$BINDIR/ldbsearch" ]; then
30 ldbsearch="$BINDIR/ldbsearch"
33 undump() {
34 if test -x $BINDIR/tdbrestore;
35 then
36 `dirname $0`/../../source4/selftest/provisions/undump.sh $release_dir $PREFIX_ABS/$RELEASE $BINDIR/tdbrestore
37 else
38 `dirname $0`/../../source4/selftest/provisions/undump.sh $release_dir $PREFIX_ABS/$RELEASE
42 add_userparameters0() {
43 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
44 $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb <<EOF
45 dn: cn=localdc,cn=domain controllers,dc=release-4-1-0rc3,dc=samba,dc=corp
46 changetype: modify
47 replace: userParameters
48 userParameters:: IAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAC
49 AAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAUAAQABoACAAB
50 AEMAdAB4AEMAZgBnAFAAcgBlAHMAZQBuAHQANTUxZTBiYjAYAAgAAQBDAHQAeABDAGYAZw
51 BGAGwAYQBnAHMAMQAwMGUwMDAxMBYACAABAEMAdAB4AEMAYQBsAGwAYgBhAGMAawAwMDAw
52 MDAwMBIACAABAEMAdAB4AFMAaABhAGQAbwB3ADAxMDAwMDAwKAAIAAEAQwB0AHgATQBhAH
53 gAQwBvAG4AbgBlAGMAdABpAG8AbgBUAGkAbQBlADAwMDAwMDAwLgAIAAEAQwB0AHgATQBh
54 AHgARABpAHMAYwBvAG4AbgBlAGMAdABpAG8AbgBUAGkAbQBlADAwMDAwMDAwHAAIAAEAQw
55 B0AHgATQBhAHgASQBkAGwAZQBUAGkAbQBlADAwMDAwMDAwIgAIAAEAQwB0AHgASwBlAHkA
56 YgBvAGEAcgBkAEwAYQB5AG8AdQB0ADAwMDAwMDAwKgACAAEAQwB0AHgATQBpAG4ARQBuAG
57 MAcgB5AHAAdABpAG8AbgBMAGUAdgBlAGwAMDAgAAIAAQBDAHQAeABXAG8AcgBrAEQAaQBy
58 AGUAYwB0AG8AcgB5ADAwIAACAAEAQwB0AHgATgBXAEwAbwBnAG8AbgBTAGUAcgB2AGUAcg
59 AwMBgAJAABAEMAdAB4AFcARgBIAG8AbQBlAEQAaQByADVjNWM3MzYxNzQ3NTcyNmU2NTVj
60 NzAyZTYyNjk2NDZmNmUwMCIABgABAEMAdAB4AFcARgBIAG8AbQBlAEQAaQByAEQAcgBpAH
61 YAZQA1MDNhMDAgADoAAQBDAHQAeABXAEYAUAByAG8AZgBpAGwAZQBQAGEAdABoADVjNWM3
62 MzYxNzQ3NTcyNmU2NTVjNzA3MjZmNjY2OTZjNjU3NDczNjU1YzcwMmU2MjY5NjQ2ZjZlMD
63 AiAAIAAQBDAHQAeABJAG4AaQB0AGkAYQBsAFAAcgBvAGcAcgBhAG0AMDAiAAIAAQBDAHQA
64 eABDAGEAbABsAGIAYQBjAGsATgB1AG0AYgBlAHIAMDA=
66 EOF
69 add_userparameters1() {
70 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
71 $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb <<EOF
72 dn: cn=administrator,cn=users,dc=release-4-1-0rc3,dc=samba,dc=corp
73 changetype: modify
74 replace: userParameters
75 userParameters: IAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAC
76 AAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAUAAQABoACAAB
77 AEMAdAB4AEMAZgBnAFAAcgBlAHMAZQBuAHQANTUxZTBiYjAYAAgAAQBDAHQAeABDAGYAZw
78 BGAGwAYQBnAHMAMQAwMGUwMDAxMBYACAABAEMAdAB4AEMAYQBsAGwAYgBhAGMAawAwMDAw
79 MDAwMBIACAABAEMAdAB4AFMAaABhAGQAbwB3ADAxMDAwMDAwKAAIAAEAQwB0AHgATQBhAH
80 gAQwBvAG4AbgBlAGMAdABpAG8AbgBUAGkAbQBlADAwMDAwMDAwLgAIAAEAQwB0AHgATQBh
81 AHgARABpAHMAYwBvAG4AbgBlAGMAdABpAG8AbgBUAGkAbQBlADAwMDAwMDAwHAAIAAEAQw
82 B0AHgATQBhAHgASQBkAGwAZQBUAGkAbQBlADAwMDAwMDAwIgAIAAEAQwB0AHgASwBlAHkA
83 YgBvAGEAcgBkAEwAYQB5AG8AdQB0ADAwMDAwMDAwKgACAAEAQwB0AHgATQBpAG4ARQBuAG
84 MAcgB5AHAAdABpAG8AbgBMAGUAdgBlAGwAMDAgAAIAAQBDAHQAeABXAG8AcgBrAEQAaQBy
85 AGUAYwB0AG8AcgB5ADAwIAACAAEAQwB0AHgATgBXAEwAbwBnAG8AbgBTAGUAcgB2AGUAcg
86 AwMBgAJAABAEMAdAB4AFcARgBIAG8AbQBlAEQAaQByADVjNWM3MzYxNzQ3NTcyNmU2NTVj
87 NzAyZTYyNjk2NDZmNmUwMCIABgABAEMAdAB4AFcARgBIAG8AbQBlAEQAaQByAEQAcgBpAH
88 YAZQA1MDNhMDAgADoAAQBDAHQAeABXAEYAUAByAG8AZgBpAGwAZQBQAGEAdABoADVjNWM3
89 MzYxNzQ3NTcyNmU2NTVjNzA3MjZmNjY2OTZjNjU3NDczNjU1YzcwMmU2MjY5NjQ2ZjZlMD
90 AiAAIAAQBDAHQAeABJAG4AaQB0AGkAYQBsAFAAcgBvAGcAcgBhAG0AMDAiAAIAAQBDAHQA
91 eABDAGEAbABsAGIAYQBjAGsATgB1AG0AYgBlAHIAMDA=
93 EOF
96 add_userparameters2() {
97 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
98 $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb <<EOF
99 dn: cn=krbtgt,cn=users,dc=release-4-1-0rc3,dc=samba,dc=corp
100 changetype: modify
101 replace: userParameters
102 userParameters:: Q3R4Q2ZnUHJlc2VudCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI
103 CAgUAsaCAFDdHhDZmdQcmVzZW5045S15pSx5oiw44GiIAIBQ3R4V0ZQcm9maWxlUGF0aOOAsBgCAU
104 N0eFdGSG9tZURpcuOAsCICAUN0eFdGSG9tZURpckRyaXZl44CwEggBQ3R4U2hhZG9344Sw44Cw44C
105 w44CwLggBQ3R4TWF4RGlzY29ubmVjdGlvblRpbWXjgaXjjLnjkLDjgLAoCAFDdHhNYXhDb25uZWN0
106 aW9uVGltZeOAtOOct+aIseOAsBwIAUN0eE1heElkbGVUaW1l44Gj45yy46Sw44CwIAIBQ3R4V29ya
107 0RpcmVjdG9yeeOAsBgIAUN0eENmZ0ZsYWdzMeOAsOOBpuOYsuOAuCICAUN0eEluaXRpYWxQcm9ncm
108 Ft44Cw
114 add_userparameters3() {
115 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
116 $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb <<EOF
117 dn: cn=guest,cn=users,dc=release-4-1-0rc3,dc=samba,dc=corp
118 changetype: modify
119 replace: userParameters
120 userParameters:: QwAAAHQAAAB4AAAAQwAAAGYAAABnAAAAUAAAAHIAAABlAAAAcwAAAGUAAABuA
121 AAAdAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAA
122 AgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACA
123 AAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAUAAAAAsAAAAaAAAACAAAAAEAAABDAAAAdAAA
124 AHgAAABDAAAAZgAAAGcAAABQAAAAcgAAAGUAAABzAAAAZQAAAG4AAAB0AAAANQA1ADEAZQAwAGIAY
125 gAwACAAAAACAAAAAQAAAEMAAAB0AAAAeAAAAFcAAABGAAAAUAAAAHIAAABvAAAAZgAAAGkAAABsAA
126 AAZQAAAFAAAABhAAAAdAAAAGgAAAAwADAAGAAAAAIAAAABAAAAQwAAAHQAAAB4AAAAVwAAAEYAAAB
127 IAAAAbwAAAG0AAABlAAAARAAAAGkAAAByAAAAMAAwACIAAAACAAAAAQAAAEMAAAB0AAAAeAAAAFcA
128 AABGAAAASAAAAG8AAABtAAAAZQAAAEQAAABpAAAAcgAAAEQAAAByAAAAaQAAAHYAAABlAAAAMAAwA
129 BIAAAAIAAAAAQAAAEMAAAB0AAAAeAAAAFMAAABoAAAAYQAAAGQAAABvAAAAdwAAADAAMQAwADAAMA
130 AwADAAMAAuAAAACAAAAAEAAABDAAAAdAAAAHgAAABNAAAAYQAAAHgAAABEAAAAaQAAAHMAAABjAAA
131 AbwAAAG4AAABuAAAAZQAAAGMAAAB0AAAAaQAAAG8AAABuAAAAVAAAAGkAAABtAAAAZQAAAGUAMAA5
132 ADMAMAA0ADAAMAAoAAAACAAAAAEAAABDAAAAdAAAAHgAAABNAAAAYQAAAHgAAABDAAAAbwAAAG4AA
133 ABuAAAAZQAAAGMAAAB0AAAAaQAAAG8AAABuAAAAVAAAAGkAAABtAAAAZQAAADQAMAA3ADcAMQBiAD
134 AAMAAcAAAACAAAAAEAAABDAAAAdAAAAHgAAABNAAAAYQAAAHgAAABJAAAAZAAAAGwAAABlAAAAVAA
135 AAGkAAABtAAAAZQAAAGMAMAAyADcAMAA5ADAAMAAgAAAAAgAAAAEAAABDAAAAdAAAAHgAAABXAAAA
136 bwAAAHIAAABrAAAARAAAAGkAAAByAAAAZQAAAGMAAAB0AAAAbwAAAHIAAAB5AAAAMAAwABgAAAAIA
137 AAAAQAAAEMAAAB0AAAAeAAAAEMAAABmAAAAZwAAAEYAAABsAAAAYQAAAGcAAABzAAAAMQAAADAAMA
138 BmADAAMgA2ADgAMAAiAAAAAgAAAAEAAABDAAAAdAAAAHgAAABJAAAAbgAAAGkAAAB0AAAAaQAAAGE
139 AAABsAAAAUAAAAHIAAABvAAAAZwAAAHIAAABhAAAAbQAAADAAMAA=
145 check_expected_userparameters() {
146 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
147 tmpldif=$PREFIX_ABS/$RELEASE/expected-userParameters-after-dbcheck.ldif.tmp
148 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
149 diff -u $tmpldif $release_dir/expected-userParameters-after-dbcheck.ldif
150 if [ "$?" != "0" ]; then
151 return 1
154 return 0
157 reindex() {
158 $PYTHON $BINDIR/samba-tool dbcheck --reindex -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
161 do_current_version_mod() {
162 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
163 # Confirm (in combination with the ldbsearch below) that
164 # changing the attribute with current Samba fixes it, and that
165 # a fixed attriute isn't unfixed by dbcheck.
166 tmpldif=$release_dir/sudoers2-mod.ldif
167 $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $tmpldif
169 return 0
172 check_expected_before_values() {
173 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
174 tmpldif=$PREFIX_ABS/$RELEASE/expected-replpropertymetadata-before-dbcheck.ldif.tmp
175 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
176 diff -u $tmpldif $release_dir/expected-replpropertymetadata-before-dbcheck.ldif
177 if [ "$?" != "0" ]; then
178 return 1
181 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
183 # Here we remove originating_change_time and whenChanged as
184 # these are time-dependent, caused by the ldbmodify above.
186 diff -u $tmpldif $release_dir/expected-replpropertymetadata-before-dbcheck2.ldif
187 if [ "$?" != "0" ]; then
188 return 1
191 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
192 diff -u $tmpldif $release_dir/expected-replpropertymetadata-before-dbcheck3.ldif
193 if [ "$?" != "0" ]; then
194 return 1
196 elif [ x$RELEASE = x"release-4-5-0-pre1" ]; then
197 tmpldif=$PREFIX_ABS/$RELEASE/rootdse-version.initial.txt.tmp
198 TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb -s base -b '' | grep highestCommittedUSN > $tmpldif
199 diff -u $tmpldif $release_dir/rootdse-version.initial.txt
200 if [ "$?" != "0" ]; then
201 return 1
204 return 0
207 # This should 'fail', because it returns the number of modified records
208 dbcheck_objectclass() {
209 if [ x$RELEASE = x"release-4-1-6-partial-object" ]; then
210 $PYTHON $BINDIR/samba-tool dbcheck --selftest-check-expired-tombstones --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb --attrs=objectclass $@
211 else
212 return 1
216 # This should 'fail', because it returns the number of modified records
217 dbcheck() {
218 $PYTHON $BINDIR/samba-tool dbcheck --selftest-check-expired-tombstones --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
221 check_expected_after_values() {
222 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
223 tmpldif=$PREFIX_ABS/$RELEASE/expected-replpropertymetadata-after-dbcheck.ldif.tmp
224 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
225 diff -u $tmpldif $release_dir/expected-replpropertymetadata-after-dbcheck.ldif
226 if [ "$?" != "0" ]; then
227 return 1
229 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
230 diff -u $tmpldif $release_dir/expected-replpropertymetadata-after-dbcheck2.ldif
231 if [ "$?" != "0" ]; then
232 return 1
234 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
235 diff -u $tmpldif $release_dir/expected-replpropertymetadata-after-dbcheck3.ldif
236 if [ "$?" != "0" ]; then
237 return 1
239 # Check DomainDNS partition for replica locations
240 tmpldif=$PREFIX_ABS/$RELEASE/expected-replica-locations-after-dbcheck.ldif.tmp
241 $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
242 diff -u $tmpldif $release_dir/expected-replica-locations-after-dbcheck.ldif
243 if [ "$?" != "0" ]; then
244 return 1
246 # Check ForestDNS partition for replica locations
247 $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
248 diff -u $tmpldif $release_dir/expected-replica-locations-after-dbcheck2.ldif
249 if [ "$?" != "0" ]; then
250 return 1
252 elif [ x$RELEASE = x"release-4-5-0-pre1" ]; then
253 echo $RELEASE checking after values
254 tmpldif=$PREFIX_ABS/$RELEASE/expected-links-after-dbcheck.ldif.tmp
255 $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
256 diff -u $tmpldif $release_dir/expected-links-after-dbcheck.ldif
257 if [ "$?" != "0" ]; then
258 return 1
261 # If in the future dbcheck has to make a change recorded in replPropertyMetadata,
262 # this test will fail and can be removed.
263 tmpversion=$PREFIX_ABS/$RELEASE/rootdse-version.final.txt.tmp
264 TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb -s base -b '' | grep highestCommittedUSN > $tmpversion
265 diff -u $tmpversion $release_dir/rootdse-version.final.txt
266 if [ "$?" != "0" ]; then
267 return 1
270 return 0
273 check_forced_duplicate_values() {
274 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
275 ldif=$release_dir/forced-duplicate-value-for-dbcheck.ldif
276 TZ=UTC $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb.d/DC%3DRELEASE-4-1-0RC3,DC%3DSAMBA,DC%3DCORP.ldb $ldif
277 if [ "$?" != "0" ]; then
278 return 1
280 else
281 return 0
285 # This should 'fail', because it returns the number of modified records
286 dbcheck_after_dup() {
287 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
288 $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 $@
289 else
290 return 1
294 check_expected_after_dup_values() {
295 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
296 tmpldif=$PREFIX_ABS/$RELEASE/expected-otherphone-after-dbcheck.ldif.tmp
297 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
298 diff -u $tmpldif $release_dir/expected-otherphone-after-dbcheck.ldif
299 if [ "$?" != "0" ]; then
300 return 1
303 return 0
306 # But having fixed it all up, this should pass
307 dbcheck_clean() {
308 $PYTHON $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
311 # This should 'fail', because it returns the number of modified records.
312 # We don't need to run this against 4.1 releases
313 dbcheck_acl_reset() {
314 if [ x$RELEASE = x"release-4-0-0" -o x$RELEASE = x"alpha13" ]; then
315 $PYTHON $BINDIR/samba-tool dbcheck --reset-well-known-acls --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
316 else
317 return 1
320 # But having fixed it all up, this should pass.
321 # We don't need to run this against 4.1.0rc3
322 dbcheck_acl_reset_clean() {
323 if [ x$RELEASE != x"release-4-1-0rc3" ]; then
324 $PYTHON $BINDIR/samba-tool dbcheck --reset-well-known-acls --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
328 # This should 'fail', because it returns the number of modified records
329 dbcheck2() {
330 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
331 $PYTHON $BINDIR/samba-tool dbcheck --selftest-check-expired-tombstones --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
332 else
333 exit 1
336 # But having fixed it all up, this should pass
337 dbcheck_clean2() {
338 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
339 $PYTHON $BINDIR/samba-tool dbcheck --selftest-check-expired-tombstones --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
343 rm_deleted_objects() {
344 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
345 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'
346 if [ "$?" != "0" ]; then
347 return 1
349 else
350 return 0
353 # This should 'fail', because it returns the number of modified records
354 dbcheck3() {
355 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
356 $PYTHON $BINDIR/samba-tool dbcheck --selftest-check-expired-tombstones --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
357 else
358 exit 1
361 # But having fixed it all up, this should pass
362 dbcheck_clean3() {
363 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
364 $PYTHON $BINDIR/samba-tool dbcheck --selftest-check-expired-tombstones --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
368 check_expected_after_deleted_objects() {
369 if [ x$RELEASE = x"release-4-1-0rc3" ]; then
370 tmpldif=$PREFIX_ABS/$RELEASE/expected-deleted_objects-after-dbcheck.ldif.tmp
371 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
372 diff -u $tmpldif $release_dir/expected-deleted_objects-after-dbcheck.ldif
373 if [ "$?" != "0" ]; then
374 return 1
377 return 0
380 referenceprovision() {
381 if [ x$RELEASE = x"release-4-0-0" ]; then
382 $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
384 # on top of this, also apply 2008R2 changes we accidentally missed in the past
385 $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
389 ldapcmp() {
390 if [ x$RELEASE = x"release-4-0-0" ]; then
391 $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
395 ldapcmp_sd() {
396 if [ x$RELEASE = x"release-4-0-0" ]; then
397 $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
401 if [ -d $release_dir ]; then
402 testit $RELEASE undump
403 testit "reindex" reindex
404 testit "current_version_mod" do_current_version_mod
405 testit "check_expected_before_values" check_expected_before_values
406 testit_expect_failure "dbcheck_objectclass" dbcheck_objectclass
407 testit_expect_failure "dbcheck" dbcheck
408 testit "check_expected_after_values" check_expected_after_values
409 testit "check_forced_duplicate_values" check_forced_duplicate_values
410 testit_expect_failure "dbcheck_after_dup" dbcheck_after_dup
411 testit "check_expected_after_dup_values" check_expected_after_dup_values
412 testit "dbcheck_clean" dbcheck_clean
413 testit_expect_failure "dbcheck_acl_reset" dbcheck_acl_reset
414 testit "dbcheck_acl_reset_clean" dbcheck_acl_reset_clean
415 testit "add_userparameters0" add_userparameters1
416 testit "add_userparameters1" add_userparameters1
417 testit "add_userparameters2" add_userparameters2
418 testit "add_userparameters3" add_userparameters3
419 testit_expect_failure "dbcheck2" dbcheck2
420 testit "dbcheck_clean2" dbcheck_clean2
421 testit "check_expected_userparameters" check_expected_userparameters
422 testit "rm_deleted_objects" rm_deleted_objects
423 # We must re-index again because rm_deleted_objects went behind
424 # the back of the main sam.ldb.
425 testit "reindex2" reindex
426 testit_expect_failure "dbcheck3" dbcheck3
427 testit "dbcheck_clean3" dbcheck_clean3
428 testit "check_expected_after_deleted_objects" check_expected_after_deleted_objects
429 testit "referenceprovision" referenceprovision
430 testit "ldapcmp" ldapcmp
431 testit "ldapcmp_sd" ldapcmp_sd
432 else
433 subunit_start_test $RELEASE
434 subunit_skip_test $RELEASE <<EOF
435 no test provision
438 subunit_start_test "reindex"
439 subunit_skip_test "reindex" <<EOF
440 no test provision
442 subunit_start_test check_expected_before_values
443 subunit_skip_test check_expected_before_values<<EOF
444 no test provision
446 subunit_start_test "dbcheck"
447 subunit_skip_test "dbcheck" <<EOF
448 no test provision
450 subunit_start_test "dbcheck_clean"
451 subunit_skip_test "dbcheck_clean" <<EOF
452 no test provision
454 subunit_start_test check_expected_after_values
455 subunit_skip_test check_expected_after_values<<EOF
456 no test provision
458 subunit_start_test "dbcheck_acl_reset"
459 subunit_skip_test "dbcheck_acl_reset" <<EOF
460 no test provision
462 subunit_start_test "dbcheck_clean_acl_reset"
463 subunit_skip_test "dbcheck_clean_acl_reset" <<EOF
464 no test provision
466 subunit_start_test add_userparameters0
467 subunit_skip_test add_userparameters0<<EOF
468 no test provision
471 subunit_start_test add_userparameters1
472 subunit_skip_test add_userparameters1<<EOF
473 no test provision
476 subunit_start_test add_userparameters2
477 subunit_skip_test add_userparameters2<<EOF
478 no test provision
481 subunit_start_test add_userparameters3
482 subunit_skip_test add_userparameters3<<EOF
483 no test provision
486 subunit_start_test check_expected_before_values
487 subunit_skip_test check_expected_before_values<<EOF
488 no test provision
491 subunit_start_test "dbcheck2"
492 subunit_skip_test "dbcheck2" <<EOF
493 no test provision
496 subunit_start_test "referenceprovision"
497 subunit_skip_test "referenceprovision" <<EOF
498 no test provision
500 subunit_start_test "ldapcmp"
501 subunit_skip_test "ldapcmp" <<EOF
502 no test provision
504 subunit_start_test "ldapcmp_sd"
505 subunit_skip_test "ldapcmp_sd" <<EOF
506 no test provision
510 if [ -d $PREFIX_ABS/${RELEASE} ]; then
511 rm -fr $PREFIX_ABS/${RELEASE}
514 if [ -d $PREFIX_ABS/${RELEASE}_reference ]; then
515 rm -fr $PREFIX_ABS/${RELEASE}_reference
518 exit $failed