]> git.mjollnir.org Git - moodle.git/commitdiff
Thanks to Dave Lopata <Dave@Lopata.Net>, Moodle now supports LDAP 3
authormoodler <moodler>
Thu, 15 Apr 2004 15:57:32 +0000 (15:57 +0000)
committermoodler <moodler>
Thu, 15 Apr 2004 15:57:32 +0000 (15:57 +0000)
auth/ldap/config.html
auth/ldap/lib.php
lang/en/auth.php

index 16238b8d67405a05acc3c2734549512e1484c2f3..e09629726c08a1054b95c92b948b1b9ecbc36f3f 100644 (file)
@@ -17,6 +17,9 @@
     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>
index 0fd1555148c5f0d3620e8905e96c16a74a1cb877..42c519dde1d9d254166e4e55e28c170a3e8d9c62 100644 (file)
@@ -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 {
index 06edb9fbaf4a5bbe28d8fe0cb492218998d80ce1..70a22c9cf83d49bae86194d1d4d904643a651c19 100644 (file)
@@ -31,6 +31,7 @@ $string['auth_ldap_memberattribute'] = 'Specify user member attribute, when user
 $string['auth_ldap_search_sub'] = 'Put value &lt;&gt; 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