summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2014-02-05 16:22:11 +1300
committerKarolin Seeger <kseeger@samba.org>2014-07-15 12:46:16 +0200
commitf37765469bc17b27e99eebde1ad455fca8810818 (patch)
tree2eb913ca5a72a8b39018c76fb673fe5163df6295
parentf18a67a840b04146c1f23f902cb2efbed0722b52 (diff)
downloadsamba-f37765469bc17b27e99eebde1ad455fca8810818.tar.gz
dsdb: Add more tests for DN+String and DN+Binary comparisons
Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Wed Feb 5 10:41:37 CET 2014 on sn-devel-104 (cherry picked from commit 741e5dca09053d0fc9a6e2a112113f1828a95759)
-rw-r--r--source4/dsdb/common/tests/dsdb_dn.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/source4/dsdb/common/tests/dsdb_dn.c b/source4/dsdb/common/tests/dsdb_dn.c
index 9ae0c8a0494..66c7e125a47 100644
--- a/source4/dsdb/common/tests/dsdb_dn.c
+++ b/source4/dsdb/common/tests/dsdb_dn.c
@@ -77,6 +77,13 @@ static bool torture_dsdb_dn_attrs(struct torture_context *torture)
syntax->comparison_fn(ldb, mem_ctx, &dn1, &dn2) != 0,
"compare of binary+dn an dn should have failed");
+ /* Test compare (false) with different binary prefix */
+ dn1 = data_blob_string_const("B:6:abcdef:dc=samba,dc=org");
+ dn2 = data_blob_string_const("B:4:abcd:dc=samba,dc=org");
+ torture_assert(torture,
+ syntax->comparison_fn(ldb, mem_ctx, &dn1, &dn2) != 0,
+ "compare of binary+dn an dn should have failed");
+
/* Test DN+String behaviour */
torture_assert(torture, syntax = ldb_samba_syntax_by_name(ldb, DSDB_SYNTAX_STRING_DN),
"Failed to get DN+String schema attribute");
@@ -107,6 +114,13 @@ static bool torture_dsdb_dn_attrs(struct torture_context *torture)
syntax->comparison_fn(ldb, mem_ctx, &dn1, &dn2) != 0,
"compare of string+dn an dn should have failed");
+ /* Test compare (false) with different string prefix */
+ dn1 = data_blob_string_const("S:6:abcdef:dc=samba,dc=org");
+ dn2 = data_blob_string_const("S:6:abcXYZ:dc=samba,dc=org");
+ torture_assert(torture,
+ syntax->comparison_fn(ldb, mem_ctx, &dn1, &dn2) != 0,
+ "compare of string+dn an dn should have failed");
+
talloc_free(mem_ctx);
return true;
}