Skip to content

Commit

Permalink
MDL-20365 auth_db: Warning users about case sensitive plain passwords
Browse files Browse the repository at this point in the history
Also, changing returned passwords to lower case when
maching against an md5() string or a sha1() string.
  • Loading branch information
David Monllao committed Nov 27, 2014
1 parent bc92aac commit c00cbdc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions auth/db/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ function user_login($username, $password) {
if ($this->config->passtype === 'plaintext') {
return ($fromdb == $extpassword);
} else if ($this->config->passtype === 'md5') {
return ($fromdb == md5($extpassword));
return (strtolower($fromdb) == md5($extpassword));
} else if ($this->config->passtype === 'sha1') {
return ($fromdb == sha1($extpassword));
return (strtolower($fromdb) == sha1($extpassword));
} else if ($this->config->passtype === 'saltedcrypt') {
require_once($CFG->libdir.'/password_compat/lib/password.php');
return password_verify($extpassword, $fromdb);
Expand Down
7 changes: 7 additions & 0 deletions auth/db/upgrade.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This files describes API changes in /auth/db/*,
information provided here is intended especially for developers.

=== 2.9 ===

* Plain text password matching is now always case sensitive, it does not
depend on the database sensitiveness anymore.

0 comments on commit c00cbdc

Please sign in to comment.