php5-ldap - Useful ldap snipet
This is a super useful php snipet to debug the ldap search: #============================================================================== # Configuration #============================================================================== # LDAP $ldap_url = "ldaps://ldap.server1 ldaps://ldap.server2"; $ldap_binddn = "cn=manager,dc=example,dc=com"; $ldap_bindpw = "P@ssw0rd"; $ldap_base = " dc=example,dc=com "; #$ldap_filter = "(&(objectClass=person)(uid={login}))"; $ldap_filter = "(&(objectClass=user)(sAMAccountName={login})(!(userAccountControl:1.2.840.113556.1.4.803:=2)))"; $login = "genius"; # Connect to LDAP $ldap = ldap_connect($ldap_url); ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0); # Bind if ( isset($ldap_binddn) && isset($ldap_bindpw) ) { $bind = ldap_bind($ldap, $ldap_binddn, $ldap_bindpw); } else { $bind = ldap_b...