I have been strugging with this one.
I am trying to authenticate users against a LDAP server (Novell). By trial and error, I got following code to work but the issue is that I had to specify the whole ldapPath. i.e. I just want to search the whole LDAP tree for the given userid and authenticate.
Following code won't work if the user is in ou=external or ou=int8.
How can I make it generic so that it will search the whole tree? I tried following, but it didn't work:
ldapServer = "LDAP://servername:389/uid=#username#,dc=mydomain,dc=com"
Thanks in advance for any help.
-----------------
sub login3(userName, password)
Dim ldapServer, dso, lobjUser
On Error resume next
' Construct the FQDN
ldapServer = "LDAP://servername:389/uid=#username#,ou=int7,ou=internal,ou=people,c=us,cn=users,dc=mydomain,dc=com"
ldapServer = replace(ldapServer, "#username#", userName)
' Connect to the LDAP Directory
Set dso = GetObject("LDAP:")
'parse the username
userName = Mid(ldapserver, InStr(8, ldapserver, "/") + 1)
'Validate the User Name and Password
Set lobjUser = ds
penDSObject(ldapserver, userName, password, 0)
If Err.number <> 0 Then
Response.Write "<font color=red><STRONG>AUTHENTICATION FAILURE!</STRONG></font>"
Set lobjUser = nothing
Set dso = nothing
Else
Response.Write "<font color=green><STRONG>SUCCESS!</STRONG></font>"
end if
end sub
I am trying to authenticate users against a LDAP server (Novell). By trial and error, I got following code to work but the issue is that I had to specify the whole ldapPath. i.e. I just want to search the whole LDAP tree for the given userid and authenticate.
Following code won't work if the user is in ou=external or ou=int8.
How can I make it generic so that it will search the whole tree? I tried following, but it didn't work:
ldapServer = "LDAP://servername:389/uid=#username#,dc=mydomain,dc=com"
Thanks in advance for any help.
-----------------
sub login3(userName, password)
Dim ldapServer, dso, lobjUser
On Error resume next
' Construct the FQDN
ldapServer = "LDAP://servername:389/uid=#username#,ou=int7,ou=internal,ou=people,c=us,cn=users,dc=mydomain,dc=com"
ldapServer = replace(ldapServer, "#username#", userName)
' Connect to the LDAP Directory
Set dso = GetObject("LDAP:")
'parse the username
userName = Mid(ldapserver, InStr(8, ldapserver, "/") + 1)
'Validate the User Name and Password
Set lobjUser = ds
If Err.number <> 0 Then
Response.Write "<font color=red><STRONG>AUTHENTICATION FAILURE!</STRONG></font>"
Set lobjUser = nothing
Set dso = nothing
Else
Response.Write "<font color=green><STRONG>SUCCESS!</STRONG></font>"
end if
end sub