blackbox/dbcheck-links.sh: prepare regression test for skipping expired tombstones
authorStefan Metzmacher <metze@samba.org>
Tue, 12 Mar 2019 10:38:22 +0000 (11:38 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 14 Mar 2019 02:12:21 +0000 (02:12 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13816

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/selftest/provisions/release-4-5-0-pre1/expected-dbcheck-link-output-lost-deleted-user3.txt [new file with mode: 0644]
testprogs/blackbox/dbcheck-links.sh

diff --git a/source4/selftest/provisions/release-4-5-0-pre1/expected-dbcheck-link-output-lost-deleted-user3.txt b/source4/selftest/provisions/release-4-5-0-pre1/expected-dbcheck-link-output-lost-deleted-user3.txt
new file mode 100644 (file)
index 0000000..67ca493
--- /dev/null
@@ -0,0 +1,9 @@
+Checking 232 objects
+WARNING: no target object found for GUID component link lastKnownParent in deleted object CN=fred\0ADEL:2301a64c-1122-5566-851e-12d4a711cfb4,OU=removed,DC=release-4-5-0-pre1,DC=samba,DC=corp - <GUID=f28216e9-1234-5678-8b2d-6bb229563b62>;OU=removed,DC=release-4-5-0-pre1,DC=samba,DC=corp
+Not removing dangling one-way link on deleted object (tombstone garbage collection in progress?)
+ERROR: wrong dn[CN=fred\0ADEL:2301a64c-1122-5566-851e-12d4a711cfb4,OU=removed,DC=release-4-5-0-pre1,DC=samba,DC=corp] cn='fred\nDEL:2301a64c-1122-5566-851e-12d4a711cfb4' name=b'fred\nDEL:2301a64c-1122-5566-851e-12d4a711cfb4' new_dn[CN=fred\0ADEL:2301a64c-1122-5566-851e-12d4a711cfb4,CN=Deleted Objects,DC=release-4-5-0-pre1,DC=samba,DC=corp]
+Rename CN=fred\0ADEL:2301a64c-1122-5566-851e-12d4a711cfb4,OU=removed,DC=release-4-5-0-pre1,DC=samba,DC=corp to CN=fred\0ADEL:2301a64c-1122-5566-851e-12d4a711cfb4,CN=Deleted Objects,DC=release-4-5-0-pre1,DC=samba,DC=corp? [YES]
+Renamed CN=fred\0ADEL:2301a64c-1122-5566-851e-12d4a711cfb4,OU=removed,DC=release-4-5-0-pre1,DC=samba,DC=corp into CN=fred\0ADEL:2301a64c-1122-5566-851e-12d4a711cfb4,CN=Deleted Objects,DC=release-4-5-0-pre1,DC=samba,DC=corp
+WARNING: parent object not found for CN=fred\0ADEL:2301a64c-1122-5566-851e-12d4a711cfb4,OU=removed,DC=release-4-5-0-pre1,DC=samba,DC=corp
+Not moving to LostAndFound (tombstone garbage collection in progress?)
+Checked 232 objects (1 errors)
index 24724b902f84b558abe9b7d01d4f7a9e3ee1e8e3..686f560bb188e5f622dde6a4e51058e96afd09bb 100755 (executable)
@@ -443,6 +443,116 @@ dbcheck_lost_deleted_user2() {
     return $?
 }
 
+add_lost_deleted_user3() {
+    ldif=$PREFIX_ABS/${RELEASE}/add_lost_deleted_user3.ldif
+    cat > $ldif <<EOF
+dn: CN=fred\0ADEL:2301a64c-1122-5566-851e-12d4a711cfb4,OU=removed,DC=release-4-5-0-pre1,DC=samba,DC=corp
+objectClass: top
+objectClass: person
+objectClass: organizationalPerson
+objectClass: user
+instanceType: 4
+whenCreated: 20160629043638.0Z
+uSNCreated: 3740
+objectGUID: 2301a64c-1122-5566-851e-12d4a711cfb4
+objectSid: S-1-5-21-4177067393-1453636373-93818738-1010
+sAMAccountName: fred
+userAccountControl: 512
+isDeleted: TRUE
+lastKnownParent: <GUID=f28216e9-1234-5678-8b2d-6bb229563b62>;OU=removed,DC=rel
+ ease-4-5-0-pre1,DC=samba,DC=corp
+isRecycled: TRUE
+cn:: ZnJlZApERUw6MjMwMWE2NGMtMTEyMi01NTY2LTg1MWUtMTJkNGE3MTFjZmI0
+name:: ZnJlZApERUw6MjMwMWE2NGMtMTEyMi01NTY2LTg1MWUtMTJkNGE3MTFjZmI0
+replPropertyMetaData:: AQAAAAAAAAAXAAAAAAAAAAAAAAABAAAAVuGDDQMAAACjlkROuH+X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SeIBAg
+ AAAAAABSAAAAAqAgAABRIoADABAAABAAAA3kfmkW/ZcEuVV9Y/9PPM2AEBAAAAAAAFCgAAAAASJAD
+ /AQ8AAQUAAAAAAAUVAAAAgf34+BW7pFZyj5cFBwIAAAASGAAEAAAAAQIAAAAAAAUgAAAAKgIAAAAS
+ GAC9AQ8AAQIAAAAAAAUgAAAAIAIAAA==
+EOF
+
+    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)
+    if [ "$?" != "0" ]; then
+       echo "ldbadd returned:\n$out"
+       return 1
+    fi
+
+    return 0
+}
+
+dbcheck_lost_deleted_user3() {
+    # here we don't pass --selftest-check-expired-tombstones
+    # as we want to test the default
+    dbcheck "-lost-deleted-user3" "1" ""
+    return $?
+}
+
+remove_lost_deleted_user3() {
+    out=$(TZ=UTC $ldbdel -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb "<GUID=2301a64c-1122-5566-851e-12d4a711cfb4>" --show-recycled --relax)
+    if [ "$?" != "0" ]; then
+       echo "ldbdel returned:\n$out"
+       return 1
+    fi
+
+    return 0
+}
+
 forward_link_corruption() {
     #
     # Step1: add a duplicate forward link from
@@ -667,6 +777,11 @@ if [ -d $release_dir ]; then
     testit "add_lost_deleted_user2" add_lost_deleted_user2
     testit "dbcheck_lost_deleted_user2" dbcheck_lost_deleted_user2
     testit "lost_deleted_user2_clean" dbcheck_clean
+    testit "add_lost_deleted_user3" add_lost_deleted_user3
+    testit "dbcheck_lost_deleted_user3" dbcheck_lost_deleted_user3
+    testit "lost_deleted_user3_clean_A" dbcheck_clean
+    testit "remove_lost_deleted_user3" remove_lost_deleted_user3
+    testit "lost_deleted_user3_clean_B" dbcheck_clean
     testit "dangling_one_way_dn" dangling_one_way_dn
     testit "deleted_one_way_dn" deleted_one_way_dn
     testit "dbcheck_clean3" dbcheck_clean