summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2015-08-03 13:50:08 +1200
committerStefan Metzmacher <metze@samba.org>2015-09-03 09:11:52 +0200
commitd2f2df68471085c0ac01d26be9a406f7fe781a7b (patch)
treea38507bd80977482ef6c6acd929bc57c59b0a367
parent47af9ce98ad852f66c69a054a768429839d8bfdd (diff)
downloadsamba-d2f2df68471085c0ac01d26be9a406f7fe781a7b.tar.gz
selftest: Add assertion that we actually fix the replPropertyMetaData sort order
This ensures that the dbcheck rule fixes the sort order (and only fixes the sort order). BUG: https://bugzilla.samba.org/show_bug.cgi?id=10973 Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Tue Aug 25 02:45:58 CEST 2015 on sn-devel-104 (cherry picked from commit dcc657a2219498beac8bde6cbf999ee7cf6acae8)
-rw-r--r--source4/selftest/provisions/release-4-1-0rc3/expected-replpropertymetadata-after-dbcheck.ldif122
-rw-r--r--source4/selftest/provisions/release-4-1-0rc3/expected-replpropertymetadata-before-dbcheck.ldif122
-rwxr-xr-xtestprogs/blackbox/dbcheck-oldrelease.sh47
3 files changed, 290 insertions, 1 deletions
diff --git a/source4/selftest/provisions/release-4-1-0rc3/expected-replpropertymetadata-after-dbcheck.ldif b/source4/selftest/provisions/release-4-1-0rc3/expected-replpropertymetadata-after-dbcheck.ldif
new file mode 100644
index 00000000000..e6cdedcaa4e
--- /dev/null
+++ b/source4/selftest/provisions/release-4-1-0rc3/expected-replpropertymetadata-after-dbcheck.ldif
@@ -0,0 +1,122 @@
+# record 1
+dn: CN=ops_run_anything,OU=SUDOers,DC=release-4-1-0rc3,DC=samba,DC=corp
+objectClass: top
+objectClass: sudoRole
+cn: ops_run_anything
+instanceType: 4
+whenCreated: 20150802225130.0Z
+uSNCreated: 3514
+name: ops_run_anything
+objectGUID: 0609a23b-81a4-44c0-9220-b89085775441
+objectCategory: CN=sudoRole,CN=Schema,CN=Configuration,DC=release-4-1-0rc3,DC=samba,DC=corp
+sudoHost: ALL
+sudoCommand: ALL
+sudoRunAsUser: ALL
+sudoRunAsGroup: ALL
+whenChanged: 20150802225647.0Z
+uSNChanged: 3515
+replPropertyMetaData: NDR: struct replPropertyMetaDataBlob
+ version : 0x00000001 (1)
+ reserved : 0x00000000 (0)
+ ctr : union replPropertyMetaDataCtr(case 1)
+ ctr1: struct replPropertyMetaDataCtr1
+ count : 0x0000000d (13)
+ reserved : 0x00000000 (0)
+ array: ARRAY(13)
+ array: struct replPropertyMetaData1
+ attid : DRSUAPI_ATTID_objectClass (0x0)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : DRSUAPI_ATTID_instanceType (0x20001)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : DRSUAPI_ATTID_whenCreated (0x20002)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : DRSUAPI_ATTID_ntSecurityDescriptor (0x20119)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : DRSUAPI_ATTID_name (0x90001)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : DRSUAPI_ATTID_objectCategory (0x9030E)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : UNKNOWN_ENUM_VALUE (0x290001)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:56:47 2015 UTC
+ originating_invocation_id: b249ef44-b215-4d3b-b5d6-7cec08154b7a
+ originating_usn : 0x0000000000000dbb (3515)
+ local_usn : 0x0000000000000dbb (3515)
+ array: struct replPropertyMetaData1
+ attid : UNKNOWN_ENUM_VALUE (0x9DDA71B0)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : UNKNOWN_ENUM_VALUE (0x9DDA71B1)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : UNKNOWN_ENUM_VALUE (0x9DDA71B2)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : UNKNOWN_ENUM_VALUE (0x9DDA71B5)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : UNKNOWN_ENUM_VALUE (0x9DDA71B6)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : DRSUAPI_ATTID_cn (0x3)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+
+distinguishedName: CN=ops_run_anything,OU=SUDOers,DC=release-4-1-0rc3,DC=samba,DC=corp
+
+# returned 1 records
+# 1 entries
+# 0 referrals
diff --git a/source4/selftest/provisions/release-4-1-0rc3/expected-replpropertymetadata-before-dbcheck.ldif b/source4/selftest/provisions/release-4-1-0rc3/expected-replpropertymetadata-before-dbcheck.ldif
new file mode 100644
index 00000000000..af9d827e9ed
--- /dev/null
+++ b/source4/selftest/provisions/release-4-1-0rc3/expected-replpropertymetadata-before-dbcheck.ldif
@@ -0,0 +1,122 @@
+# record 1
+dn: CN=ops_run_anything,OU=SUDOers,DC=release-4-1-0rc3,DC=samba,DC=corp
+objectClass: top
+objectClass: sudoRole
+cn: ops_run_anything
+instanceType: 4
+whenCreated: 20150802225130.0Z
+uSNCreated: 3514
+name: ops_run_anything
+objectGUID: 0609a23b-81a4-44c0-9220-b89085775441
+objectCategory: CN=sudoRole,CN=Schema,CN=Configuration,DC=release-4-1-0rc3,DC=samba,DC=corp
+sudoHost: ALL
+sudoCommand: ALL
+sudoRunAsUser: ALL
+sudoRunAsGroup: ALL
+replPropertyMetaData: NDR: struct replPropertyMetaDataBlob
+ version : 0x00000001 (1)
+ reserved : 0x00000000 (0)
+ ctr : union replPropertyMetaDataCtr(case 1)
+ ctr1: struct replPropertyMetaDataCtr1
+ count : 0x0000000d (13)
+ reserved : 0x00000000 (0)
+ array: ARRAY(13)
+ array: struct replPropertyMetaData1
+ attid : UNKNOWN_ENUM_VALUE (0x9DDA71B0)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : UNKNOWN_ENUM_VALUE (0x9DDA71B1)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : UNKNOWN_ENUM_VALUE (0x9DDA71B2)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : UNKNOWN_ENUM_VALUE (0x9DDA71B5)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : UNKNOWN_ENUM_VALUE (0x9DDA71B6)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : DRSUAPI_ATTID_objectClass (0x0)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : DRSUAPI_ATTID_instanceType (0x20001)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : DRSUAPI_ATTID_whenCreated (0x20002)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : DRSUAPI_ATTID_ntSecurityDescriptor (0x20119)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : DRSUAPI_ATTID_name (0x90001)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : DRSUAPI_ATTID_objectCategory (0x9030E)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+ array: struct replPropertyMetaData1
+ attid : UNKNOWN_ENUM_VALUE (0x290001)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:56:47 2015 UTC
+ originating_invocation_id: b249ef44-b215-4d3b-b5d6-7cec08154b7a
+ originating_usn : 0x0000000000000dbb (3515)
+ local_usn : 0x0000000000000dbb (3515)
+ array: struct replPropertyMetaData1
+ attid : DRSUAPI_ATTID_cn (0x3)
+ version : 0x00000001 (1)
+ originating_change_time : Sun Aug 2 22:51:30 2015 UTC
+ originating_invocation_id: 7b2e1a86-f4d6-4e7f-a49f-d40f3596aa63
+ originating_usn : 0x0000000000000eb1 (3761)
+ local_usn : 0x0000000000000dba (3514)
+
+whenChanged: 20150802225647.0Z
+uSNChanged: 3515
+distinguishedName: CN=ops_run_anything,OU=SUDOers,DC=release-4-1-0rc3,DC=samba,DC=corp
+
+# returned 1 records
+# 1 entries
+# 0 referrals
diff --git a/testprogs/blackbox/dbcheck-oldrelease.sh b/testprogs/blackbox/dbcheck-oldrelease.sh
index fdb553be0f3..22942dd2b10 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
+ldbsearch="ldbsearch"
+if [ -x "$BINDIR/ldbsearch" ]; then
+ ldbsearch="$BINDIR/ldbsearch"
+fi
+
undump() {
if test -x $BINDIR/tdbrestore;
then
@@ -136,10 +141,35 @@ reindex() {
$PYTHON $BINDIR/samba-tool dbcheck --reindex -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
}
+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
+ diff $tmpldif $release_dir/expected-replpropertymetadata-before-dbcheck.ldif
+ if [ "$?" != "0" ]; then
+ return 1
+ fi
+ fi
+ return 0
+}
+
# This should 'fail', because it returns the number of modified records
dbcheck() {
$PYTHON $BINDIR/samba-tool dbcheck --cross-ncs --fix --yes -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
}
+
+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
+ if [ "$?" != "0" ]; then
+ return 1
+ fi
+ fi
+ return 0
+}
+
# But having fixed it all up, this should pass
dbcheck_clean() {
$PYTHON $BINDIR/samba-tool dbcheck --cross-ncs -H tdb://$PREFIX_ABS/${RELEASE}/private/sam.ldb $@
@@ -198,7 +228,9 @@ ldapcmp_sd() {
if [ -d $release_dir ]; then
testit $RELEASE undump
testit "reindex" reindex
+ testit "check_expected_before_values" check_expected_before_values
testit_expect_failure "dbcheck" dbcheck
+ testit "check_expected_after_values" check_expected_after_values
testit "dbcheck_clean" dbcheck_clean
testit_expect_failure "dbcheck_acl_reset" dbcheck_acl_reset
testit "dbcheck_acl_reset_clean" dbcheck_acl_reset_clean
@@ -221,6 +253,10 @@ EOF
subunit_skip_test "reindex" <<EOF
no test provision
EOF
+ subunit_start_test check_expected_before_values
+ subunit_skip_test check_expected_before_values<<EOF
+no test provision
+EOF
subunit_start_test "dbcheck"
subunit_skip_test "dbcheck" <<EOF
no test provision
@@ -229,6 +265,10 @@ EOF
subunit_skip_test "dbcheck_clean" <<EOF
no test provision
EOF
+ subunit_start_test check_expected_after_values
+ subunit_skip_test check_expected_after_values<<EOF
+no test provision
+EOF
subunit_start_test "dbcheck_acl_reset"
subunit_skip_test "dbcheck_acl_reset" <<EOF
no test provision
@@ -257,6 +297,11 @@ EOF
no test provision
EOF
+ subunit_start_test check_expected_before_values
+ subunit_skip_test check_expected_before_values<<EOF
+no test provision
+EOF
+
subunit_start_test "dbcheck2"
subunit_skip_test "dbcheck2" <<EOF
no test provision
@@ -277,7 +322,7 @@ EOF
fi
if [ -d $PREFIX_ABS/${RELEASE} ]; then
- rm -fr $PREFIX_ABS/${RELEASE}
+ rm -fr $PREFIX_ABS/${RELEASE}
fi
if [ -d $PREFIX_ABS/${RELEASE}_reference ]; then