if (!isset($config->ldap_bind_pw)) {
$config->ldap_bind_pw = "";
}
+ if (empty($config->ldap_version)) {
+ $config->ldap_version = "2";
+ }
?>
<tr valign="top" BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>ldap_host_url:</TD>
</TD>
</TR>
+<tr valign="top" BGCOLOR="<?php echo $THEME->cellheading2 ?>">
+ <TD ALIGN=RIGHT><P>ldap_version:</TD>
+ <TD>
+ <?php
+ $versions[2] = "2";
+ $versions[3] = "3";
+ choose_from_menu($versions, "ldap_version", $config->ldap_version, "");
+ if (isset($err["ldap_version"])) formerr($err["ldap_version"]);
+ ?>
+ </TD>
+ <TD>
+ <?php print_string("auth_ldap_version","auth") ?>
+ </TD>
+</TR>
+
<TR VALIGN=TOP BGCOLOR="<?php echo $THEME->cellheading2 ?>">
<TD ALIGN=RIGHT><P>ldap_contexts:</TD>
<TD>
$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 {
$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.\r
If the given username and password are valid, Moodle creates a new user \r
entry in its database. This module can read user attributes from LDAP and prefill \r