r82868 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82867‎ | r82868 | r82869 >
Date:22:30, 26 February 2011
Author:platonides
Status:ok
Tags:
Comment:
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()
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/User.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/User.php
@@ -2794,7 +2794,7 @@
27952795 * @return Boolean: True if the given password is correct, otherwise False.
27962796 */
27972797 function checkPassword( $password ) {
2798 - global $wgAuth;
 2798+ global $wgAuth, $wgLegacyEncoding;
27992799 $this->load();
28002800
28012801 // Even though we stop people from creating passwords that
@@ -2817,11 +2817,13 @@
28182818 }
28192819 if ( self::comparePasswords( $this->mPassword, $password, $this->mId ) ) {
28202820 return true;
2821 - } elseif ( function_exists( 'iconv' ) ) {
 2821+ } elseif ( $wgLegacyEncoding ) {
28222822 # Some wikis were converted from ISO 8859-1 to UTF-8, the passwords can't be converted
28232823 # Check for this with iconv
28242824 $cp1252Password = iconv( 'UTF-8', 'WINDOWS-1252//TRANSLIT', $password );
2825 - if ( self::comparePasswords( $this->mPassword, $cp1252Password, $this->mId ) ) {
 2825+ if ( $cp1252Password != $password &&
 2826+ self::comparePasswords( $this->mPassword, $cp1252Password, $this->mId ) )
 2827+ {
28262828 return true;
28272829 }
28282830 }
Index: trunk/phase3/RELEASE-NOTES
@@ -42,6 +42,9 @@
4343 by the page, but $wgAllowUserJs is set to false.
4444 * Pure "Skin" class based custom skins are no longer supported, all custom skins
4545 should be put together using SkinTemplate and BaseTemplate or QuickTemplate.
 46+* The transliteration for passwords in case they were migrated from an old Latin-1
 47+ install (previous to MediaWiki 1.5) is now only done for wikis with
 48+ $wgLegacyEncoding set.
4649
4750 === New features in 1.18 ===
4851 * Added a special page, disabled by default, that allows users with the

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r4438committing Hendrik Brummermann's checkPassword() patch, plus some modificatio...timstarling11:13, 30 July 2004
r6920uncommenting ISO8859-1 converted password fixtimstarling10:49, 4 January 2005

Status & tagging log