From 25ba47eaf8a8c66ab131701e61a6ea8c2a0e49d8 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Sat, 26 Aug 2006 15:38:01 +0000 Subject: r17839: do not reference possibleInferiors we have not extracted trim duplicate may attributes (This used to be commit 4975659fd70abdbae42ee378b7be766102f4df55) --- testprogs/ejs/minschema.js | 90 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 81 insertions(+), 9 deletions(-) (limited to 'testprogs') diff --git a/testprogs/ejs/minschema.js b/testprogs/ejs/minschema.js index 9ad39827ac..c51caaca84 100755 --- a/testprogs/ejs/minschema.js +++ b/testprogs/ejs/minschema.js @@ -399,7 +399,80 @@ function walk_naming_context(ldb, namingContext) { trim the may attributes for an objectClass */ function trim_objectclass_attributes(ldb, class) { - /* not implemented yet */ + var i,j,n; + + /* trim possibleInferiors, + * include only the classes we extracted */ + var possinf = class["possibleInferiors"]; + if (possinf != undefined) { + var newpossinf = new Array(); + if (typeof(possinf) == "string") { + possinf = new Array(possinf); + } + n = 0; + for (j = 0;j < possinf.length; j++) { + var x = possinf[j]; + if (objectclasses[x] != undefined) { + newpossinf[n] = x; + n++; + } + } + class["possibleInferiors"] = newpossinf; + } + + /* trim systemMayContain, + * remove duplicates */ + var sysmay = class["systemMayContain"]; + if (sysmay != undefined) { + var newsysmay = new Array(); + if (typeof(sysmay) == "string") { + sysmay = new Array(sysmay); + } + for (j = 0;j < sysmay.length; j++) { + var x = sysmay[j]; + var dup = false; + if (newsysmay[0] == undefined) { + newsysmay[0] = x; + } else { + for (n = 0; n < newsysmay.length; n++) { + if (newsysmay[n] == x) { + dup = true; + } + } + if (dup == false) { + newsysmay[n] = x; + } + } + } + class["systemMayContain"] = newsysmay; + } + + /* trim mayContain, + * remove duplicates */ + var may = class["mayContain"]; + if (may != undefined) { + var newmay = new Array(); + if (typeof(may) == "string") { + may = new Array(may); + } + for (j = 0;j < may.length; j++) { + var x = may[j]; + var dup = false; + if (newmay[0] == undefined) { + newmay[0] = x; + } else { + for (n = 0; n < newmay.length; n++) { + if (newmay[n] == x) { + dup = true; + } + } + if (dup == false) { + newmay[n] = x; + } + } + } + class["mayContain"] = newmay; + } } /* @@ -444,7 +517,6 @@ function list_append(a1, a2) { function attribute_list(class, attr1, attr2) { var a1 = class[attr1]; var a2 = class[attr2]; - var i; if (typeof(a1) == "string") { a1 = new Array(a1); } @@ -636,13 +708,6 @@ for (i in objectclasses) { find_objectclass_properties(ldb, objectclasses[i]); } -/* - trim the 'may' attribute lists to those really needed -*/ -for (i in objectclasses) { - trim_objectclass_attributes(ldb, objectclasses[i]); -} - /* form the full list of attributes */ @@ -655,6 +720,13 @@ for (i in attributes) { find_attribute_properties(ldb, attributes[i]); } +/* + trim the 'may' attribute lists to those really needed +*/ +for (i in objectclasses) { + trim_objectclass_attributes(ldb, objectclasses[i]); +} + /* dump an ldif form of the attributes and objectclasses */ -- cgit