Permalink
Browse files

Fixed a but that caused problems with usernames (shibboleth attribute…

…) that contained uppercase letters
  • Loading branch information...
1 parent 9c257d8 commit 21e00abf4251691f40f65f4f1026e707a505ee1e exe-cutor committed Jul 11, 2007
Showing with 11 additions and 5 deletions.
  1. +10 −4 auth/shibboleth/auth.php
  2. +1 −1 auth/shibboleth/index.php
@@ -51,7 +51,7 @@ function user_login($username, $password) {
// If we are in the shibboleth directory then we trust the server var
if (!empty($_SERVER[$this->config->user_attribute])) {
- return ($_SERVER[$this->config->user_attribute] == $username);
+ return (strtolower($_SERVER[$this->config->user_attribute]) == strtolower($username));
} else {
// If we are not, the user has used the manual login and the login name is
// unknown, so we return false.
@@ -87,7 +87,13 @@ function get_userinfo($username) {
$search_attribs = array();
foreach ($attrmap as $key=>$value) {
- $result[$key] = $this->get_first_string($_SERVER[$value]);
+
+ // Make usename lowercase
+ if ($key == 'username'){
+ $result[$key] = strtolower($this->get_first_string($_SERVER[$value]));
+ } else {
+ $result[$key] = $this->get_first_string($_SERVER[$value]);
+ }
}
// Provide an API to modify the information to fit the Moodle internal
@@ -118,7 +124,7 @@ function get_attributes() {
$moodleattributes = array();
foreach ($fields as $field) {
- if ($configarray["field_map_$field"]) {
+ if (isset($configarray["field_map_$field"])) {
$moodleattributes[$field] = $configarray["field_map_$field"];
}
}
@@ -218,4 +224,4 @@ function get_first_string($string) {
}
}
-?>
+?>
@@ -26,7 +26,7 @@
/// If we can find the Shibboleth attribute, save it in session and return to main login page
if (!empty($_SERVER[$pluginconfig->user_attribute])) { // Shibboleth auto-login
- $frm->username = $_SERVER[$pluginconfig->user_attribute];
+ $frm->username = strtolower($_SERVER[$pluginconfig->user_attribute]);
$frm->password = substr(base64_encode($_SERVER[$pluginconfig->user_attribute]),0,8);
// The random password consists of the first 8 letters of the base 64 encoded user ID
// This password is never used unless the user account is converted to manual

0 comments on commit 21e00ab

Please sign in to comment.