Search Results return nothing from Netscape 4.16 LDAP

R

Rosanne Rohana

I'm trying for return user info (first name, last name, etc.) from a
Netscape 4.16 LDAP server using the System.DirectoryServices. I'm able to
get authenticated successfully, but when I attempt to return search results
nothing ever comes back. For example, "result = searcher.FindOne()" always
returns "nothing" and the "searcher.FindAll" collection always return a
count of zero. I've tried many different filters and PropertiesToLoad. Some
help would be greatly appreciated. Some test code is below.




Public Sub testLDAP()
Dim HostIPName = "thedomain.com"
Dim HostIPPort As String = "389"
Dim userID = "testuser"
Dim Password As String = "passw"
Dim orgUnit As String = "ou=Employees, ou=People"
Dim organization As String = "o=MyCompany.com"
Dim dn As String = "uid=" + userID + "," + orgUnit + "," +
organization

Dim entry As New DirectoryEntry("LDAP://" & HostIPName & ":" &
HostIPPort, dn, Password, AuthenticationTypes.None)

Dim ValidateUser As Boolean = False

'This will Authenticate
Dim native As Object = entry.NativeObject

ValidateUser = True

MsgBox("ValidateUser = True")

Dim searcher As New DirectorySearcher(entry)
With searcher
.Filter = "(&(uid=" & userID & "))"
.PropertiesToLoad.Add("givenname") 'First
.PropertiesToLoad.Add("sn") 'Last
.PropertiesToLoad.Add("cn") 'Full
End With

Dim result As System.DirectoryServices.SearchResult
Dim tempEntry As DirectoryEntry

result = searcher.FindOne()

MsgBox(result)

'try FindAll ???
For Each result In searcher.FindAll
MsgBox(result.ToString)
tempEntry = result.GetDirectoryEntry
MsgBox(tempEntry.Password)
MsgBox(tempEntry.Name)
MsgBox(tempEntry.Path)
Next
End Sub
 
R

Rosanne Rohana

No luck. Same symptoms. I'm able to authenticate, but no results are
returned.

To authenticate, I had to change the following...
Dim oRoot As DirectoryEntry = New DirectoryEntry("LDAP://" &
ldapServerName, _
"uid=testuser,ou=Employees,ou=People,o=mydomainname.com","passw",AuthenticationType.none)

Could my username on the server be configured to not allow ldap searching?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top