| @@ -9,9 +9,9 @@ | ||
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Implementation of vBulletin v4.x Converter. |
| 12 | 12 | * |
| 13 | - * @since 2.3.0 bbPress (r4724) | |
| 13 | + * @since 2.2.0 bbPress (r4101) | |
| 14 | 14 | * |
| 15 | 15 | * @link Codex Docs https://codex.bbpress.org/import-forums/vbulletin |
| 16 | 16 | */ |
| 17 | 17 | class vBulletin extends BBP_Converter_Base { |
| @@ -540,9 +540,9 @@ | ||
| 540 | 540 | $this->field_map[] = array( |
| 541 | 541 | 'from_tablename' => 'user', |
| 542 | 542 | 'from_fieldname' => 'salt', |
| 543 | 543 | 'to_type' => 'user', |
| 544 | - 'to_fieldname' => '_bbp_salt' | |
| 544 | + 'to_fieldname' => '' | |
| 545 | 545 | ); |
| 546 | 546 | |
| 547 | 547 | // User password verify class (Stored in usermeta for verifying password) |
| 548 | 548 | $this->field_map[] = array( |
| @@ -634,16 +634,17 @@ | ||
| 634 | 634 | } |
| 635 | 635 | |
| 636 | 636 | |
| 637 | 637 | /** |
| 638 | - * This method is to save the salt and password together. That | |
| 639 | - * way when we authenticate it we can get it out of the database | |
| 640 | - * as one value. Array values are auto sanitized by WordPress. | |
| 638 | + * This method saves the salt and password together so they can be retrieved | |
| 639 | + * as one value during authentication. WordPress unslashes metadata values, | |
| 640 | + * so the salt is pre-slashed to preserve vBulletin's printable ASCII salts. | |
| 641 | + * Password hashes are hexadecimal and do not require slashing. | |
| 641 | 642 | */ |
| 642 | 643 | public function callback_savepass( $field, $row ) { |
| 643 | 644 | $pass_array = array( |
| 644 | 645 | 'hash' => $field, |
| 645 | - 'salt' => $row['salt'] | |
| 646 | + 'salt' => isset( $row['salt'] ) ? wp_slash( (string) $row['salt'] ) : '' | |
| 646 | 647 | ); |
| 647 | 648 | |
| 648 | 649 | return $pass_array; |
| 649 | 650 | } |
| @@ -655,18 +656,12 @@ | ||
| 655 | 656 | */ |
| 656 | 657 | public function authenticate_pass( $password, $serialized_pass ) { |
| 657 | 658 | |
| 658 | 659 | // Unserialize the password, with safeguards |
| 659 | - $pass_array = unserialize( | |
| 660 | - $serialized_pass, | |
| 661 | - array( | |
| 662 | - 'allowed_classes' => false, | |
| 663 | - 'max_depth' => 1 | |
| 664 | - ) | |
| 665 | - ); | |
| 660 | + $pass_array = $this->unserialize_pass( $serialized_pass ); | |
| 666 | 661 | |
| 667 | - // Bail if missing values | |
| 668 | - if ( ! is_array( $pass_array ) || ! isset( $pass_array['hash'], $pass_array['salt'] ) ) { | |
| 662 | + // Bail if missing or invalid values | |
| 663 | + if ( ! is_string( $password ) || ! is_array( $pass_array ) || ! isset( $pass_array['hash'], $pass_array['salt'] ) || ! is_string( $pass_array['hash'] ) || ! is_string( $pass_array['salt'] ) ) { | |
| 669 | 664 | return false; |
| 670 | 665 | } |
| 671 | 666 | |
| 672 | 667 | // Return comparison |