I have code that works correctly to connect to an Active Directory server:
Dim oDSObj: Set oDSObj = GetObject("LDAP:")
Dim oAuth: Set oAuth = oDSObj.OpenDSObject("LDAP://ldap.domain.com", "DOMAIN\username", "password", 1)
However, I cannot understand the syntax to make this work against OpenLDAP Server:
Dim oDSObj: Set oDSObj = GetObject("LDAP:")
Dim oAuth: Set oAuth = oDSObj.OpenDSObject("LDAP://ldap.domain.com/ou=Users", "username", "password", 1)
Honestly, I'm a little n00b when it comes to LDAP, so I don’t understand what dc vs cn vs ou is (I know that they are behind the unit of organization, common name, etc.), but I don’t know ' t get when you need to relate this to requests.
As soon as I connect to the Active Directory server, the following code will request it:
dc = ""
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Provider = "ADSDSOObject"
oConn.Open "Ads Provider", "DOMAIN\username", "password" '
Dim rs: Set rs = oConn.Execute("<LDAP://ldap.domain.com" & dc & ">;(& (objectCategory=person)(objectClass=user)(sAMAccountName=" & GetLDAPUserName(sPerson) & "));name,mail,telephoneNumber;subtree")
But I understand that the name sAMAccountName is specific to AD, so a different syntax is needed for openLDAP code.
User "ldapuser" with the password "password", which is stored here: NU = Users, DC = domain, DC = COM
LDAP ?