summaryrefslogtreecommitdiff
path: root/testprogs
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2006-08-21 03:52:43 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:16:19 -0500
commita46beefeb798f63a92f73b2658fd03fa96b55fcb (patch)
tree83b90e4c75de088f87e4d7dfc344d67cb4a66066 /testprogs
parenta1bc3fb02e27a3d12c9ef4d09ce012ebe4e03674 (diff)
downloadsamba-a46beefeb798f63a92f73b2658fd03fa96b55fcb.tar.gz
samba-a46beefeb798f63a92f73b2658fd03fa96b55fcb.tar.bz2
samba-a46beefeb798f63a92f73b2658fd03fa96b55fcb.zip
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)
Diffstat (limited to 'testprogs')
-rwxr-xr-xtestprogs/ejs/minschema.js48
1 files changed, 37 insertions, 11 deletions
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<attrs.length;i++) {
var a = attrs[i];
if (o[a] == undefined) {
continue;
}
+ /* special case for oMObjectClass, which is a binary object */
+ if (a == "oMObjectClass") {
+ printf("%s:: %s\n", a, o[a]);
+ continue;
+ }
var v = o[a];
if (typeof(v) == "string") {
v = new Array(v);
@@ -211,6 +232,11 @@ function find_attribute_properties(ldb, o) {
var msg = res[0];
var a;
for (a in msg) {
+ /* special case for oMObjectClass, which is a binary object */
+ if (a == "oMObjectClass") {
+ o[a] = ldb.encode(msg[a]);
+ continue;
+ }
o[a] = msg[a];
}
}
@@ -278,7 +304,7 @@ function expand_objectclass(ldb, o) {
var name = list[i];
if (objectclasses[name] == undefined) {
dprintf("Found new objectclass '%s'\n", name);
- objectclasses[name] = obj_objectClass(name);
+ objectclasses[name] = obj_objectClass(ldb, name);
}
}
}
@@ -307,7 +333,7 @@ function add_objectclass_attributes(ldb, class) {
for (j=0;j<len;j++) {
var a = alist[j];
if (attributes[a] == undefined) {
- attributes[a] = obj_attribute(a);
+ attributes[a] = obj_attribute(ldb, a);
}
}
}
@@ -337,7 +363,7 @@ function walk_dn(ldb, dn) {
var msg = res[0];
for (a in msg) {
if (attributes[a] == undefined) {
- attributes[a] = obj_attribute(a);
+ attributes[a] = obj_attribute(ldb, a);
}
}
}
@@ -360,7 +386,7 @@ function walk_naming_context(ldb, namingContext) {
for (c=0;c<msg.length;c++) {
var objectClass = msg[c];
if (objectclasses[objectClass] == undefined) {
- objectclasses[objectClass] = obj_objectClass(objectClass);
+ objectclasses[objectClass] = obj_objectClass(ldb, objectClass);
objectclasses[objectClass].exampleDN = res[r].dn;
}
}
@@ -391,7 +417,7 @@ function build_objectclass(ldb, name) {
dprintf("unknown class '%s'\n", name);
return undefined;
}
- return obj_objectClass(name);
+ return obj_objectClass(ldb, name);
}
/*