mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
r8743: automatically find the basedn in ldap.js
This commit is contained in:
parent
8086c37df6
commit
bdca9537a2
@ -17,13 +17,12 @@ if (ok == false) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (options.ARGV.length != 2) {
|
||||
println("Usage: ldap.js <BASEDN> <HOST>");
|
||||
if (options.ARGV.length != 1) {
|
||||
println("Usage: ldap.js <HOST>");
|
||||
return -1;
|
||||
}
|
||||
|
||||
var base_dn = options.ARGV[0];
|
||||
var host = options.ARGV[1];
|
||||
var host = options.ARGV[0];
|
||||
|
||||
function basic_tests(ldb, base_dn)
|
||||
{
|
||||
@ -50,7 +49,17 @@ cn: LDAPtestUSER
|
||||
|
||||
}
|
||||
|
||||
function find_basedn(ldb)
|
||||
{
|
||||
var attrs = new Array("defaultNamingContext");
|
||||
var res = ldb.search("", "", ldb.SCOPE_BASE, attrs);
|
||||
assert(res.length == 1);
|
||||
return res[0].defaultNamingContext;
|
||||
}
|
||||
|
||||
var ok = ldb.connect("ldap://" + host);
|
||||
var base_dn = find_basedn(ldb);
|
||||
|
||||
basic_tests(ldb, base_dn)
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user