LDAP Authentication Using CGI + TCL
2 answers
Here is an example that will connect to an ldap server and get all ldap information about an email address:
package require ldap
set sEmailAddress "user@example.com"
set handle [::ldap::connect example.com 3268]
ldap::bind $handle
set result [::ldap::search $handle "dc=example,dc=com" "(mail=$sEmailAddress)" {sAMAccountName}]
foreach {object attributes} $result {
foreach {name val} $attributes {
puts "$name\t$val"
}
}
+1
source to share
Here ldap package . You first connect with some "connected user" who can see everyone. Then you search for a user based on some attribute such as an email address or sAMAccountName . If the user exists, re-link with the given password and full user path.
+1
source to share