5 Usage: dbcheck-links.sh PREFIX RELEASE
14 .
`dirname $0`/subunit.sh
16 .
`dirname $0`/common-links.sh
19 tmpfile
=$PREFIX_ABS/$RELEASE/expected-dbcheck-link-output
${1}.txt.tmp
20 tmpldif1
=$PREFIX_ABS/$RELEASE/expected-dbcheck-output
${1}2.txt.tmp1
22 TZ
=UTC
$ldbsearch -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
-s base
-b '' |
grep highestCommittedUSN
> $tmpldif1
24 $PYTHON $BINDIR/samba-tool dbcheck
-H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
$3 --fix --yes > $tmpfile
25 if [ "$?" != "$2" ]; then
28 sort $tmpfile > $tmpfile.sorted
29 sort $release_dir/expected-dbcheck-link-output
${1}.txt
> $tmpfile.expected
30 diff -u $tmpfile.sorted
$tmpfile.expected
31 if [ "$?" != "0" ]; then
35 tmpldif2
=$PREFIX_ABS/$RELEASE/expected-dbcheck-output
${1}2.txt.tmp2
36 TZ
=UTC
$ldbsearch -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
-s base
-b '' |
grep highestCommittedUSN
> $tmpldif2
38 diff -u $tmpldif1 $tmpldif2
39 if [ "$?" != "0" ]; then
45 dbcheck
"" "1" "--selftest-check-expired-tombstones"
50 dbcheck
"_one_way" "0" "CN=Configuration,DC=release-4-5-0-pre1,DC=samba,DC=corp --selftest-check-expired-tombstones"
55 tmpldif1
=$PREFIX_ABS/$RELEASE/expected-dbcheck-output2.txt.tmp1
57 TZ
=UTC
$ldbsearch -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
-s base
-b '' |
grep highestCommittedUSN
> $tmpldif1
59 $PYTHON $BINDIR/samba-tool dbcheck
-H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
60 if [ "$?" != "0" ]; then
63 tmpldif2
=$PREFIX_ABS/$RELEASE/expected-dbcheck-output2.txt.tmp2
64 TZ
=UTC
$ldbsearch -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
-s base
-b '' |
grep highestCommittedUSN
> $tmpldif2
66 diff $tmpldif1 $tmpldif2
67 if [ "$?" != "0" ]; then
72 check_expected_after_links
() {
73 tmpldif
=$PREFIX_ABS/$RELEASE/expected-links-after-link-dbcheck.ldif.tmp
74 TZ
=UTC
$ldbsearch -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
'(|(cn=swimmers)(cn=leaders)(cn=helpers))' -s sub
-b DC
=release-4-5-0-pre1
,DC
=samba
,DC
=corp
--show-deleted --sorted member
> $tmpldif
75 diff $tmpldif $release_dir/expected-links-after-link-dbcheck.ldif
76 if [ "$?" != "0" ]; then
81 check_expected_after_deleted_links
() {
82 tmpldif
=$PREFIX_ABS/$RELEASE/expected-deleted-links-after-link-dbcheck.ldif.tmp
83 TZ
=UTC
$ldbsearch -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
'(|(cn=swimmers)(cn=leaders)(cn=helpers))' -s sub
-b DC
=release-4-5-0-pre1
,DC
=samba
,DC
=corp
--show-deleted --reveal --sorted member
> $tmpldif
84 diff $tmpldif $release_dir/expected-deleted-links-after-link-dbcheck.ldif
85 if [ "$?" != "0" ]; then
90 check_expected_after_objects
() {
91 tmpldif
=$PREFIX_ABS/$RELEASE/expected-objects-after-link-dbcheck.ldif.tmp
92 TZ
=UTC
$ldbsearch -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
'(|(samaccountname=fred)(samaccountname=ddg)(samaccountname=usg)(samaccountname=user1)(samaccountname=user1x)(samaccountname=user2))' -s sub
-b DC
=release-4-5-0-pre1
,DC
=samba
,DC
=corp
--show-deleted --reveal --sorted samAccountName |
grep sAMAccountName
> $tmpldif
93 diff $tmpldif $release_dir/expected-objects-after-link-dbcheck.ldif
94 if [ "$?" != "0" ]; then
100 # We use an exisiting group so we have a stable GUID in the
102 LDIF1
=$
(TZ
=UTC
$ldbsearch -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
-b 'CN=Enterprise Admins,CN=users,DC=release-4-5-0-pre1,DC=samba,DC=corp' -s base
--reveal --extended-dn member
)
103 DN
=$
(echo "${LDIF1}" |
grep '^dn: ')
104 MSG
=$
(echo "${LDIF1}" |
grep -v '^dn: ' |
grep -v '^#' |
grep -v '^$')
105 ldif
=$PREFIX_ABS/${RELEASE}/duplicate-member-multi.ldif
108 echo "changetype: modify"
109 echo "replace: member"
111 echo "${MSG}" |
sed -e 's!RMD_LOCAL_USN=[1-9][0-9]*!RMD_LOCAL_USN=0!'
114 TZ
=UTC
$ldbmodify -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb.d
/DC
%3DRELEASE-4-5-0-PRE1
,DC
%3DSAMBA
,DC
%3DCORP.ldb
$ldif
115 if [ "$?" != "0" ]; then
120 dbcheck_duplicate_member
() {
121 dbcheck
"_duplicate_member" "1" "--selftest-check-expired-tombstones"
125 check_expected_after_duplicate_links
() {
126 tmpldif
=$PREFIX_ABS/$RELEASE/expected-duplicates-after-link-dbcheck.ldif.tmp
127 TZ
=UTC
$ldbsearch -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
'(|(cn=administrator)(cn=enterprise admins))' -s sub
-b DC
=release-4-5-0-pre1
,DC
=samba
,DC
=corp
--show-deleted --sorted memberOf member
> $tmpldif
128 diff $tmpldif $release_dir/expected-duplicates-after-link-dbcheck.ldif
129 if [ "$?" != "0" ]; then
134 missing_link_sid_corruption
() {
135 # Step1: add user "missingsidu1"
137 ldif
=$PREFIX_ABS/${RELEASE}/missing_link_sid_corruption1.ldif
139 dn: CN=missingsidu1,CN=users,DC=release-4-5-0-pre1,DC=samba,DC=corp
142 samaccountname: missingsidu1
143 objectGUID: 0da8f25e-d110-11e8-80b7-3c970ec68461
144 objectSid: S-1-5-21-4177067393-1453636373-93818738-771
147 out
=$
(TZ
=UTC
$ldbmodify -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
--relax $ldif)
148 if [ "$?" != "0" ]; then
149 echo "ldbmodify returned:\n$out"
153 # Step2: add user "missingsidu2"
155 ldif
=$PREFIX_ABS/${RELEASE}/missing_link_sid_corruption2.ldif
157 dn: CN=missingsidu2,CN=users,DC=release-4-5-0-pre1,DC=samba,DC=corp
160 samaccountname: missingsidu2
161 objectGUID: 66eb8f52-d110-11e8-ab9b-3c970ec68461
162 objectSid: S-1-5-21-4177067393-1453636373-93818738-772
165 out
=$
(TZ
=UTC
$ldbmodify -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
--relax $ldif)
166 if [ "$?" != "0" ]; then
167 echo "ldbmodify returned:\n$out"
171 # Step3: add group "missingsidg3" and add users as members
173 ldif
=$PREFIX_ABS/${RELEASE}/missing_link_sid_corruption3.ldif
175 dn: CN=missingsidg3,CN=users,DC=release-4-5-0-pre1,DC=samba,DC=corp
178 samaccountname: missingsidg3
179 objectGUID: fd992424-d114-11e8-bb36-3c970ec68461
180 objectSid: S-1-5-21-4177067393-1453636373-93818738-773
181 member: CN=missingsidu1,CN=users,DC=release-4-5-0-pre1,DC=samba,DC=corp
182 member: CN=missingsidu2,CN=users,DC=release-4-5-0-pre1,DC=samba,DC=corp
185 out
=$
(TZ
=UTC
$ldbmodify -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
--relax $ldif)
186 if [ "$?" != "0" ]; then
187 echo "ldbmodify returned:\n$out"
191 # Step4: remove one user again, so that we have one deleted link
193 ldif
=$PREFIX_ABS/${RELEASE}/missing_link_sid_corruption4.ldif
195 dn: CN=missingsidg3,CN=users,DC=release-4-5-0-pre1,DC=samba,DC=corp
198 member: CN=missingsidu1,CN=users,DC=release-4-5-0-pre1,DC=samba,DC=corp
201 out
=$
(TZ
=UTC
$ldbmodify -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
--relax $ldif)
202 if [ "$?" != "0" ]; then
203 echo "ldbmodify returned:\n$out"
208 # Step5: remove the SIDS from the links
210 LDIF1
=$
(TZ
=UTC
$ldbsearch -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
-b 'CN=missingsidg3,CN=users,DC=release-4-5-0-pre1,DC=samba,DC=corp' -s base
--reveal --extended-dn --show-binary member
)
211 DN
=$
(echo "${LDIF1}" |
grep '^dn: ')
212 MSG
=$
(echo "${LDIF1}" |
grep -v '^dn: ' |
grep -v '^#' |
grep -v '^$')
213 ldif
=$PREFIX_ABS/${RELEASE}/missing_link_sid_corruption5.ldif
216 echo "changetype: modify"
217 echo "replace: member"
219 echo "${MSG}" |
sed \
220 -e 's!<SID=S-1-5-21-4177067393-1453636373-93818738-771>;!!g' \
221 -e 's!<SID=S-1-5-21-4177067393-1453636373-93818738-772>;!!g' \
222 -e 's!RMD_ADDTIME=[1-9][0-9]*!RMD_ADDTIME=123456789000000000!g' \
223 -e 's!RMD_CHANGETIME=[1-9][0-9]*!RMD_CHANGETIME=123456789000000000!g' \
227 out
=$
(TZ
=UTC
$ldbmodify -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb.d
/DC
%3DRELEASE-4-5-0-PRE1
,DC
%3DSAMBA
,DC
%3DCORP.ldb
$ldif)
228 if [ "$?" != "0" ]; then
229 echo "ldbmodify returned:\n$out"
236 dbcheck_missing_link_sid_corruption
() {
237 dbcheck
"-missing-link-sid-corruption" "1" "--selftest-check-expired-tombstones"
241 add_lost_deleted_user1
() {
242 ldif
=$PREFIX_ABS/${RELEASE}/add_lost_deleted_user1.ldif
244 dn: CN=fred\0ADEL:2301a64c-1234-5678-851e-12d4a711cfb4,OU=removed,DC=release-4-5-0-pre1,DC=samba,DC=corp
247 objectClass: organizationalPerson
250 whenCreated: 20160629043638.0Z
252 objectGUID: 2301a64c-1234-5678-851e-12d4a711cfb4
253 objectSid: S-1-5-21-4177067393-1453636373-93818738-1011
255 userAccountControl: 512
257 lastKnownParent: <GUID=f28216e9-1234-5678-8b2d-6bb229563b62>;OU=removed,DC=rel
258 ease-4-5-0-pre1,DC=samba,DC=corp
260 cn:: ZnJlZApERUw6MjMwMWE2NGMtMTIzNC01Njc4LTg1MWUtMTJkNGE3MTFjZmI0
261 name:: ZnJlZApERUw6MjMwMWE2NGMtMTIzNC01Njc4LTg1MWUtMTJkNGE3MTFjZmI0
262 replPropertyMetaData:: AQAAAAAAAAAXAAAAAAAAAAAAAAABAAAAVuGDDQMAAACjlkROuH+XT4o
263 z0jjbi14tnA4AAAAAAACcDgAAAAAAAAMAAAACAAAAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4A
264 AAAAAACiDgAAAAAAAAEAAgABAAAAVuGDDQMAAACjlkROuH+XT4oz0jjbi14tnA4AAAAAAACcDgAAA
265 AAAAAIAAgABAAAAVuGDDQMAAACjlkROuH+XT4oz0jjbi14tnA4AAAAAAACcDgAAAAAAADAAAgABAA
266 AAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAAAAACiDgAAAAAAABkBAgABAAAAVuGDDQMAAAC
267 jlkROuH+XT4oz0jjbi14tnA4AAAAAAACcDgAAAAAAAAEACQACAAAAV+GDDQMAAACjlkROuH+XT4oz
268 0jjbi14tog4AAAAAAACiDgAAAAAAAAgACQADAAAAVuGDDQMAAACjlkROuH+XT4oz0jjbi14tng4AA
269 AAAAACeDgAAAAAAABAACQACAAAAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAAAAACiDgAAAA
270 AAABkACQACAAAAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAAAAACiDgAAAAAAAFoACQABAAA
271 AVuGDDQMAAACjlkROuH+XT4oz0jjbi14tnQ4AAAAAAACdDgAAAAAAAF4ACQABAAAAVuGDDQMAAACj
272 lkROuH+XT4oz0jjbi14tnQ4AAAAAAACdDgAAAAAAAGAACQADAAAAV+GDDQMAAACjlkROuH+XT4oz0
273 jjbi14tog4AAAAAAACiDgAAAAAAAGIACQACAAAAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAA
274 AAAACiDgAAAAAAAH0ACQABAAAAVuGDDQMAAACjlkROuH+XT4oz0jjbi14tnQ4AAAAAAACdDgAAAAA
275 AAJIACQABAAAAVuGDDQMAAACjlkROuH+XT4oz0jjbi14tnA4AAAAAAACcDgAAAAAAAJ8ACQACAAAA
276 V+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAAAAACiDgAAAAAAAN0ACQABAAAAVuGDDQMAAACjl
277 kROuH+XT4oz0jjbi14tnA4AAAAAAACcDgAAAAAAAC4BCQACAAAAV+GDDQMAAACjlkROuH+XT4oz0j
278 jbi14tog4AAAAAAACiDgAAAAAAAJACCQACAAAAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAA
279 AAACiDgAAAAAAAA0DCQABAAAAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAAAAACiDgAAAAAA
280 AA4DCQACAAAAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAAAAACiDgAAAAAAAAoICQABAAAAV
281 +GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAAAAACiDgAAAAAAAA==
282 whenChanged: 20160629043639.0Z
284 nTSecurityDescriptor:: AQAXjBQAAAAwAAAATAAAAMQAAAABBQAAAAAABRUAAACB/fj4FbukVnK
285 PlwUAAgAAAQUAAAAAAAUVAAAAgf34+BW7pFZyj5cFAAIAAAQAeAACAAAAB1o4ACAAAAADAAAAvjsO
286 8/Cf0RG2AwAA+ANnwaV6lr/mDdARooUAqgAwSeIBAQAAAAAAAQAAAAAHWjgAIAAAAAMAAAC/Ow7z8
287 J/REbYDAAD4A2fBpXqWv+YN0BGihQCqADBJ4gEBAAAAAAABAAAAAAQA1AcsAAAAAAAkAP8BDwABBQ
288 AAAAAABRUAAACB/fj4FbukVnKPlwUAAgAAAAAUAP8BDwABAQAAAAAABRIAAAAAABgA/wEPAAECAAA
289 AAAAFIAAAACQCAAAAABQAlAACAAEBAAAAAAAFCgAAAAUAKAAAAQAAAQAAAFMacqsvHtARmBkAqgBA
290 UpsBAQAAAAAABQoAAAAFACgAAAEAAA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KFAKoAMEniAQEAAAAAAAUJAAAABRos
318 AJQAAgACAAAAFMwoSDcUvEWbB61vAV5fKAECAAAAAAAFIAAAACoCAAAFGiwAlAACAAIAAACcepa/5
319 g3QEaKFAKoAMEniAQIAAAAAAAUgAAAAKgIAAAUSLACUAAIAAgAAALp6lr/mDdARooUAqgAwSeIBAg
320 AAAAAABSAAAAAqAgAABRIoADABAAABAAAA3kfmkW/ZcEuVV9Y/9PPM2AEBAAAAAAAFCgAAAAASJAD
321 /AQ8AAQUAAAAAAAUVAAAAgf34+BW7pFZyj5cFBwIAAAASGAAEAAAAAQIAAAAAAAUgAAAAKgIAAAAS
322 GAC9AQ8AAQIAAAAAAAUgAAAAIAIAAA==
325 out
=$
(TZ
=UTC
$ldbadd -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb.d
/DC
%3DRELEASE-4-5-0-PRE1
,DC
%3DSAMBA
,DC
%3DCORP.ldb
$ldif)
326 if [ "$?" != "0" ]; then
327 echo "ldbadd returned:\n$out"
334 dbcheck_lost_deleted_user1
() {
335 dbcheck
"-lost-deleted-user1" "1" "--selftest-check-expired-tombstones"
339 remove_lost_deleted_user1
() {
340 out
=$
(TZ
=UTC
$ldbdel -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
"<GUID=2301a64c-1234-5678-851e-12d4a711cfb4>" --show-recycled --relax)
341 if [ "$?" != "0" ]; then
342 echo "ldbdel returned:\n$out"
349 add_lost_deleted_user2
() {
350 ldif
=$PREFIX_ABS/${RELEASE}/add_lost_deleted_user2.ldif
352 dn: CN=fred\0ADEL:2301a64c-8765-4321-851e-12d4a711cfb4,CN=LostAndFound,DC=release-4-5-0-pre1,DC=samba,DC=corp
355 objectClass: organizationalPerson
358 whenCreated: 20160629043638.0Z
360 objectGUID: 2301a64c-8765-4321-851e-12d4a711cfb4
361 objectSid: S-1-5-21-4177067393-1453636373-93818738-1001
363 userAccountControl: 512
365 lastKnownParent: OU=removed,DC=release-4-5-0-pre1,DC=samba,DC=corp
367 cn:: ZnJlZApERUw6MjMwMWE2NGMtODc2NS00MzIxLTg1MWUtMTJkNGE3MTFjZmI0
368 name:: ZnJlZApERUw6MjMwMWE2NGMtODc2NS00MzIxLTg1MWUtMTJkNGE3MTFjZmI0
369 replPropertyMetaData:: AQAAAAAAAAAXAAAAAAAAAAAAAAABAAAAVuGDDQMAAACjlkROuH+XT4o
370 z0jjbi14tnA4AAAAAAACcDgAAAAAAAAMAAAACAAAAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4A
371 AAAAAACiDgAAAAAAAAEAAgABAAAAVuGDDQMAAACjlkROuH+XT4oz0jjbi14tnA4AAAAAAACcDgAAA
372 AAAAAIAAgABAAAAVuGDDQMAAACjlkROuH+XT4oz0jjbi14tnA4AAAAAAACcDgAAAAAAADAAAgABAA
373 AAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAAAAACiDgAAAAAAABkBAgABAAAAVuGDDQMAAAC
374 jlkROuH+XT4oz0jjbi14tnA4AAAAAAACcDgAAAAAAAAEACQAEAAAAePOWEgMAAACjlkROuH+XT4oz
375 0jjbi14tvA4AAAAAAAC8DgAAAAAAAAgACQADAAAAVuGDDQMAAACjlkROuH+XT4oz0jjbi14tng4AA
376 AAAAACeDgAAAAAAABAACQACAAAAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAAAAACiDgAAAA
377 AAABkACQACAAAAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAAAAACiDgAAAAAAAFoACQABAAA
378 AVuGDDQMAAACjlkROuH+XT4oz0jjbi14tnQ4AAAAAAACdDgAAAAAAAF4ACQABAAAAVuGDDQMAAACj
379 lkROuH+XT4oz0jjbi14tnQ4AAAAAAACdDgAAAAAAAGAACQADAAAAV+GDDQMAAACjlkROuH+XT4oz0
380 jjbi14tog4AAAAAAACiDgAAAAAAAGIACQACAAAAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAA
381 AAAACiDgAAAAAAAH0ACQABAAAAVuGDDQMAAACjlkROuH+XT4oz0jjbi14tnQ4AAAAAAACdDgAAAAA
382 AAJIACQABAAAAVuGDDQMAAACjlkROuH+XT4oz0jjbi14tnA4AAAAAAACcDgAAAAAAAJ8ACQACAAAA
383 V+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAAAAACiDgAAAAAAAN0ACQABAAAAVuGDDQMAAACjl
384 kROuH+XT4oz0jjbi14tnA4AAAAAAACcDgAAAAAAAC4BCQACAAAAV+GDDQMAAACjlkROuH+XT4oz0j
385 jbi14tog4AAAAAAACiDgAAAAAAAJACCQACAAAAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAA
386 AAACiDgAAAAAAAA0DCQADAAAAePOWEgMAAACjlkROuH+XT4oz0jjbi14tvQ4AAAAAAAC9DgAAAAAA
387 AA4DCQACAAAAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAAAAACiDgAAAAAAAAoICQABAAAAV
388 +GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAAAAACiDgAAAAAAAA==
389 whenChanged: 20160629043639.0Z
391 nTSecurityDescriptor:: AQAXjBQAAAAwAAAATAAAAMQAAAABBQAAAAAABRUAAACB/fj4FbukVnK
392 PlwUAAgAAAQUAAAAAAAUVAAAAgf34+BW7pFZyj5cFAAIAAAQAeAACAAAAB1o4ACAAAAADAAAAvjsO
393 8/Cf0RG2AwAA+ANnwaV6lr/mDdARooUAqgAwSeIBAQAAAAAAAQAAAAAHWjgAIAAAAAMAAAC/Ow7z8
394 J/REbYDAAD4A2fBpXqWv+YN0BGihQCqADBJ4gEBAAAAAAABAAAAAAQA1AcsAAAAAAAkAP8BDwABBQ
395 AAAAAABRUAAACB/fj4FbukVnKPlwUAAgAAAAAUAP8BDwABAQAAAAAABRIAAAAAABgA/wEPAAECAAA
396 AAAAFIAAAACQCAAAAABQAlAACAAEBAAAAAAAFCgAAAAUAKAAAAQAAAQAAAFMacqsvHtARmBkAqgBA
397 UpsBAQAAAAA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oMmD9gi6epa/5g3QEaKFAKoAMEniAQEAAAAAAAUJAAAABRos
425 AJQAAgACAAAAFMwoSDcUvEWbB61vAV5fKAECAAAAAAAFIAAAACoCAAAFGiwAlAACAAIAAACcepa/5
426 g3QEaKFAKoAMEniAQIAAAAAAAUgAAAAKgIAAAUSLACUAAIAAgAAALp6lr/mDdARooUAqgAwSeIBAg
427 AAAAAABSAAAAAqAgAABRIoADABAAABAAAA3kfmkW/ZcEuVV9Y/9PPM2AEBAAAAAAAFCgAAAAASJAD
428 /AQ8AAQUAAAAAAAUVAAAAgf34+BW7pFZyj5cFBwIAAAASGAAEAAAAAQIAAAAAAAUgAAAAKgIAAAAS
429 GAC9AQ8AAQIAAAAAAAUgAAAAIAIAAA==
432 out
=$
(TZ
=UTC
$ldbadd -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb.d
/DC
%3DRELEASE-4-5-0-PRE1
,DC
%3DSAMBA
,DC
%3DCORP.ldb
$ldif)
433 if [ "$?" != "0" ]; then
434 echo "ldbadd returned:\n$out"
441 dbcheck_lost_deleted_user2
() {
442 dbcheck
"-lost-deleted-user2" "1" "--selftest-check-expired-tombstones"
446 add_lost_deleted_user3
() {
447 ldif
=$PREFIX_ABS/${RELEASE}/add_lost_deleted_user3.ldif
449 dn: CN=fred\0ADEL:2301a64c-1122-5566-851e-12d4a711cfb4,OU=removed,DC=release-4-5-0-pre1,DC=samba,DC=corp
452 objectClass: organizationalPerson
455 whenCreated: 20160629043638.0Z
457 objectGUID: 2301a64c-1122-5566-851e-12d4a711cfb4
458 objectSid: S-1-5-21-4177067393-1453636373-93818738-1010
460 userAccountControl: 512
462 lastKnownParent: <GUID=f28216e9-1234-5678-8b2d-6bb229563b62>;OU=removed,DC=rel
463 ease-4-5-0-pre1,DC=samba,DC=corp
465 cn:: ZnJlZApERUw6MjMwMWE2NGMtMTEyMi01NTY2LTg1MWUtMTJkNGE3MTFjZmI0
466 name:: ZnJlZApERUw6MjMwMWE2NGMtMTEyMi01NTY2LTg1MWUtMTJkNGE3MTFjZmI0
467 replPropertyMetaData:: AQAAAAAAAAAXAAAAAAAAAAAAAAABAAAAVuGDDQMAAACjlkROuH+XT4o
468 z0jjbi14tnA4AAAAAAACcDgAAAAAAAAMAAAACAAAAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4A
469 AAAAAACiDgAAAAAAAAEAAgABAAAAVuGDDQMAAACjlkROuH+XT4oz0jjbi14tnA4AAAAAAACcDgAAA
470 AAAAAIAAgABAAAAVuGDDQMAAACjlkROuH+XT4oz0jjbi14tnA4AAAAAAACcDgAAAAAAADAAAgABAA
471 AAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAAAAACiDgAAAAAAABkBAgABAAAAVuGDDQMAAAC
472 jlkROuH+XT4oz0jjbi14tnA4AAAAAAACcDgAAAAAAAAEACQACAAAAV+GDDQMAAACjlkROuH+XT4oz
473 0jjbi14tog4AAAAAAACiDgAAAAAAAAgACQADAAAAVuGDDQMAAACjlkROuH+XT4oz0jjbi14tng4AA
474 AAAAACeDgAAAAAAABAACQACAAAAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAAAAACiDgAAAA
475 AAABkACQACAAAAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAAAAACiDgAAAAAAAFoACQABAAA
476 AVuGDDQMAAACjlkROuH+XT4oz0jjbi14tnQ4AAAAAAACdDgAAAAAAAF4ACQABAAAAVuGDDQMAAACj
477 lkROuH+XT4oz0jjbi14tnQ4AAAAAAACdDgAAAAAAAGAACQADAAAAV+GDDQMAAACjlkROuH+XT4oz0
478 jjbi14tog4AAAAAAACiDgAAAAAAAGIACQACAAAAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAA
479 AAAACiDgAAAAAAAH0ACQABAAAAVuGDDQMAAACjlkROuH+XT4oz0jjbi14tnQ4AAAAAAACdDgAAAAA
480 AAJIACQABAAAAVuGDDQMAAACjlkROuH+XT4oz0jjbi14tnA4AAAAAAACcDgAAAAAAAJ8ACQACAAAA
481 V+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAAAAACiDgAAAAAAAN0ACQABAAAAVuGDDQMAAACjl
482 kROuH+XT4oz0jjbi14tnA4AAAAAAACcDgAAAAAAAC4BCQACAAAAV+GDDQMAAACjlkROuH+XT4oz0j
483 jbi14tog4AAAAAAACiDgAAAAAAAJACCQACAAAAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAA
484 AAACiDgAAAAAAAA0DCQABAAAAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAAAAACiDgAAAAAA
485 AA4DCQACAAAAV+GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAAAAACiDgAAAAAAAAoICQABAAAAV
486 +GDDQMAAACjlkROuH+XT4oz0jjbi14tog4AAAAAAACiDgAAAAAAAA==
487 whenChanged: 20160629043639.0Z
489 nTSecurityDescriptor:: AQAXjBQAAAAwAAAATAAAAMQAAAABBQAAAAAABRUAAACB/fj4FbukVnK
490 PlwUAAgAAAQUAAAAAAAUVAAAAgf34+BW7pFZyj5cFAAIAAAQAeAACAAAAB1o4ACAAAAADAAAAvjsO
491 8/Cf0RG2AwAA+ANnwaV6lr/mDdARooUAqgAwSeIBAQAAAAAAAQAAAAAHWjgAIAAAAAMAAAC/Ow7z8
492 J/REbYDAAD4A2fBpXqWv+YN0BGihQCqADBJ4gEBAAAAAAABAAAAAAQA1AcsAAAAAAAkAP8BDwABBQ
493 AAAAAABRUAAACB/fj4FbukVnKPlwUAAgAAAAAUAP8BDwABAQAAAAAABRIAAAAAABgA/wEPAAECAAA
494 AAAAFIAAAACQCAAAAABQAlAACAAEBAAAAAAAFCgAAAAUAKAAAAQAAAQAAAFMacqsvHtARmBkAqgBA
495 UpsBAQAAAAAABQoAAAAFACgAAAEAAAEAAABUGnKrLx7QEZgZAKoAQFKbAQEAAAAAAAUKAAAABQAoA
496 AABAAABAAAAVhpyqy8e0BGYGQCqAEBSmwEBAAAAAAAFCgA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AAACcepa/5
524 g3QEaKFAKoAMEniAQIAAAAAAAUgAAAAKgIAAAUSLACUAAIAAgAAALp6lr/mDdARooUAqgAwSeIBAg
525 AAAAAABSAAAAAqAgAABRIoADABAAABAAAA3kfmkW/ZcEuVV9Y/9PPM2AEBAAAAAAAFCgAAAAASJAD
526 /AQ8AAQUAAAAAAAUVAAAAgf34+BW7pFZyj5cFBwIAAAASGAAEAAAAAQIAAAAAAAUgAAAAKgIAAAAS
527 GAC9AQ8AAQIAAAAAAAUgAAAAIAIAAA==
530 out
=$
(TZ
=UTC
$ldbadd -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb.d
/DC
%3DRELEASE-4-5-0-PRE1
,DC
%3DSAMBA
,DC
%3DCORP.ldb
$ldif)
531 if [ "$?" != "0" ]; then
532 echo "ldbadd returned:\n$out"
539 dbcheck_lost_deleted_user3
() {
540 # here we don't pass --selftest-check-expired-tombstones
541 # as we want to test the default
542 dbcheck
"-lost-deleted-user3" "0" ""
546 remove_lost_deleted_user3
() {
547 out
=$
(TZ
=UTC
$ldbdel -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
"<GUID=2301a64c-1122-5566-851e-12d4a711cfb4>" --show-recycled --relax)
548 if [ "$?" != "0" ]; then
549 echo "ldbdel returned:\n$out"
556 forward_link_corruption
() {
558 # Step1: add a duplicate forward link from
559 # "CN=Enterprise Admins" to "CN=Administrator"
561 LDIF1
=$
(TZ
=UTC
$ldbsearch -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
-b 'CN=Enterprise Admins,CN=users,DC=release-4-5-0-pre1,DC=samba,DC=corp' -s base
--reveal --extended-dn member
)
562 DN
=$
(echo "${LDIF1}" |
grep '^dn: ')
563 MSG
=$
(echo "${LDIF1}" |
grep -v '^dn: ' |
grep -v '^#' |
grep -v '^$')
564 ldif
=$PREFIX_ABS/${RELEASE}/forward_link_corruption1.ldif
567 echo "changetype: modify"
568 echo "replace: member"
570 echo "${MSG}" |
sed -e 's!RMD_LOCAL_USN=[1-9][0-9]*!RMD_LOCAL_USN=0!'
573 out
=$
(TZ
=UTC
$ldbmodify -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb.d
/DC
%3DRELEASE-4-5-0-PRE1
,DC
%3DSAMBA
,DC
%3DCORP.ldb
$ldif)
574 if [ "$?" != "0" ]; then
575 echo "ldbmodify returned:\n$out"
580 # Step2: add user "dangling"
582 ldif
=$PREFIX_ABS/${RELEASE}/forward_link_corruption2.ldif
584 dn: CN=dangling,CN=users,DC=release-4-5-0-pre1,DC=samba,DC=corp
587 samaccountname: dangling
588 objectGUID: fd8a04ac-cea0-4921-b1a6-c173e1155c22
591 out
=$
(TZ
=UTC
$ldbmodify -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
--relax $ldif)
592 if [ "$?" != "0" ]; then
593 echo "ldbmodify returned:\n$out"
598 # Step3: add a dangling backlink from
599 # "CN=dangling" to "CN=Enterprise Admins"
601 ldif
=$PREFIX_ABS/${RELEASE}/forward_link_corruption3.ldif
603 echo "dn: CN=dangling,CN=users,DC=release-4-5-0-pre1,DC=samba,DC=corp"
604 echo "changetype: modify"
606 echo "memberOf: <GUID=304ad703-468b-465e-9787-470b3dfd7d75>;<SID=S-1-5-21-4177067393-1453636373-93818738-519>;CN=Enterprise Admins,CN=Users,DC=release-4-5-0-pre1,DC=samba,DC=corp"
609 out
=$
(TZ
=UTC
$ldbmodify -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb.d
/DC
%3DRELEASE-4-5-0-PRE1
,DC
%3DSAMBA
,DC
%3DCORP.ldb
$ldif)
610 if [ "$?" != "0" ]; then
611 echo "ldbmodify returned:\n$out"
616 dbcheck_forward_link_corruption
() {
617 dbcheck
"-forward-link-corruption" "1" "--selftest-check-expired-tombstones"
621 check_expected_after_dbcheck_forward_link_corruption
() {
622 tmpldif
=$PREFIX_ABS/$RELEASE/expected-after-dbcheck-forward-link-corruption.ldif.tmp
623 TZ
=UTC
$ldbsearch -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
'(|(cn=dangling)(cn=enterprise admins))' -s sub
-b DC
=release-4-5-0-pre1
,DC
=samba
,DC
=corp
--show-deleted --sorted memberOf member
> $tmpldif
624 diff $tmpldif $release_dir/expected-after-dbcheck-forward-link-corruption.ldif
625 if [ "$?" != "0" ]; then
630 oneway_link_corruption
() {
632 # Step1: add OU "dangling-ou"
634 ldif
=$PREFIX_ABS/${RELEASE}/oneway_link_corruption.ldif
636 dn: OU=dangling-ou,DC=release-4-5-0-pre1,DC=samba,DC=corp
638 objectclass: organizationalUnit
639 objectGUID: 20600e7c-92bb-492e-9552-f3ed7f8a2cad
642 out
=$
(TZ
=UTC
$ldbmodify -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
--relax $ldif)
643 if [ "$?" != "0" ]; then
644 echo "ldbmodify returned:\n$out"
649 # Step2: add msExchConfigurationContainer "dangling-msexch"
651 ldif
=$PREFIX_ABS/${RELEASE}/oneway_link_corruption2.ldif
653 dn: OU=dangling-from,DC=release-4-5-0-pre1,DC=samba,DC=corp
655 objectclass: organizationalUnit
656 seeAlso: OU=dangling-ou,DC=release-4-5-0-pre1,DC=samba,DC=corp
659 out
=$
(TZ
=UTC
$ldbmodify -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
$ldif)
660 if [ "$?" != "0" ]; then
661 echo "ldbmodify returned:\n$out"
666 # Step3: rename dangling-ou to dangling-ou2
668 # Because this is a one-way link we don't fix it at runtime
670 out
=$
(TZ
=UTC
$ldbrename -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb OU
=dangling-ou
,DC
=release-4-5-0-pre1
,DC
=samba
,DC
=corp OU
=dangling-ou2
,DC
=release-4-5-0-pre1
,DC
=samba
,DC
=corp
)
671 if [ "$?" != "0" ]; then
672 echo "ldbmodify returned:\n$out"
677 dbcheck_oneway_link_corruption
() {
678 dbcheck
"-oneway-link-corruption" "0" "--selftest-check-expired-tombstones"
682 check_expected_after_dbcheck_oneway_link_corruption
() {
683 tmpldif
=$PREFIX_ABS/$RELEASE/expected-after-dbcheck-oneway-link-corruption.ldif.tmp
684 TZ
=UTC
$ldbsearch -H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
'(|(ou=dangling-ou)(ou=dangling-ou2)(ou=dangling-from))' -s sub
-b DC
=release-4-5-0-pre1
,DC
=samba
,DC
=corp
--show-deleted --sorted seeAlso
> $tmpldif
685 diff $tmpldif $release_dir/expected-after-dbcheck-oneway-link-corruption.ldif
686 if [ "$?" != "0" ]; then
691 dbcheck_dangling_multi_valued
() {
693 $PYTHON $BINDIR/samba-tool dbcheck
-H tdb
://$PREFIX_ABS/${RELEASE}/private
/sam.ldb
--selftest-check-expired-tombstones --fix --yes
694 if [ "$?" != "1" ]; then
699 dangling_multi_valued_check_missing
() {
700 WORDS
=`TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb '(samaccountname=dangling-multi2)' -s sub -b DC=release-4-5-0-pre1,DC=samba,DC=corp --show-deleted --reveal --sorted msDS-RevealedDSAs | grep msDS-RevealedDSAs | wc -l`
701 if [ $WORDS -ne 4 ]; then
702 echo Got only
$WORDS links
for dangling-multi2
705 WORDS
=`TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb '(samaccountname=dangling-multi3)' -s sub -b DC=release-4-5-0-pre1,DC=samba,DC=corp --show-deleted --reveal --sorted msDS-RevealedDSAs | grep msDS-RevealedDSAs | wc -l`
706 if [ $WORDS -ne 4 ]; then
707 echo Got only
$WORDS links
for dangling-multi3
712 dangling_multi_valued_check_equal_or_too_many
() {
713 WORDS
=`TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb '(samaccountname=dangling-multi1)' -s sub -b DC=release-4-5-0-pre1,DC=samba,DC=corp --show-deleted --reveal --sorted msDS-RevealedDSAs | grep msDS-RevealedDSAs | wc -l`
714 if [ $WORDS -ne 4 ]; then
715 echo Got
$WORDS links
for dangling-multi1
719 WORDS
=`TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb '(samaccountname=dangling-multi5)' -s sub -b DC=release-4-5-0-pre1,DC=samba,DC=corp --show-deleted --reveal --sorted msDS-RevealedDSAs | grep msDS-RevealedDSAs | wc -l`
721 if [ $WORDS -ne 0 ]; then
722 echo Got
$WORDS links
for dangling-multi5
726 WORDS
=`TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb '(samaccountname=Administrator)' -s sub -b DC=release-4-5-0-pre1,DC=samba,DC=corp --show-deleted --reveal --sorted msDS-RevealedDSAs | grep msDS-RevealedDSAs | wc -l`
728 if [ $WORDS -ne 2 ]; then
729 echo Got
$WORDS links
for Administrator
735 if [ -d $release_dir ]; then
736 testit
$RELEASE undump
737 testit
"add_two_more_users" add_two_more_users
738 testit
"add_four_more_links" add_four_more_links
739 testit
"remove_one_link" remove_one_link
740 testit
"remove_one_user" remove_one_user
741 testit
"move_one_user" move_one_user
742 testit
"add_dangling_link" add_dangling_link
743 testit
"add_dangling_backlink" add_dangling_backlink
744 testit
"add_deleted_dangling_backlink" add_deleted_dangling_backlink
745 testit
"revive_links_on_deleted_group" revive_links_on_deleted_group
746 testit
"revive_backlink_on_deleted_group" revive_backlink_on_deleted_group
747 testit
"add_deleted_target_link" add_deleted_target_link
748 testit
"add_deleted_target_backlink" add_deleted_target_backlink
749 testit
"dbcheck_dangling" dbcheck_dangling
750 testit
"dbcheck_clean" dbcheck_clean
751 testit
"check_expected_after_deleted_links" check_expected_after_deleted_links
752 testit
"check_expected_after_links" check_expected_after_links
753 testit
"check_expected_after_objects" check_expected_after_objects
754 testit
"duplicate_member" duplicate_member
755 testit
"dbcheck_duplicate_member" dbcheck_duplicate_member
756 testit
"check_expected_after_duplicate_links" check_expected_after_duplicate_links
757 testit
"duplicate_clean" dbcheck_clean
758 testit
"forward_link_corruption" forward_link_corruption
759 testit
"dbcheck_forward_link_corruption" dbcheck_forward_link_corruption
760 testit
"check_expected_after_dbcheck_forward_link_corruption" check_expected_after_dbcheck_forward_link_corruption
761 testit
"forward_link_corruption_clean" dbcheck_clean
762 testit
"oneway_link_corruption" oneway_link_corruption
763 testit
"dbcheck_oneway_link_corruption" dbcheck_oneway_link_corruption
764 testit
"check_expected_after_dbcheck_oneway_link_corruption" check_expected_after_dbcheck_oneway_link_corruption
765 testit
"oneway_link_corruption_clean" dbcheck_clean
766 testit
"dangling_one_way_link" dangling_one_way_link
767 testit
"dbcheck_one_way" dbcheck_one_way
768 testit
"dbcheck_clean2" dbcheck_clean
769 testit
"missing_link_sid_corruption" missing_link_sid_corruption
770 testit
"dbcheck_missing_link_sid_corruption" dbcheck_missing_link_sid_corruption
771 testit
"missing_link_sid_clean" dbcheck_clean
772 testit
"add_lost_deleted_user1" add_lost_deleted_user1
773 testit
"dbcheck_lost_deleted_user1" dbcheck_lost_deleted_user1
774 testit
"lost_deleted_user1_clean_A" dbcheck_clean
775 testit
"remove_lost_deleted_user1" remove_lost_deleted_user1
776 testit
"lost_deleted_user1_clean_B" dbcheck_clean
777 testit
"add_lost_deleted_user2" add_lost_deleted_user2
778 testit
"dbcheck_lost_deleted_user2" dbcheck_lost_deleted_user2
779 testit
"lost_deleted_user2_clean" dbcheck_clean
780 testit
"add_lost_deleted_user3" add_lost_deleted_user3
781 testit
"dbcheck_lost_deleted_user3" dbcheck_lost_deleted_user3
782 testit
"lost_deleted_user3_clean_A" dbcheck_clean
783 testit
"remove_lost_deleted_user3" remove_lost_deleted_user3
784 testit
"lost_deleted_user3_clean_B" dbcheck_clean
785 testit
"dangling_one_way_dn" dangling_one_way_dn
786 testit
"deleted_one_way_dn" deleted_one_way_dn
787 testit
"dbcheck_clean3" dbcheck_clean
788 testit
"add_dangling_multi_valued" add_dangling_multi_valued
789 testit
"dbcheck_dangling_multi_valued" dbcheck_dangling_multi_valued
790 testit
"dangling_multi_valued_check_missing" dangling_multi_valued_check_missing
791 testit
"dangling_multi_valued_check_equal_or_too_many" dangling_multi_valued_check_equal_or_too_many
792 # Currently this cannot pass
793 testit
"dbcheck_dangling_multi_valued_clean" dbcheck_clean
795 subunit_start_test
$RELEASE
796 subunit_skip_test
$RELEASE <<EOF
800 subunit_start_test
"tombstones_expunge"
801 subunit_skip_test
"tombstones_expunge" <<EOF
806 if [ -d $PREFIX_ABS/${RELEASE} ]; then
807 rm -fr $PREFIX_ABS/${RELEASE}