summaryrefslogtreecommitdiff
path: root/testprogs/blackbox/dbcheck-oldrelease.sh
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2016-03-24 20:12:55 +1300
committerAndrew Bartlett <abartlet@samba.org>2016-06-06 08:50:09 +0200
commitdb15993401f927fd2fcea1687c4155dce2272aa8 (patch)
tree89f9b586bb3af33123c0e79b0ce4bc2bdb97b452 /testprogs/blackbox/dbcheck-oldrelease.sh
parente070af22ac7a0fdcb4c275233d0af7bb49c6fb4d (diff)
downloadsamba-db15993401f927fd2fcea1687c4155dce2272aa8.tar.gz
dbcheck: Find and fix a missing Deleted Objects container
Older Samba versions could delete this. This patch tries very hard to put back the original object, with the original GUID, so that if another replica has the correct container, that we just merge rather than conflict. The existing "wrong dn" check can then put any deleted objects under this container correctly. Pair-programmed-with: Garming Sam <garming@catalyst.net.nz> Pair-programmed-with: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Diffstat (limited to 'testprogs/blackbox/dbcheck-oldrelease.sh')
-rwxr-xr-xtestprogs/blackbox/dbcheck-oldrelease.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/testprogs/blackbox/dbcheck-oldrelease.sh b/testprogs/blackbox/dbcheck-oldrelease.sh
index 89c0c0fdb5f..779e0503555 100755
--- a/testprogs/blackbox/dbcheck-oldrelease.sh
+++ b/testprogs/blackbox/dbcheck-oldrelease.sh
@@ -20,6 +20,11 @@ if [ -x "$BINDIR/ldbmodify" ]; then
ldbmodify="$BINDIR/ldbmodify"
fi
+ldbdel="ldbdel"
+if [ -x "$BINDIR/ldbdel" ]; then
+ ldbdel="$BINDIR/ldbdel"
+fi
+
ldbsearch="ldbsearch"
if [ -x "$BINDIR/ldbsearch" ]; then
ldbsearch="$BINDIR/ldbsearch"
@@ -277,6 +282,43 @@ dbcheck_clean2() {
fi
}
+rm_deleted_objects() {
+ if [ x$RELEASE = x"release-4-1-0rc3" ]; then
+ TZ=UTC $ldbdel -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb.d/DC%3DRELEASE-4-1-0RC3,DC%3DSAMBA,DC%3DCORP.ldb 'CN=Deleted Objects,DC=RELEASE-4-1-0RC3,DC=SAMBA,DC=CORP'
+ if [ "$?" != "0" ]; then
+ return 1
+ fi
+ else
+ return 0
+ fi
+}
+# This should 'fail', because it returns the number of modified records
+dbcheck3() {
+ if [ x$RELEASE = x"release-4-1-0rc3" ]; then
+ $PYTHON $BINDIR/samba-tool dbcheck --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
+ else
+ exit 1
+ fi
+}
+# But having fixed it all up, this should pass
+dbcheck_clean3() {
+ if [ x$RELEASE = x"release-4-1-0rc3" ]; then
+ $PYTHON $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
+ fi
+}
+
+check_expected_after_deleted_objects() {
+ if [ x$RELEASE = x"release-4-1-0rc3" ]; then
+ tmpldif=$PREFIX_ABS/$RELEASE/expected-deleted_objects-after-dbcheck.ldif.tmp
+ TZ=UTC $ldbsearch -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb cn=deleted\ objects -s base -b cn=deleted\ objects,DC=release-4-1-0rc3,DC=samba,DC=corp objectClass description isDeleted isCriticalSystemObject objectGUID showInAdvancedViewOnly systemFlags --sorted --show-binary --show-deleted | grep -v \# | sort > $tmpldif
+ diff $tmpldif $release_dir/expected-deleted_objects-after-dbcheck.ldif
+ if [ "$?" != "0" ]; then
+ return 1
+ fi
+ fi
+ return 0
+}
+
referenceprovision() {
if [ x$RELEASE == x"release-4-0-0" ]; then
$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
@@ -314,6 +356,10 @@ if [ -d $release_dir ]; then
testit "add_userparameters3" add_userparameters3
testit_expect_failure "dbcheck2" dbcheck2
testit "dbcheck_clean2" dbcheck_clean2
+ testit "rm_deleted_objects" rm_deleted_objects
+ testit_expect_failure "dbcheck3" dbcheck3
+ testit "dbcheck_clean3" dbcheck_clean3
+ testit "check_expected_after_deleted_objects" check_expected_after_deleted_objects
testit "referenceprovision" referenceprovision
testit "ldapcmp" ldapcmp
testit "ldapcmp_sd" ldapcmp_sd