5 Usage: dbcheck.sh PREFIX RELEASE
14 .
`dirname $0`/subunit.sh
16 release_dir
=`dirname $0`/..
/..
/source4/selftest
/provisions
/$RELEASE
19 if [ -x "$BINDIR/ldbmodify" ]; then
20 ldbmodify
="$BINDIR/ldbmodify"
24 if [ -x "$BINDIR/ldbsearch" ]; then
25 ldbsearch
="$BINDIR/ldbsearch"
29 if test -x $BINDIR/tdbrestore
;
31 `dirname $0`/..
/..
/source4/selftest
/provisions
/undump.sh
$release_dir $PREFIX_ABS/$RELEASE $BINDIR/tdbrestore
33 `dirname $0`/..
/..
/source4/selftest
/provisions
/undump.sh
$release_dir $PREFIX_ABS/$RELEASE
37 add_userparameters0
() {
38 if [ x
$RELEASE = x
"release-4-1-0rc3" ]; then
39 $ldbmodify -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
<<EOF
40 dn: cn=localdc,cn=domain controllers,dc=release-4-1-0rc3,dc=samba,dc=corp
42 replace: userParameters
43 userParameters:: IAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAC
44 AAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAUAAQABoACAAB
45 AEMAdAB4AEMAZgBnAFAAcgBlAHMAZQBuAHQANTUxZTBiYjAYAAgAAQBDAHQAeABDAGYAZw
46 BGAGwAYQBnAHMAMQAwMGUwMDAxMBYACAABAEMAdAB4AEMAYQBsAGwAYgBhAGMAawAwMDAw
47 MDAwMBIACAABAEMAdAB4AFMAaABhAGQAbwB3ADAxMDAwMDAwKAAIAAEAQwB0AHgATQBhAH
48 gAQwBvAG4AbgBlAGMAdABpAG8AbgBUAGkAbQBlADAwMDAwMDAwLgAIAAEAQwB0AHgATQBh
49 AHgARABpAHMAYwBvAG4AbgBlAGMAdABpAG8AbgBUAGkAbQBlADAwMDAwMDAwHAAIAAEAQw
50 B0AHgATQBhAHgASQBkAGwAZQBUAGkAbQBlADAwMDAwMDAwIgAIAAEAQwB0AHgASwBlAHkA
51 YgBvAGEAcgBkAEwAYQB5AG8AdQB0ADAwMDAwMDAwKgACAAEAQwB0AHgATQBpAG4ARQBuAG
52 MAcgB5AHAAdABpAG8AbgBMAGUAdgBlAGwAMDAgAAIAAQBDAHQAeABXAG8AcgBrAEQAaQBy
53 AGUAYwB0AG8AcgB5ADAwIAACAAEAQwB0AHgATgBXAEwAbwBnAG8AbgBTAGUAcgB2AGUAcg
54 AwMBgAJAABAEMAdAB4AFcARgBIAG8AbQBlAEQAaQByADVjNWM3MzYxNzQ3NTcyNmU2NTVj
55 NzAyZTYyNjk2NDZmNmUwMCIABgABAEMAdAB4AFcARgBIAG8AbQBlAEQAaQByAEQAcgBpAH
56 YAZQA1MDNhMDAgADoAAQBDAHQAeABXAEYAUAByAG8AZgBpAGwAZQBQAGEAdABoADVjNWM3
57 MzYxNzQ3NTcyNmU2NTVjNzA3MjZmNjY2OTZjNjU3NDczNjU1YzcwMmU2MjY5NjQ2ZjZlMD
58 AiAAIAAQBDAHQAeABJAG4AaQB0AGkAYQBsAFAAcgBvAGcAcgBhAG0AMDAiAAIAAQBDAHQA
59 eABDAGEAbABsAGIAYQBjAGsATgB1AG0AYgBlAHIAMDA=
64 add_userparameters1
() {
65 if [ x
$RELEASE = x
"release-4-1-0rc3" ]; then
66 $ldbmodify -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
<<EOF
67 dn: cn=administrator,cn=users,dc=release-4-1-0rc3,dc=samba,dc=corp
69 replace: userParameters
70 userParameters: IAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAC
71 AAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAUAAQABoACAAB
72 AEMAdAB4AEMAZgBnAFAAcgBlAHMAZQBuAHQANTUxZTBiYjAYAAgAAQBDAHQAeABDAGYAZw
73 BGAGwAYQBnAHMAMQAwMGUwMDAxMBYACAAB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n: cn=krbtgt,cn=users,dc=release-4-1-0rc3,dc=samba,dc=corp
96 replace: userParameters
97 userParameters:: Q3R4Q2ZnUHJlc2VudCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI
98 CAgUAsaCAFDdHhDZmdQcmVzZW5045S15pSx5oiw44GiIAIBQ3R4V0ZQcm9maWxlUGF0aOOAsBgCAU
99 N0eFdGSG9tZURpcuOAsCICAUN0eFdGSG9tZURpckRyaXZl44CwEggBQ3R4U2hhZG9344Sw44Cw44C
100 w44CwLggBQ3R4TWF4RGlzY29ubmVjdGlvblRpbWXjgaXjjLnjkLDjgLAoCAFDdHhNYXhDb25uZWN0
101 aW9uVGltZeOAtOOct+aIseOAsBwIAUN0eE1heElkbGVUaW1l44Gj45yy46Sw44CwIAIBQ3R4V29ya
102 0RpcmVjdG9yeeOAsBgIAUN0eENmZ0ZsYWdzMeOAsOOBpuOYsuOAuCICAUN0eEluaXRpYWxQcm9ncm
109 add_userparameters3
() {
110 if [ x
$RELEASE = x
"release-4-1-0rc3" ]; then
111 $ldbmodify -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
<<EOF
112 dn: cn=guest,cn=users,dc=release-4-1-0rc3,dc=samba,dc=corp
114 replace: userParameters
115 userParameters:: QwAAAHQAAAB4AAAAQwAAAGYAAABnAAAAUAAAAHIAAABlAAAAcwAAAGUAAABuA
116 AAAdAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAA
117 AgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAIAAAACA
118 AAAAgAAAAIAAAACAAAAAgAAAAIAAAACAAAAAgAAAAUAAAAAsAAAAaAAAACAAAAAEAAABDAAAAdAAA
119 AHgAAABDAAAAZgAAAGcAAABQAAAAcgAAAGUAAABzAAAAZQAAAG4AAAB0AAAANQA1ADEAZQAwAGIAY
120 gAwACAAAAACAAA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gAAAGkAAAB0AAAAaQAAAGE
134 AAABsAAAAUAAAAHIAAABvAAAAZwAAAHIAAABhAAAAbQAAADAAMAA=
141 $PYTHON $BINDIR/samba-tool dbcheck
--reindex -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb $@
144 check_expected_before_values
() {
145 if [ x
$RELEASE = x
"release-4-1-0rc3" ]; then
146 tmpldif
=$PREFIX_ABS/$RELEASE/expected-replpropertymetadata-before-dbcheck.ldif.tmp
147 TZ
=UTC
$ldbsearch -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
-s base
-b CN
=ops_run_anything
,OU
=SUDOers
,DC
=release-4-1-0rc3
,DC
=samba
,DC
=corp \
* replpropertymetadata
--show-binary > $tmpldif
148 diff $tmpldif $release_dir/expected-replpropertymetadata-before-dbcheck.ldif
149 if [ "$?" != "0" ]; then
156 # This should 'fail', because it returns the number of modified records
158 $PYTHON $BINDIR/samba-tool dbcheck
--cross-ncs --fix --yes -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb $@
161 check_expected_after_values
() {
162 if [ x
$RELEASE = x
"release-4-1-0rc3" ]; then
163 tmpldif
=$PREFIX_ABS/$RELEASE/expected-replpropertymetadata-after-dbcheck.ldif.tmp
164 TZ
=UTC
$ldbsearch -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
-s base
-b CN
=ops_run_anything
,OU
=SUDOers
,DC
=release-4-1-0rc3
,DC
=samba
,DC
=corp \
* replpropertymetadata
--show-binary > $tmpldif
165 diff -u $tmpldif $release_dir/expected-replpropertymetadata-after-dbcheck.ldif
166 if [ "$?" != "0" ]; then
173 # But having fixed it all up, this should pass
175 $PYTHON $BINDIR/samba-tool dbcheck
--cross-ncs -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb $@
178 # This should 'fail', because it returns the number of modified records.
179 # We don't need to run this against 4.1 releases
180 dbcheck_acl_reset
() {
181 if [ x
$RELEASE = x
"release-4-0-0" -o x
$RELEASE = x
"alpha13" ]; then
182 $PYTHON $BINDIR/samba-tool dbcheck
--reset-well-known-acls --cross-ncs --fix --yes -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb $@
187 # But having fixed it all up, this should pass.
188 # We don't need to run this against 4.1.0rc3
189 dbcheck_acl_reset_clean
() {
190 if [ x
$RELEASE != x
"release-4-1-0rc3" ]; then
191 $PYTHON $BINDIR/samba-tool dbcheck
--reset-well-known-acls --cross-ncs -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb $@
195 # This should 'fail', because it returns the number of modified records
197 if [ x
$RELEASE = x
"release-4-1-0rc3" ]; then
198 $PYTHON $BINDIR/samba-tool dbcheck
--cross-ncs --fix --yes -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb $@
203 # But having fixed it all up, this should pass
205 if [ x
$RELEASE = x
"release-4-1-0rc3" ]; then
206 $PYTHON $BINDIR/samba-tool dbcheck
--cross-ncs -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb $@
210 referenceprovision
() {
211 if [ x
$RELEASE == x
"release-4-0-0" ]; then
212 $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
217 if [ x
$RELEASE == x
"release-4-0-0" ]; then
218 $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
223 if [ x
$RELEASE == x
"release-4-0-0" ]; then
224 $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
228 if [ -d $release_dir ]; then
229 testit
$RELEASE undump
230 testit
"reindex" reindex
231 testit
"check_expected_before_values" check_expected_before_values
232 testit_expect_failure
"dbcheck" dbcheck
233 testit
"check_expected_after_values" check_expected_after_values
234 testit
"dbcheck_clean" dbcheck_clean
235 testit_expect_failure
"dbcheck_acl_reset" dbcheck_acl_reset
236 testit
"dbcheck_acl_reset_clean" dbcheck_acl_reset_clean
237 testit
"add_userparameters0" add_userparameters1
238 testit
"add_userparameters1" add_userparameters1
239 testit
"add_userparameters2" add_userparameters2
240 testit
"add_userparameters3" add_userparameters3
241 testit_expect_failure
"dbcheck2" dbcheck2
242 testit
"dbcheck_clean2" dbcheck_clean2
243 testit
"referenceprovision" referenceprovision
244 testit
"ldapcmp" ldapcmp
245 testit
"ldapcmp_sd" ldapcmp_sd
247 subunit_start_test
$RELEASE
248 subunit_skip_test
$RELEASE <<EOF
252 subunit_start_test
"reindex"
253 subunit_skip_test
"reindex" <<EOF
256 subunit_start_test check_expected_before_values
257 subunit_skip_test check_expected_before_values
<<EOF
260 subunit_start_test
"dbcheck"
261 subunit_skip_test
"dbcheck" <<EOF
264 subunit_start_test
"dbcheck_clean"
265 subunit_skip_test
"dbcheck_clean" <<EOF
268 subunit_start_test check_expected_after_values
269 subunit_skip_test check_expected_after_values
<<EOF
272 subunit_start_test
"dbcheck_acl_reset"
273 subunit_skip_test
"dbcheck_acl_reset" <<EOF
276 subunit_start_test
"dbcheck_clean_acl_reset"
277 subunit_skip_test
"dbcheck_clean_acl_reset" <<EOF
280 subunit_start_test add_userparameters0
281 subunit_skip_test add_userparameters0
<<EOF
285 subunit_start_test add_userparameters1
286 subunit_skip_test add_userparameters1
<<EOF
290 subunit_start_test add_userparameters2
291 subunit_skip_test add_userparameters2
<<EOF
295 subunit_start_test add_userparameters3
296 subunit_skip_test add_userparameters3
<<EOF
300 subunit_start_test check_expected_before_values
301 subunit_skip_test check_expected_before_values
<<EOF
305 subunit_start_test
"dbcheck2"
306 subunit_skip_test
"dbcheck2" <<EOF
310 subunit_start_test
"referenceprovision"
311 subunit_skip_test
"referenceprovision" <<EOF
314 subunit_start_test
"ldapcmp"
315 subunit_skip_test
"ldapcmp" <<EOF
318 subunit_start_test
"ldapcmp_sd"
319 subunit_skip_test
"ldapcmp_sd" <<EOF
324 if [ -d $PREFIX_ABS/${RELEASE} ]; then
325 rm -fr $PREFIX_ABS/${RELEASE}
328 if [ -d $PREFIX_ABS/${RELEASE}_reference
]; then
329 rm -fr $PREFIX_ABS/${RELEASE}_reference