Hello,

I am using the following code to simply connect to an LDAP server from JS:

function verifyLogin() {

    alert ("in verifyLogin");
    var server = 
Components.classes["@mozilla.org/network/ldap-server;1"].createInstance(Components.interfaces.nsILDAPServer)
    var url_str = "ldap://localhost:10389";;
    server.key = "ldap";
    server.username = "uid=admin,ou=system";
    server.password = "secret";
    server.binddn = "uid=admin,ou=system";
    server.sizelimit = 100;
    var url = 
Components.classes["@mozilla.org/network/ldap-url;1"].createInstance(Components.interfaces.nsILDAPURL)
    url.init (Components.interfaces.nsIStandardURL.URLTYPE_STANDARD, 10389, 
url_str, null, null);
    server.url = url;

    var ldapSvc = 
Components.classes["@mozilla.org/network/ldap-service;1"].getService(Components.interfaces.nsILDAPService);
    alert ("got service");
    ldapSvc.addServer (server);

    alert ("added server");
    try {
        var conn = ldapSvc.getConnection ("ldap");
    } catch (exce) {
        alert (exce);
    }

    alert ("got connection");
    ldapSvc.releaseConnection ("ldap");
    alert ("released connection");
    ldapSvc.deleteServer ("ldap");
    alert ("leaving verifyLogin");
}

Things work fine until the call to ldapSvc.getConnection.  At that point I 
get the following exception:

[Exception... "Component returned failure code: 0x80004005 
(NS_ERROR_FAILURE) [nsILDAPService.getConnection]"  nsresult: "0x80004005 
(NS_ERROR_FAILURE)"  location: "JS frame :: 
chrome://calendar/content/account.js :: verifyLogin :: line 82"  data: no]

I have verifed the URL and username/password using Apache Directory Studio. 
Everything looks good.

Can anyone tell me what is wrong?

Thanks,

-- Greg


_______________________________________________
dev-tech-ldap mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-ldap

Reply via email to