From d8627a477e7b1569d0d5d29b97e0ba7a693d2421 Mon Sep 17 00:00:00 2001 From: moodler Date: Thu, 15 Apr 2004 15:57:32 +0000 Subject: [PATCH] Thanks to Dave Lopata , Moodle now supports LDAP 3 --- auth/ldap/config.html | 18 ++++++++++++++++++ auth/ldap/lib.php | 4 ++++ lang/en/auth.php | 1 + 3 files changed, 23 insertions(+) diff --git a/auth/ldap/config.html b/auth/ldap/config.html index 16238b8d67..e09629726c 100644 --- a/auth/ldap/config.html +++ b/auth/ldap/config.html @@ -17,6 +17,9 @@ if (!isset($config->ldap_bind_pw)) { $config->ldap_bind_pw = ""; } + if (empty($config->ldap_version)) { + $config->ldap_version = "2"; + } ?>

ldap_host_url: @@ -29,6 +32,21 @@ + +

ldap_version: + + ldap_version, ""); + if (isset($err["ldap_version"])) formerr($err["ldap_version"]); + ?> + + + + + +

ldap_contexts: diff --git a/auth/ldap/lib.php b/auth/ldap/lib.php index 0fd1555148..42c519dde1 100644 --- a/auth/ldap/lib.php +++ b/auth/ldap/lib.php @@ -221,6 +221,10 @@ function auth_ldap_connect(){ $result = ldap_connect($CFG->ldap_host_url); if ($result) { + if (!empty($CFG->ldap_version)) { + ldap_set_option($result, LDAP_OPT_PROTOCOL_VERSION, $CFG->ldap_version); + } + return $result; } else { diff --git a/lang/en/auth.php b/lang/en/auth.php index 06edb9fbaf..70a22c9cf8 100644 --- a/lang/en/auth.php +++ b/lang/en/auth.php @@ -31,6 +31,7 @@ $string['auth_ldap_memberattribute'] = 'Specify user member attribute, when user $string['auth_ldap_search_sub'] = 'Put value <> 0 if you like to search users from subcontexts.'; $string['auth_ldap_update_userinfo'] = 'Update user information (firstname, lastname, address..) from LDAP to Moodle. Look at /auth/ldap/attr_mappings.php for mapping information'; $string['auth_ldap_user_attribute'] = 'The attribute used to name/search users. Usually \'cn\'.'; +$string['auth_ldap_version'] = 'The version of the LDAP protocol your server is using.'; $string['auth_ldapdescription'] = 'This method provides authentication against an external LDAP server. If the given username and password are valid, Moodle creates a new user entry in its database. This module can read user attributes from LDAP and prefill -- 2.39.5