Permalink
Browse files

auth/cas MDL-16168 CAS crashes if no LDAP is set up

Fix the other two potential places where CAS would crash
if no LDAP server is configured.

Thanks to Mark Nielsen for prompting me to have a deeper look at it.
  • Loading branch information...
1 parent 0e744d4 commit a727aabc500ce0e93d8f4a2e6ea0885c982d3549 @iarenaza iarenaza committed Sep 24, 2010
Showing with 7 additions and 1 deletion.
  1. +7 −1 auth/cas/auth.php
View
@@ -631,6 +631,12 @@ function user_exists($username) {
*/
function sync_users ($bulk_insert_records = 1000, $do_updates = true) {
global $CFG;
+
+ if(empty($this->config->host_url)) {
+ echo "No LDAP server configured for CAS! Syncing disabled.\n";
+ return;
+ }
+
$textlib = textlib_get_instance();
$droptablesql = array(); /// sql commands to drop the table (because session scope could be a problem for
/// some persistent drivers like ODBTP (mssql) or if this function is invoked
@@ -979,7 +985,7 @@ function ldap_bulk_insert($users, $temptable) {
* @return boolean result
*/
function iscreator($username) {
- if ((empty($this->config->attrcreators) && empty($this->config->groupecreators)) or empty($this->config->memberattribute)) {
+ if (empty($this->config->host_url) or (empty($this->config->attrcreators) && empty($this->config->groupecreators)) or empty($this->config->memberattribute)) {
return null;
}
$textlib = textlib_get_instance();

0 comments on commit a727aab

Please sign in to comment.