Skip to content

Commit 81f5daa

Browse files
authored
Merge pull request #3111 from catchpoint/agent_version_limitation
limiting location agent version
2 parents b44f470 + 21a8983 commit 81f5daa

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

www/work/getwork.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@
4040
}
4141
}
4242

43+
if (!CheckAgentVersion()) {
44+
header("HTTP/1.1 403 Unauthorized");
45+
exit();
46+
}
47+
4348
$block_list = GetSetting('block_pc');
4449
if ($block_list && strlen($block_list) && strlen($pc)) {
4550
$block = explode(',', $block_list);
@@ -260,6 +265,23 @@ function TestToJSON($testInfo)
260265
return $testJson;
261266
}
262267

268+
/**
269+
* Used to enforce version limitation for specific locaitons
270+
*
271+
*/
272+
function CheckAgentVersion()
273+
{
274+
global $locations;
275+
$location = trim($locations[0]);
276+
$locInfo = GetLocationInfo($location);
277+
$agent_version = $_GET['version'];
278+
if (isset($locInfo) && is_array($locInfo) && array_key_exists('version', $locInfo)) {
279+
return $locInfo['version'] === $agent_version;
280+
}
281+
282+
return true;
283+
}
284+
263285
/**
264286
* Get an actual task to complete
265287
*

0 commit comments

Comments
 (0)