2
votes

In our company, we have a project which should use Novell eDirectory with .net applications. I have tried Novell Api (http://www.novell.com/coolsolutions/feature/11204.html) to connect between .NET applications. It is working fine.

But, as per requirement, we specifically need .net API to connect not with Novell Api, which is not working. Connection and binding with .NET Api DirectoryServices not working.

Our Novell eDirectory is installed with following credentials:

  1. IP address: 10.0.x.xx(witsxxx.companyname.com)

  2. Tree : SXXXX

  3. New Tree Context: WIxxxK01-NDS.OU=STATE.O=ORG

  4. ADMIN Context is: ou=STATE,o=ORG

  5. admin : admin

  6. password: admin

I used Novell Api and used following code

String ldapHost ="10.0.x.xx";
String loginDN = "cn=admin,cn=WIxxxK01-NDS,OU=STATE,o=ORG";
String password = string.Empty;
String searchBase = "o=ORG";
String searchFilter = "(objectclass=*)";
Novell.Directory.Ldap.LdapConnection lc = new Novell.Directory.Ldap.LdapConnection();

try
{
    // connect to the server
    lc.Connect(ldapHost, LdapPort);
    // bind to the server
    lc.Bind(LdapVersion, loginDN, password);
}

This is binding correctly and searching can be done.

Now my issue is with when I trying to use .NET APi and to use System.DirectoryServices or System.DirectoryServices.Protocols, it is not connecting or binding.

I can't even test the following DirectoryEntry.Exists method. It is going to exception.

string myADSPath = "LDAP://10.0.x.xx:636/OU=STATE,O=ORG";

// Determine whether the given path is correct for the DirectoryEntry.
if (DirectoryEntry.Exists(myADSPath))
{
    Console.WriteLine("The path {0} is valid",myADSPath);
}
else
{
    Console.WriteLine("The path {0} is invalid",myADSPath);
}

It is saying Server is not operational or Local error occurred etc. I don't know what is happening with directory path.

I tried

DirectoryEntry de = new DirectoryEntry("LDAP://10.0.x.xx:636/O=ORG,DC=witsxxx,DC=companyname,DC=com", "cn=admin,cn=WIxxxK01-NDS,o=ORG", "admin");
DirectorySearcher ds = new DirectorySearcher(de, "&(objectClass=user)");
var test = ds.FindAll();

All are going to exceptions.

Could you please help me to solve this? How should be the userDN for DirectoryEntry?

I used System.DirectoryServices.Protocols.LdapConnection too with LdapDirectoryIdentifier and System.Net.NetworkCredential but no result. Only same exceptions.

I appreciate your valuable time and help.

Thanks, Binu

1
As far as I remember, I never got this to work properly. The MSDN documentation on DirectoryEntry also clearly states: The DirectoryEntry class encapsulates a node or object in the Active Directory Domain Services hierarchy. - System.DirectoryServices is really geared towards Active Directory - it doesn't really support anything else. So either keep using the native Novell API, or then you need to look into low-level, raw LDAP (S.DS.Protocols)marc_s
Maybe this article on CodeProject can be used as a starting point - or this post on social.msdn.commarc_s
I tried the following code also with raw LDAP (S.DS.Protocols) , but got exceptions. try { LdapDirectoryIdentifier lid = new LdapDirectoryIdentifier("10.0.x.xx",389); System.Net.NetworkCredential cred = new System.Net.NetworkCredential("cn=admin,cn=witsxxx-NDS,o=ORG", string.Empty); using (System.DirectoryServices.Protocols.LdapConnection lconn = new System.DirectoryServices.Protocols.LdapConnection(lid)) { lconn.Bind(cred); } }Binu Varghese

1 Answers

0
votes

To diagnose your LDAP connection error, get access to the eDirectory server from the admins, and use iMonitor (serverIP:8028/nds and select Dstrace), in Dstrace clear all tabs and enable LDAP tracing, then do your bind see what happens on the LDAP side to see if there is a more descriptive error there. Or if you even get far enough to bind and make a connection.