dsdb: Add more tests for DN+String and DN+Binary comparisons
authorAndrew Bartlett <abartlet@samba.org>
Wed, 5 Feb 2014 03:22:11 +0000 (16:22 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 5 Feb 2014 09:41:37 +0000 (10:41 +0100)
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

source4/dsdb/common/tests/dsdb_dn.c

index 9ae0c8a049497a7dab6104f12f886d5487b9f695..66c7e125a476e705eacd27011863d9666201d2db 100644 (file)
@@ -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;
 }