Skip to content

Commit

Permalink
Fixed mistake on url-trimming and added some debug info.
Browse files Browse the repository at this point in the history
  • Loading branch information
paca70 committed Mar 9, 2005
1 parent 30972fe commit 879d932
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions auth/ldap/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ function auth_ldap_connect($binddn='',$bindpwd=''){
$urls = explode(";",$CFG->ldap_host_url);

foreach ($urls as $server){
$url = trim($url);
$url = trim($server);
if (empty($url)) {
continue;
}
Expand All @@ -1256,22 +1256,24 @@ function auth_ldap_connect($binddn='',$bindpwd=''){
if (!empty($binddn)){
//bind with search-user
$bindresult=@ldap_bind($connresult, $binddn,$bindpwd);
} else {
//bind anonymously
} else {
//bind anonymously
$bindresult=@ldap_bind($connresult);
}

if (isset($CFG->ldap_opt_deref)) {
if (!empty($CFG->ldap_opt_deref)) {
ldap_set_option($connresult, LDAP_OPT_DEREF, $CFG->ldap_opt_deref);
}
}

if ($bindresult) {
return $connresult;
}
}

$debuginfo == "<br/>Server: '$server' <br/> Connection: '$connresult'<br/> Bind result: '$bindresult'</br>";
}

//If any of servers are alive we have already returned connection
error("LDAP-module cannot connect any LDAP servers : $CFG->ldap_host_url");
error("LDAP-module cannot connect any LDAP servers : $debuginfo");
return false;
}

Expand Down

0 comments on commit 879d932

Please sign in to comment.