PluginProbe
The WP Remote WordPress Plugin / 5.09
The WP Remote WordPress Plugin v5.09
6.72 6.69 6.65 6.62 6.48 6.47 4.87 4.97 5.05 5.09 5.16 5.22 5.24 5.25 5.38 5.41 5.42 5.45 5.47 5.53 5.56 5.65 5.68 5.72 5.73 All 53 releases
← All changes | account.php +29 -2 5.165.09 View file →
@@ -5,11 +5,12 @@
5 5 class WPRAccount {
6 6 public $settings;
7 7 public $public;
8 8 public $secret;
9 + public $sig_match;
9 10 public static $api_public_key = 'bvApiPublic';
10 11 public static $accounts_list = 'bvAccountsList';
11 -
12 +
12 13 public function __construct($settings, $public, $secret) {
13 14 $this->settings = $settings;
14 15 $this->public = $public;
15 16 $this->secret = $secret;
@@ -158,10 +159,36 @@
158 159 }
159 160
160 161 public function info() {
161 162 return array(
162 - "public" => substr($this->public, 0, 6)
163 + "public" => substr($this->public, 0, 6),
164 + "sigmatch" => substr($this->sig_match, 0, 6)
163 165 );
166 + }
167 +
168 + public static function getSigMatch($request, $secret) {
169 + $method = $request->method;
170 + $time = $request->time;
171 + $version = $request->version;
172 + if ($request->is_sha1) {
173 + $sig_match = sha1($method.$secret.$time.$version);
174 + } else {
175 + $sig_match = md5($method.$secret.$time.$version);
176 + }
177 + return $sig_match;
178 + }
179 +
180 + public function authenticate($request) {
181 + $time = $request->time;
182 + if ($time < intval($this->settings->getOption('bvLastRecvTime')) - 300) {
183 + return false;
184 + }
185 + $this->sig_match = self::getSigMatch($request, $this->secret);
186 + if ($this->sig_match !== $request->sig) {
187 + return false;
188 + }
189 + $this->settings->updateOption('bvLastRecvTime', $time);
190 + return 1;
164 191 }
165 192
166 193 public function updateInfo($info) {
167 194 $accounts = self::allAccounts($this->settings);