Changeset 602
- Timestamp:
- 09/29/06 13:33:02 (2 years ago)
- Files:
-
- devel/auth/ldap/lib.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/auth/ldap/lib.php
r555 r602 13 13 * Configuration parameters in config.php: 14 14 * 15 * // LDAP host 15 16 * $CFG->ldap_host = 'localhost'; 17 * // LDAP port 16 18 * $CFG->ldap_port = 389; 19 * // Base DN 17 20 * $CFG->ldap_basedn = 'dc=curverider,dc=co,dc=uk'; 21 * // Bind as 18 22 * $CFG->ldap_bind_dn = 'cn=admin,dc=curverider,dc=co,dc=uk'; 23 * // Password for non anonymous bind 19 24 * $CFG->ldap_bind_pwd = 'secret'; 25 * // Protocol version 20 26 * $CFG->ldap_protocol_version = 3; 27 * // Filter for username, common are cn or uid 28 * $CFG->ldap_filter_attr = 'uid'; 29 * // Search attibutes 30 * $CFG->ldap_search_attr = array('dn', 'ou', 'mail'); 31 * 21 32 */ 22 33 23 34 function ldap_authenticate_user_login($username, $password) { 24 25 35 global $CFG, $messages; 26 36 … … 30 40 } 31 41 42 // LDAP host 32 43 if (!$CFG->ldap_host) { 33 44 // No host defined, switch to plain login … … 36 47 } 37 48 49 // LDAP port 38 50 if (!$CFG->ldap_port) { 39 51 $CFG->ldap_port = 389; 52 } 53 54 // Which filter to apply for the username, e.g. cn or uid 55 if (!$CFG->ldap_filter_attr) { 56 $CFG->ldap_filter_attr = 'uid'; 57 } 58 59 // Which search attributes to return 60 if (!$CFG->ldap_search_attr) { 61 $CFG->ldap_search_attr = array('dn'); 40 62 } 41 63 … … 46 68 $version = 3; 47 69 70 // LDAP protocol version 48 71 if ($CFG->ldap_protocol_version) { 49 72 $version = $CFG->ldap_protocol_version; … … 70 93 if ($ldapbind) { 71 94 // Perform LDAP search 72 $sr = @ldap_search($ds, $CFG->ldap_basedn, "cn=" . $username);95 $sr = @ldap_search($ds, $CFG->ldap_basedn, $CFG->ldap_filter_attr ."=". $username, $CFG->ldap_search_attr); 73 96 74 97 if ($sr) {
