[Mono-list] Mono LDAP vs. Microsoft LDAP Active Directory server

Wallmander Jonathan jonathan.wallmander@consultant.volvo.com
Mon, 24 Jan 2005 13:05:29 +0100


Hello,=20

sorry to be bothering you guys again with this but
there seems to be a problem with the directory/directorysearcher code in =
mono..

And also it doesn't handle exceptions very well. It just returns `10=B4 =
in this scenario. I had to debug
the mono class libraries to find that: oh, the data it received was =
empty.
Anyway...=20

Thing is, this is using strict LDAP on port 389 and works on =
windows/MS.NET but crashes in mono.

So, what I'm trying to do is this, i have replaced account names and =
server names with [foo]:
---- code begins
	DirectoryEntry de =3D new =
DirectoryEntry("LDAP://[foo-microsoft-server-dns]:389/DC=3Dfoo,DC=3Dbar,D=
C=3Dbaz,DC=3Dmuu"
		,@"ourdomain\myname","password",AuthenticationTypes.ServerBind);
		DirectorySearcher src =3D new =
DirectorySearcher(@"(&(objectclass=3DUser)(cn=3Dmyname))");

		src.SearchRoot =3D de;
		src.SearchScope =3D SearchScope.Subtree;
		src.PropertiesToLoad.Add("cn");
		src.PropertiesToLoad.Add("memberOf");
		src.PropertiesToLoad.Add("givenname");
		src.PropertiesToLoad.Add("sn");
		src.PropertiesToLoad.Add("fullname");
		src.PropertiesToLoad.Add("title");
	SearchResult res =3D src.FindOne();
---- code ends

It crashes on src.FindOne(); Somenow it isn't getting stuff from the =
server..=20

Has anyone else had success in using mono LDAP against a microsoft =
server or am I doing something wrong here?

Maybe this should be a bug report, or is it just Microsoft bending the =
LDAP protocol?

Best Regards

Jonathan Wallmander,=20
Volvo Information Technology