From f37765469bc17b27e99eebde1ad455fca8810818 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 5 Feb 2014 16:22:11 +1300 Subject: [PATCH] dsdb: Add more tests for DN+String and DN+Binary comparisons Signed-off-by: Andrew Bartlett Reviewed-by: Stefan Metzmacher Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Wed Feb 5 10:41:37 CET 2014 on sn-devel-104 (cherry picked from commit 741e5dca09053d0fc9a6e2a112113f1828a95759) --- source4/dsdb/common/tests/dsdb_dn.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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; } -- 2.11.4.GIT