75ab50c70e
This hardens WordPress against a common vector which uses multiple user identifiers in a single `system.multicall` call. In the event that authentication fails, all following authentication attempts ''in that call'' will also fail. Props dd32, johnbillion. Fixes #34336 git-svn-id: https://develop.svn.wordpress.org/trunk@35366 602fd350-edb4-49c9-b593-d223f7449a82
40 lines
945 B
PHP
40 lines
945 B
PHP
<?php
|
|
include_once(ABSPATH . 'wp-admin/includes/admin.php');
|
|
include_once(ABSPATH . WPINC . '/class-IXR.php');
|
|
include_once(ABSPATH . WPINC . '/class-wp-xmlrpc-server.php');
|
|
|
|
class WP_XMLRPC_UnitTestCase extends WP_UnitTestCase {
|
|
protected $myxmlrpcserver;
|
|
|
|
function setUp() {
|
|
parent::setUp();
|
|
|
|
add_filter( 'pre_option_enable_xmlrpc', '__return_true' );
|
|
|
|
$this->myxmlrpcserver = new WP_XMLRPC_Server_UnitTestable();
|
|
}
|
|
|
|
function tearDown() {
|
|
remove_filter( 'pre_option_enable_xmlrpc', '__return_true' );
|
|
|
|
$this->myxmlrpcserver->reset_failed_auth();
|
|
|
|
$this->remove_added_uploads();
|
|
|
|
parent::tearDown();
|
|
}
|
|
|
|
protected function make_user_by_role( $role ) {
|
|
return self::factory()->user->create( array(
|
|
'user_login' => $role,
|
|
'user_pass' => $role,
|
|
'role' => $role
|
|
));
|
|
}
|
|
}
|
|
|
|
class WP_XMLRPC_Server_UnitTestable extends wp_xmlrpc_server {
|
|
public function reset_failed_auth() {
|
|
$this->auth_failed = false;
|
|
}
|
|
} |