summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAnatoliy Atanasov <anatoliy.atanasov@postpath.com>2009-09-21 17:01:20 -0700
committerAnatoliy Atanasov <anatoliy.atanasov@postpath.com>2009-09-21 17:18:10 -0700
commit6033ce24038dfa467e7bf56b04dc6b45f6bff815 (patch)
tree55761962a73560da380ee8f8b158259a4c3f7f39 /source4
parentbc53052d38092d32f08fb794d7ea90f89367c229 (diff)
downloadsamba-6033ce24038dfa467e7bf56b04dc6b45f6bff815.tar.gz
samba-6033ce24038dfa467e7bf56b04dc6b45f6bff815.tar.bz2
samba-6033ce24038dfa467e7bf56b04dc6b45f6bff815.zip
Add tests for MS-ADTS:3.1.1.5.1.2 Naming Constraints
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/ldb/ldb.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/source4/torture/ldb/ldb.c b/source4/torture/ldb/ldb.c
index d9036dd672..64ed669fc1 100644
--- a/source4/torture/ldb/ldb.c
+++ b/source4/torture/ldb/ldb.c
@@ -587,6 +587,7 @@ static bool torture_ldb_dn(struct torture_context *torture)
struct ldb_dn *dn;
struct ldb_dn *child_dn;
struct ldb_dn *typo_dn;
+ struct ldb_val val;
torture_assert(torture,
ldb = ldb_init(mem_ctx, torture->ev),
@@ -655,6 +656,34 @@ static bool torture_ldb_dn(struct torture_context *torture)
ldb_dn_compare_base(dn, typo_dn) != 0,
"Base Comparison on dc=samba,dc=org and c=samba,dc=org should != 0");
+ /* Check DN based on MS-ADTS:3.1.1.5.1.2 Naming Constraints*/
+ torture_assert(torture,
+ dn = ldb_dn_new(mem_ctx, ldb, "CN=New\nLine,DC=SAMBA,DC=org"),
+ "Failed to create a DN with 0xA in it");
+
+ torture_assert(torture,
+ ldb_dn_validate(dn) == false,
+ "should have failed to validate a DN with 0xA in it");
+
+ val.data = "CN=Zer\0,DC=SAMBA,DC=org";
+ val.length = 23;
+ torture_assert(torture,
+ NULL == ldb_dn_from_ldb_val(mem_ctx, ldb, &val),
+ "should fail to create a DN with 0x0 in it");
+
+ torture_assert(torture,
+ dn = ldb_dn_new(mem_ctx, ldb, "CN=loooooooooooooooooooooooooooo"
+"ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo"
+"ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo"
+"ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo"
+"ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo"
+"ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongdn,DC=SAMBA,DC=org"),
+ "Failed to create a DN with size more than 255 characters");
+
+ torture_assert(torture,
+ ldb_dn_validate(dn) == false,
+ "should have failed to validate DN with size more than 255 characters");
+
talloc_free(mem_ctx);
return true;
}