summaryrefslogtreecommitdiffstats
path: root/apis/debugrequest.inc.php
diff options
context:
space:
mode:
authorChristoph Schulthess2017-02-23 14:39:26 +0100
committerChristoph Schulthess2017-02-23 14:39:26 +0100
commit390b802c1f7be367b5fd23c4ddbf93d26580b64e (patch)
tree6d1ba245c53c6473ca2320b5b07425d85a4aede3 /apis/debugrequest.inc.php
parentdebugrequest_TLS added (diff)
downloadslx-admin-390b802c1f7be367b5fd23c4ddbf93d26580b64e.tar.gz
slx-admin-390b802c1f7be367b5fd23c4ddbf93d26580b64e.tar.xz
slx-admin-390b802c1f7be367b5fd23c4ddbf93d26580b64e.zip
debugrequest updated, using default SSL Relay Task
Diffstat (limited to 'apis/debugrequest.inc.php')
-rw-r--r--apis/debugrequest.inc.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/apis/debugrequest.inc.php b/apis/debugrequest.inc.php
new file mode 100644
index 00000000..0d423bec
--- /dev/null
+++ b/apis/debugrequest.inc.php
@@ -0,0 +1,24 @@
+<?php
+$debug_settings = Property::getRemoteDebugConfig();
+if ($debug_settings["enabled"] !== true) {
+ http_response_code(403);
+ exit;
+}
+
+$debug_request = explode(":", file_get_contents("php://input"), 2);
+
+$uuid = $debug_request[0];
+$port = 5900 + $debug_request[1];
+
+$validclient = Database::queryFirst("SELECT machineuuid, clientip FROM machine WHERE machineuuid = :uuid AND clientip = :ip", array(":uuid" => "$debug_request[0]", ":ip" => $_SERVER["REMOTE_ADDR"]));
+
+if ($validclient == false) {
+ http_response_code(400);
+} else {
+ http_response_code(200);
+ $data = array("hosts" => array($_SERVER["REMOTE_ADDR"], $debug_settings["debugServer"]),
+ "ports" => array($port, intval($debug_settings["port"])), "descs" => array("bwlpclient", "debugserver"));
+ $taskstruct = Taskmanager::submit('DispatchRelay', $data);
+ Property::setDebugTaskStruct($taskstruct);
+}
+