Skip to content

Commit

Permalink
LDAP servers being down or unavailable should not prevent login - we …
Browse files Browse the repository at this point in the history
…now fail with a notice() rather than with an error()
  • Loading branch information
martinlanghoff committed Aug 17, 2005
1 parent 1a6649e commit c53889f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions enrol/ldap/enrol.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function get_user_courses(&$user, $type) {
$ldap_connection = $this->enrol_ldap_connect(); $ldap_connection = $this->enrol_ldap_connect();
if (!$ldap_connection) { if (!$ldap_connection) {
@ldap_close($ldap_connection); @ldap_close($ldap_connection);
error("LDAP-module cannot connect to server: $CFG->ldap_host_url"); notify("LDAP-module cannot connect to server: $CFG->ldap_host_url");
return false; return false;
} }


Expand Down Expand Up @@ -150,7 +150,7 @@ function sync_enrolments($type, $enrol) {
$ldap_connection = $this->enrol_ldap_connect(); $ldap_connection = $this->enrol_ldap_connect();
if (!$ldap_connection) { if (!$ldap_connection) {
@ldap_close($ldap_connection); @ldap_close($ldap_connection);
error("LDAP-module cannot connect to server: $CFG->ldap_host_url"); notify("LDAP-module cannot connect to server: $CFG->ldap_host_url");
return false; return false;
} }


Expand Down Expand Up @@ -444,7 +444,7 @@ function enrol_ldap_connect(){
return $result; return $result;


} else { } else {
error("LDAP-module cannot connect to server: $CFG->enrol_ldap_host_url"); notify("LDAP-module cannot connect to server: $CFG->enrol_ldap_host_url");
return false; return false;
} }
} }
Expand All @@ -458,14 +458,14 @@ function enrol_ldap_bind($ldap_connection){
if ( ! empty($CFG->enrol_ldap_bind_dn) ){ if ( ! empty($CFG->enrol_ldap_bind_dn) ){
//bind with search-user //bind with search-user
if (!ldap_bind($ldap_connection, $CFG->enrol_ldap_bind_dn,$CFG->enrol_ldap_bind_pw)){ if (!ldap_bind($ldap_connection, $CFG->enrol_ldap_bind_dn,$CFG->enrol_ldap_bind_pw)){
error("Error: could not bind ldap with ldap_bind_dn/pw"); notify("Error: could not bind ldap with ldap_bind_dn/pw");
return false; return false;
} }


} else { } else {
//bind anonymously //bind anonymously
if ( !ldap_bind($ldap_connection)){ if ( !ldap_bind($ldap_connection)){
error("Error: could not bind ldap anonymously"); notify("Error: could not bind ldap anonymously");
return false; return false;
} }
} }
Expand Down Expand Up @@ -615,7 +615,7 @@ function create_course ($course_ext,$skip_fix_course_sortorder=0){
add_to_log($newcourseid, "course", "new", "view.php?id=$newcourseid", "enrol/ldap auto-creation"); add_to_log($newcourseid, "course", "new", "view.php?id=$newcourseid", "enrol/ldap auto-creation");
} else { } else {
error_log("Could not create new course from LDAP from DN:" . $course_ext['dn']); error_log("Could not create new course from LDAP from DN:" . $course_ext['dn']);
error("Serious Error! Could not create the new course!"); notify("Serious Error! Could not create the new course!");
return false; return false;
} }


Expand Down

0 comments on commit c53889f

Please sign in to comment.