I am writing a BHO that requires me to authenticate via an LDAP server.
 I am writing in Javascript and haven't been able to find much in the
way of documentation or examples.  I'm using the following code:

   var dataListener =
      {
         onLDAPInit: function(conn, status)
         {
            alert("1st con, status = "+status);
         },
         onLDAPMessage: function(message)
         {
            alert("Message = "+ message);
         },
      };

   var conListener =
      {
          onLDAPInit: function(conn, status)
          {
             alert("Con Conned, status = "+ status);
          },
          onLDAPMessage: function(message)
          {
             alert("Con Message = "+ message);
          },
      };

   var dn = "uid="+uname+", ou=People, o=stolaf.edu";
   var connection =
Components.classes["@mozilla.org/network/ldap-connection;1"].createInstance(Components.interfaces.nsILDAPConnection);
   connection.init("ldap.stolaf.edu",389,true,dn,dataListener,null,2);

   var ldapCon =
Components.classes["@mozilla.org/network/ldap-operation;1"].createInstance(Components.interfaces.nsILDAPOperation);
   ldapCon.init(connection, conListener, null);

   ldapCon.simpleBind(pwd);



I get the following alert: "1st con, status = 0" for the above code.
If I replace ldap.stolaf.edu with ldaps://ldap.stolaf.edu/ I get the
following alert: "1st con, status = 2152398878".  Either way I also get
the following Javascript error:

Error: [Exception... "Component returned failure code: 0x8000ffff
(NS_ERROR_UNEXPECTED) [nsILDAPOperation.simpleBind]"  nsresult:
"0x8000ffff (NS_ERROR_UNEXPECTED)"  location: "JS frame ::
chrome://cpet/content/cpet.js :: CPET_ProcessLogon :: line 320"  data:
no]
Source File: chrome://cpet/content/cpet.js
Line: 320

What's more, the LDAP server logs never show the computer I'm working
on as having connected at all so I don't know where the status messages
are coming from.  If you can help me or point me to a place where I can
get help I would appreciate it.  The xulplanet.com docs just aren't
cutting it.

_______________________________________________
Mozilla-xpcom mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to