Disable the old conversion from Windows-1252 unless the wiki has $wgLegacyEncoding set.

Has been done since r6920 (code added in r4438).
Also skipping the hashing if the windows-1252 password is the same we already probed.
The function_exists is not needed, since in such case GlobalFunctions would make it a wrapper to Fallback::iconv()
This commit is contained in:
Platonides 2011-02-26 22:30:41 +00:00
parent 2e33fb3ff6
commit 36999e2bf9
2 changed files with 8 additions and 3 deletions

View file

@ -42,6 +42,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
by the page, but $wgAllowUserJs is set to false.
* Pure "Skin" class based custom skins are no longer supported, all custom skins
should be put together using SkinTemplate and BaseTemplate or QuickTemplate.
* The transliteration for passwords in case they were migrated from an old Latin-1
install (previous to MediaWiki 1.5) is now only done for wikis with
$wgLegacyEncoding set.
=== New features in 1.18 ===
* Added a special page, disabled by default, that allows users with the

View file

@ -2794,7 +2794,7 @@ class User {
* @return Boolean: True if the given password is correct, otherwise False.
*/
function checkPassword( $password ) {
global $wgAuth;
global $wgAuth, $wgLegacyEncoding;
$this->load();
// Even though we stop people from creating passwords that
@ -2817,11 +2817,13 @@ class User {
}
if ( self::comparePasswords( $this->mPassword, $password, $this->mId ) ) {
return true;
} elseif ( function_exists( 'iconv' ) ) {
} elseif ( $wgLegacyEncoding ) {
# Some wikis were converted from ISO 8859-1 to UTF-8, the passwords can't be converted
# Check for this with iconv
$cp1252Password = iconv( 'UTF-8', 'WINDOWS-1252//TRANSLIT', $password );
if ( self::comparePasswords( $this->mPassword, $cp1252Password, $this->mId ) ) {
if ( $cp1252Password != $password &&
self::comparePasswords( $this->mPassword, $cp1252Password, $this->mId ) )
{
return true;
}
}