473,396 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Querying Solaris LDAP server

RJN
Hi

I've written a code that queries Windows LDAP server and works fine, but
the same doesn't work when querying Solaris LDAP server.

DirectoryEntry de = new DirectoryEntry("LDAP://server.com");
DirectorySearcher ds = new DirectorySearcher(de);
de.Username = "xxx";
de.Password = "yyy";
de.AuthenticationType = AuthenticationTypes.Secure;
ds.Filter = ("(SAMAccountName=xxx)");
SearchResult sr = ds.FindOne();

Without setting the login credentials I get error that "Server is not
operational". if I set the logon details, I'm getting an error that
"Logon failure, unknown user name or bad password".

Can anyone give me sample code to query Solaris LDAP server?

Regards

Rjn

*** Sent via Developersdex http://www.developersdex.com ***
Dec 26 '06 #1
3 4014
"RJN" <rj*@yahoo.comwrote in message news:el**************@TK2MSFTNGP02.phx.gbl...
Hi

I've written a code that queries Windows LDAP server and works fine, but
the same doesn't work when querying Solaris LDAP server.

DirectoryEntry de = new DirectoryEntry("LDAP://server.com");
DirectorySearcher ds = new DirectorySearcher(de);
de.Username = "xxx";
de.Password = "yyy";
de.AuthenticationType = AuthenticationTypes.Secure;
ds.Filter = ("(SAMAccountName=xxx)");
SearchResult sr = ds.FindOne();

Without setting the login credentials I get error that "Server is not
operational". if I set the logon details, I'm getting an error that
"Logon failure, unknown user name or bad password".

Can anyone give me sample code to query Solaris LDAP server?

Regards

Rjn

*** Sent via Developersdex http://www.developersdex.com ***

Don't use the DirectoryEntry class to start with, use the LDAP wrapper class namespace
System.DirectoryServices.Protocols instead.

A few warning though, Solaris isn't Windows, so you won't find a property named
"sAMAccountName", what exactly are you trying to achieve?
Note that you won't be able to use Secure credentials if the LDAP server doesn't integrate
with other authentication providers on Solaris, use the LdapConnection and start with a
simple bind, when this works, you can try other more secure authentication types.

Here's a sample snip....

using System;
using System.DirectoryServices.Protocols;
using System.Net;
....
// :389 is optional, it's the default listener port! Make sure the Ldap server
listens on this port, else you have to set the port accordingly

using (LdapConnection ldap = new LdapConnection("server.com:389")) {
ldap.AuthType = AuthType.Basic;
ldap.Bind(new NetworkCredential("userName", "usersPwd"));
...
}

Willy.

Dec 26 '06 #2
RJN
Dear Willy

Thanks for the reply. I'm trying to get the user details of logged user
from the login id. I'm having a .Net webservice which is set with
Integrated windows authentication and no anonymous access allowed. I
could get the user's login from Context.User.Identity.Name. I would want
to query the LDAP server based on this.

I read in the LDAP documentation that SAMAccountName is generic and not
windows specific. So I thought I could query any LDAP server based on
this. My problem currently is authenticating the Solaris LDAP server
which I don't face when I query the windows domain controller. Is there
anything wrong in the way I query the LDAP server?

Once I establish the authentication as per your code, how do I continue
querying the LDAP server? Would you mind giving me the code for that?

Regards

Rajesh

*** Sent via Developersdex http://www.developersdex.com ***
Dec 27 '06 #3
"RJN" <rj*@yahoo.comwrote in message news:%2****************@TK2MSFTNGP06.phx.gbl...
Dear Willy

Thanks for the reply. I'm trying to get the user details of logged user
from the login id. I'm having a .Net webservice which is set with
Integrated windows authentication and no anonymous access allowed. I
could get the user's login from Context.User.Identity.Name. I would want
to query the LDAP server based on this.

I read in the LDAP documentation that SAMAccountName is generic and not
windows specific. So I thought I could query any LDAP server based on
this. My problem currently is authenticating the Solaris LDAP server
which I don't face when I query the windows domain controller. Is there
anything wrong in the way I query the LDAP server?

Once I establish the authentication as per your code, how do I continue
querying the LDAP server? Would you mind giving me the code for that?

Regards

Rajesh

*** Sent via Developersdex http://www.developersdex.com ***

CN=SAM-Account-Name or sAMAccountName is a property used by Windows only, it stores the
Logon name of down-level clients running on LanManager, Windows9X and NT4, It's no property
stored on Solaris LDAP servers. Try to bind to the LDAP server using adsiedit from a Windows
client, and query the Solaris LDAP server, you'll see there is no such attribute for the
user object. But there is more, you are trying to authenticate a windows client on an
Solaris LDAP server, this won't work by all means, Windows clients can only be authenticated
by Windows Domain Controllers (for Windows Domain accounts) or Local Account Managers (for
server local accounts). All you can do is retrieve the clients credentials and use basic
authentication through a bind to the LDAP server.

Willy.

Dec 27 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Andres Rosado-Sepulveda | last post by:
Hello, I'm having trouble compiling PHP 4.3.4 on Solaris 8. This is the error message it is showing: -- start -- Undefined first referenced symbol ...
0
by: Mike | last post by:
I'm using ASP and CDO to lookup free busy time on an e2k server. The E2K is locally installed on the IIS server and I'm having no problems accessing resources like public folders, mailboxes, etc....
2
by: James Allan | last post by:
Hello -- I'm trying to get SQL Server 2000 on a Windows 2000 Server to be able to query an Active Directory. We've got two domain servers one Win2000 and one Win2003. However, I'm having...
7
by: Amar | last post by:
I am trying to connect to my college LDAP directory using ASP.NET. This LDap does not have security as it returns only user demographic information. i do not need to bind with a username or...
1
by: Andrew | last post by:
Hey all, Working on revamping our Intranet here and making use of the LDPA, Active Directory, Directory Services, etc. that .Net provides. I am still fairly new on this subject, so the problem...
5
by: Melissa Evans | last post by:
Hi. I'm new to Python. :) I've modified grappy.py, http://www.stacken.kth.se/~mattiasa/projects/grappy/, a postfix policy daemon for greylisting. to use LDAP as a backend instead of SQL (with...
4
by: inetquestion | last post by:
php has been configured with the following two configure lines and core's during "make install" on the PEAR section. Is there something simple i'm missing? Any help would be appreciated. ...
4
by: jllg2000 | last post by:
I got this query: CREATE VIEW viewADContacts AS SELECT , SN , ST State FROM OPENQUERY( ADSI2, 'SELECT Name, SN, ST FROM ''LDAP://presidencia.local/CN=Users,...
4
by: =?Utf-8?B?U3VoYXMgVmVuZ2lsYXQ=?= | last post by:
Hello, I am facing an issue while querying Active directory using C# code with system.DirectoryServices namespace. Here is the path for my LDAP - "LDAP://CN=XY - C++/Unix and other,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.