From a46beefeb798f63a92f73b2658fd03fa96b55fcb Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 21 Aug 2006 03:52:43 +0000 Subject: r17648: update minschema.js this version returns also oMSyntax and oMObjectClass and also use the right value for the objects CNs add a nasty hack to ejs' mprLdbMessage() to handle binary blobs situations (This used to be commit 8dd1c1c05bc592d76d6e34b303048faf05c0fa6e) --- testprogs/ejs/minschema.js | 48 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 11 deletions(-) (limited to 'testprogs/ejs/minschema.js') diff --git a/testprogs/ejs/minschema.js b/testprogs/ejs/minschema.js index 50aca64da5..31084ac326 100755 --- a/testprogs/ejs/minschema.js +++ b/testprogs/ejs/minschema.js @@ -54,7 +54,7 @@ class_attrs = new Array("objectClass", attrib_attrs = new Array("objectClass", "lDAPDisplayName", "isSingleValued", "linkID", "systemFlags", "systemOnly", "schemaIDGUID", "adminDisplayName", "attributeID", - "attributeSyntax"); + "attributeSyntax", "oMSyntax", "oMObjectClass"); /* notes: @@ -75,21 +75,37 @@ function dprintf() { } } +function get_object_cn(ldb, name) { + var attrs = new Array("cn"); + + var res = ldb.search(sprintf("(ldapDisplayName=%s)", name), rootDse.schemaNamingContext, ldb.SCOPE_SUBTREE, attrs); + assert(res != undefined); + assert(res.length == 1); + + var cn = res[0]["cn"]; + assert(cn != undefined); + if (typeof(cn) == "string") { + return cn; + } + return cn[0]; +} /* create an objectclass object */ -function obj_objectClass(name) { +function obj_objectClass(ldb, name) { var o = new Object(); o.name = name; + o.cn = get_object_cn(ldb, name); return o; } /* create an attribute object */ -function obj_attribute(name) { +function obj_attribute(ldb, name) { var o = new Object(); o.name = name; + o.cn = get_object_cn(ldb, name); return o; } @@ -142,14 +158,19 @@ function fix_dn(dn) { */ function write_ldif_one(o, attrs) { var i; - printf("dn: CN=%s,CN=Schema,CN=Configuration,${BASEDN}\n", o.name); - printf("cn: %s\n", o.name); - printf("name: %s\n", o.name); + printf("dn: CN=%s,CN=Schema,CN=Configuration,${BASEDN}\n", o.cn); + printf("cn: %s\n", o.cn); + printf("name: %s\n", o.cn); for (i=0;i