Permalink
Browse files

Allow config how aliases are derefered.

  • Loading branch information...
1 parent 624dc86 commit 8021cc54c11c7ec67d84ff61e7752234b81f255b paca70 committed Nov 8, 2004
Showing with 24 additions and 6 deletions.
  1. +16 −0 auth/ldap/config.html
  2. +8 −6 auth/ldap/lib.php
View
@@ -5,6 +5,7 @@
optional_variable($config->ldap_user_type, "");
optional_variable($config->ldap_user_attribute, "");
optional_variable($config->ldap_search_sub, "");
+ optional_variable($config->ldap_opt_deref, "");
optional_variable($config->ldap_bind_dn, "");
optional_variable($config->ldap_bind_pw, "");
optional_variable($config->ldap_version, "2");
@@ -163,6 +164,21 @@
<?php print_string("auth_ldap_search_sub","auth") ?>
</td>
</tr>
+<tr valign="top" bgcolor="<?php echo $THEME->cellheading2 ?>">
+ <td align="right"><P>ldap_opt_deref:</td>
+ <td>
+ <?php
+ $opt_deref[LDAP_DEREF_NEVER] = get_string("no");
+ $opt_deref[LDAP_DEREF_ALWAYS] = get_string("yes");
+ choose_from_menu($opt_deref, "ldap_opt_deref", $config->ldap_opt_deref, LDAP_DEREF_NEVER);
+ if (isset($err["ldap_opt_deref"])) formerr($err["ldap_opt_deref"]);
+ ?>
+ </td>
+ <td>
+ <?php print_string("auth_ldap_opt_deref","auth") ?>
+ </td>
+</tr>
+
<tr valign="top" bgcolor="<?php echo $THEME->cellheading2 ?>">
View
@@ -1094,7 +1094,7 @@ function auth_ldap_connect($binddn='',$bindpwd=''){
foreach ($urls as $server){
$connresult = ldap_connect($server);
//ldap_connect returns ALWAYS true
-
+
if (!empty($CFG->ldap_version)) {
ldap_set_option($connresult, LDAP_OPT_PROTOCOL_VERSION, $CFG->ldap_version);
}
@@ -1105,8 +1105,12 @@ function auth_ldap_connect($binddn='',$bindpwd=''){
} else {
//bind anonymously
$bindresult=@ldap_bind($connresult);
- }
-
+ }
+
+ if (isset($CFG->ldap_opt_deref)) {
+ ldap_set_option($connresult, LDAP_OPT_DEREF, $CFG->ldap_opt_deref);
+ }
+
if ($bindresult) {
return $connresult;
}
@@ -1219,9 +1223,7 @@ function auth_ldap_get_userlist($filter="*") {
if ($CFG->ldap_search_sub) {
//use ldap_search to find first user from subtree
- $ldap_result = ldap_search($ldapconnection, $context,
- $filter,
- array($CFG->ldap_user_attribute));
+ $ldap_result = ldap_search($ldapconnection, $context,$filter,array($CFG->ldap_user_attribute));
} else {
//search only in this context
$ldap_result = ldap_list($ldapconnection, $context,

0 comments on commit 8021cc5

Please sign in to comment.