From 5fb98a3534a806331307a425d9469164e27d7ee7 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 22 Dec 2015 19:48:38 +1300 Subject: dbcheck: Fix incorrect/duplicate attrid in replPropertMetaData If custom schema is used in a replicated DC environment, these are created as soon as an attribute is modified on more than one DC. We have to remove these. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11443 Signed-off-by: Andrew Bartlett Reviewed-by: Garming Sam --- testprogs/blackbox/dbcheck-oldrelease.sh | 46 +++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 4 deletions(-) (limited to 'testprogs') diff --git a/testprogs/blackbox/dbcheck-oldrelease.sh b/testprogs/blackbox/dbcheck-oldrelease.sh index 22942dd2b10..e43dcd8a5e5 100755 --- a/testprogs/blackbox/dbcheck-oldrelease.sh +++ b/testprogs/blackbox/dbcheck-oldrelease.sh @@ -141,14 +141,41 @@ reindex() { $PYTHON $BINDIR/samba-tool dbcheck --reindex -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@ } +do_current_version_mod() { + if [ x$RELEASE = x"release-4-1-0rc3" ]; then + # Confirm (in combination with the ldbsearch below) that + # changing the attribute with current Samba fixes it, and that + # a fixed attriute isn't unfixed by dbcheck. + tmpldif=$release_dir/sudoers2-mod.ldif + $ldbmodify -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $tmpldif + fi + return 0 +} + check_expected_before_values() { if [ x$RELEASE = x"release-4-1-0rc3" ]; then tmpldif=$PREFIX_ABS/$RELEASE/expected-replpropertymetadata-before-dbcheck.ldif.tmp - 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 + 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 diff $tmpldif $release_dir/expected-replpropertymetadata-before-dbcheck.ldif if [ "$?" != "0" ]; then return 1 fi + + 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 + + # Here we remove originating_change_time and whenChanged as + # these are time-dependent, caused by the ldbmodify above. + + diff $tmpldif $release_dir/expected-replpropertymetadata-before-dbcheck2.ldif + if [ "$?" != "0" ]; then + return 1 + fi + + 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 + diff $tmpldif $release_dir/expected-replpropertymetadata-before-dbcheck3.ldif + if [ "$?" != "0" ]; then + return 1 + fi fi return 0 } @@ -160,9 +187,19 @@ dbcheck() { check_expected_after_values() { if [ x$RELEASE = x"release-4-1-0rc3" ]; then - tmpldif=$PREFIX_ABS/$RELEASE/expected-replpropertymetadata-after-dbcheck.ldif.tmp - 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 - diff -u $tmpldif $release_dir/expected-replpropertymetadata-after-dbcheck.ldif + tmpldif=$PREFIX_ABS/$RELEASE/expected-replpropertymetadata-before-dbcheck.ldif.tmp + 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 + diff $tmpldif $release_dir/expected-replpropertymetadata-after-dbcheck.ldif + if [ "$?" != "0" ]; then + return 1 + fi + 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 + diff $tmpldif $release_dir/expected-replpropertymetadata-after-dbcheck2.ldif + if [ "$?" != "0" ]; then + return 1 + fi + 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 + diff $tmpldif $release_dir/expected-replpropertymetadata-after-dbcheck3.ldif if [ "$?" != "0" ]; then return 1 fi @@ -228,6 +265,7 @@ ldapcmp_sd() { if [ -d $release_dir ]; then testit $RELEASE undump testit "reindex" reindex + testit "current_version_mod" do_current_version_mod testit "check_expected_before_values" check_expected_before_values testit_expect_failure "dbcheck" dbcheck testit "check_expected_after_values" check_expected_after_values -- cgit v1.2.1