X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fpassword%2FMWOldPassword.php;h=c48b6e61d57e32a4d98b8b709e27af53842107a4;hp=360485e36485d8c3fd953d41bbaaea778cdebad9;hb=4260b0f8a9bb89d92c39a61d8c48a31007b7240f;hpb=7a157e0bea41b7b17c9b4395c6668d9b5b341a96 diff --git a/includes/password/MWOldPassword.php b/includes/password/MWOldPassword.php index 360485e364..c48b6e61d5 100644 --- a/includes/password/MWOldPassword.php +++ b/includes/password/MWOldPassword.php @@ -36,8 +36,16 @@ class MWOldPassword extends ParameterizedPassword { } public function crypt( $plaintext ) { - $this->args = []; - $this->hash = md5( $plaintext ); + if ( count( $this->args ) === 1 ) { + // Accept (but do not generate) salted passwords with :A: prefix. + // These are actually B-type passwords, but an error in a previous + // version of MediaWiki caused them to be written with an :A: + // prefix. + $this->hash = md5( $this->args[0] . '-' . md5( $plaintext ) ); + } else { + $this->args = []; + $this->hash = md5( $plaintext ); + } if ( !is_string( $this->hash ) || strlen( $this->hash ) < 32 ) { throw new PasswordError( 'Error when hashing password.' );