From 7dc7156bd76425df129102a42dd29a85fd8c7ebc Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 22 Feb 2007 01:54:40 +0000 Subject: r21496: A number of ldb control and LDAP changes, surrounding the 'phantom_root' flag in the search_options control - Add in support for LDB controls to the js layer - Test the behaviour - Implement support for the 'phantom_root' flag in the partitions module - Make the LDAP server set the 'phantom_root' flag in the search_options control - This replaces the global_catalog flag passed down as an opaque pointer - Rework the string-format control parsing function into ldb_parse_control_strings(), returning errors by ldb_errorstring() method, rather than with printf to stderr - Rework some of the ldb_control handling logic Andrew Bartlett (This used to be commit 2b3df7f38d7790358dbb4de1b8609bf794a351fb) --- testprogs/ejs/ldap.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'testprogs') diff --git a/testprogs/ejs/ldap.js b/testprogs/ejs/ldap.js index 67eb28f6e3..9fab283b70 100755 --- a/testprogs/ejs/ldap.js +++ b/testprogs/ejs/ldap.js @@ -218,6 +218,18 @@ objectClass: user assert(res.msgs[0].dn == res3gc.msgs[0].dn); } + println("Testing ldb.search for (&(cn=ldaptestuser)(objectCategory=PerSon)) in with 'phantom root' control"); + var attrs = new Array("cn"); + var controls = new Array("search_options:1:2"); + var res3control = gc_ldb.search("(&(cn=ldaptestuser)(objectCategory=PerSon))", base_dn, ldb.SCOPE_SUBTREE, attrs, controls); + if (res3control.error != 0 || res3control.msgs.length != 1) { + println("Could not find (&(cn=ldaptestuser)(objectCategory=PerSon)) in Global Catalog"); + assert(res3control.error == 0); + assert(res3control.msgs.length == 1); + } + + assert(res.msgs[0].dn == res3control.msgs[0].dn); + ok = ldb.del(res.msgs[0].dn); if (ok.error != 0) { println(ok.errstr); @@ -414,7 +426,21 @@ objectClass: user assert(res.error == 0); assert(res.msgs.length == 0); + println("Testing that we can get at the configuration DN from the main search base on the LDAP port with the 'phantom root' search_options control"); + var attrs = new Array("cn"); + var controls = new Array("search_options:1:2"); + var res = ldb.search("objectClass=crossRef", base_dn, ldb.SCOPE_SUBTREE, attrs, controls); + assert(res.error == 0); + assert(res.msgs.length > 0); + if (gc_ldb != undefined) { + println("Testing that we can get at the configuration DN from the main search base on the GC port with the search_options control == 0"); + var attrs = new Array("cn"); + var controls = new Array("search_options:1:0"); + var res = gc_ldb.search("objectClass=crossRef", base_dn, gc_ldb.SCOPE_SUBTREE, attrs, controls); + assert(res.error == 0); + assert(res.msgs.length > 0); + println("Testing that we do find configuration elements in the global catlog"); var attrs = new Array("cn"); var res = gc_ldb.search("objectClass=crossRef", base_dn, ldb.SCOPE_SUBTREE, attrs); -- cgit v1.2.3