http://www.mediawiki.org/wiki/Special:Code/MediaWiki/82868

Revision: 82868
Author:   platonides
Date:     2011-02-26 22:30:41 +0000 (Sat, 26 Feb 2011)
Log Message:
-----------
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
    trunk/phase3/includes/User.php

Modified: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES  2011-02-26 21:49:42 UTC (rev 82867)
+++ trunk/phase3/RELEASE-NOTES  2011-02-26 22:30:41 UTC (rev 82868)
@@ -42,6 +42,9 @@
   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

Modified: trunk/phase3/includes/User.php
===================================================================
--- trunk/phase3/includes/User.php      2011-02-26 21:49:42 UTC (rev 82867)
+++ trunk/phase3/includes/User.php      2011-02-26 22:30:41 UTC (rev 82868)
@@ -2794,7 +2794,7 @@
         * @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 @@
                }
                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;
                        }
                }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to