From f81771c8593327e058b9cb4330d7e77083df3ea9 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 12 Oct 2018 15:56:18 +0200 Subject: [PATCH] blackbox/dbcheck-links: Test broken links with missing on linked attributes BUG: https://bugzilla.samba.org/show_bug.cgi?id=13418 Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett --- .../knownfail.d/samba4.blackbox.dbcheck-links | 6 + ...ink-output-missing-link-sid-corruption.txt | 8 ++ testprogs/blackbox/dbcheck-links.sh | 110 ++++++++++++++++++ 3 files changed, 124 insertions(+) create mode 100644 selftest/knownfail.d/samba4.blackbox.dbcheck-links create mode 100644 source4/selftest/provisions/release-4-5-0-pre1/expected-dbcheck-link-output-missing-link-sid-corruption.txt diff --git a/selftest/knownfail.d/samba4.blackbox.dbcheck-links b/selftest/knownfail.d/samba4.blackbox.dbcheck-links new file mode 100644 index 00000000000..ee207a53ab7 --- /dev/null +++ b/selftest/knownfail.d/samba4.blackbox.dbcheck-links @@ -0,0 +1,6 @@ +# The first one fails and all others are follow up failures... +^samba4.blackbox.dbcheck-links.release-4-5-0-pre1.dbcheck_missing_link_sid_corruption +^samba4.blackbox.dbcheck-links.release-4-5-0-pre1.missing_link_sid_clean +^samba4.blackbox.dbcheck-links.release-4-5-0-pre1.dbcheck_clean3 +^samba4.blackbox.dbcheck-links.release-4-5-0-pre1.dbcheck_dangling_multi_valued +^samba4.blackbox.dbcheck-links.release-4-5-0-pre1.dangling_multi_valued_check_equal_or_too_many diff --git a/source4/selftest/provisions/release-4-5-0-pre1/expected-dbcheck-link-output-missing-link-sid-corruption.txt b/source4/selftest/provisions/release-4-5-0-pre1/expected-dbcheck-link-output-missing-link-sid-corruption.txt new file mode 100644 index 00000000000..34576157f25 --- /dev/null +++ b/source4/selftest/provisions/release-4-5-0-pre1/expected-dbcheck-link-output-missing-link-sid-corruption.txt @@ -0,0 +1,8 @@ +Change DN to ;;;;;;;;;CN=missingsidu1,CN=Users,DC=release-4-5-0-pre1,DC=samba,DC=corp? [YES] +Change DN to ;;;;;;;;;CN=missingsidu2,CN=Users,DC=release-4-5-0-pre1,DC=samba,DC=corp? [YES] +Checked 231 objects (2 errors) +Checking 231 objects +ERROR: missing DN SID component for member in object CN=missingsidg3,CN=Users,DC=release-4-5-0-pre1,DC=samba,DC=corp - ;;;;;;;;CN=missingsidu1,CN=Users,DC=release-4-5-0-pre1,DC=samba,DC=corp +ERROR: missing DN SID component for member in object CN=missingsidg3,CN=Users,DC=release-4-5-0-pre1,DC=samba,DC=corp - ;;;;;;;;CN=missingsidu2,CN=Users,DC=release-4-5-0-pre1,DC=samba,DC=corp +Fixed missing DN SID on attribute member +Fixed missing DN SID on attribute member diff --git a/testprogs/blackbox/dbcheck-links.sh b/testprogs/blackbox/dbcheck-links.sh index 13811ddb461..9798813004c 100755 --- a/testprogs/blackbox/dbcheck-links.sh +++ b/testprogs/blackbox/dbcheck-links.sh @@ -131,6 +131,113 @@ check_expected_after_duplicate_links() { fi } +missing_link_sid_corruption() { + # Step1: add user "missingsidu1" + # + ldif=$PREFIX_ABS/${RELEASE}/missing_link_sid_corruption1.ldif + cat > $ldif < $ldif < $ldif < $ldif <;!!g' \ + -e 's!;!!g' \ + -e 's!RMD_ADDTIME=[1-9][0-9]*!RMD_ADDTIME=123456789000000000!g' \ + -e 's!RMD_CHANGETIME=[1-9][0-9]*!RMD_CHANGETIME=123456789000000000!g' \ + | cat + } > $ldif + + 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) + if [ "$?" != "0" ]; then + echo "ldbmodify returned:\n$out" + return 1 + fi + + return 0 +} + +dbcheck_missing_link_sid_corruption() { + dbcheck "-missing-link-sid-corruption" "1" "" + return $? +} + forward_link_corruption() { # # Step1: add a duplicate forward link from @@ -344,6 +451,9 @@ if [ -d $release_dir ]; then testit "dangling_one_way_link" dangling_one_way_link testit "dbcheck_one_way" dbcheck_one_way testit "dbcheck_clean2" dbcheck_clean + testit "missing_link_sid_corruption" missing_link_sid_corruption + testit "dbcheck_missing_link_sid_corruption" dbcheck_missing_link_sid_corruption + testit "missing_link_sid_clean" 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