aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/qlicenseservice/httpclient.h
diff options
context:
space:
mode:
authorSami Littow <sami.littow@qt.io>2023-04-14 08:54:38 +0300
committerSami Littow <sami.littow@qt.io>2023-04-19 14:36:08 +0300
commit481ae1cb9e52dfe198030e9a4a6e562005f04ca7 (patch)
tree4365c32ac61766da8d539c4eb60a31a4edcd900d /src/libs/qlicenseservice/httpclient.h
parentb8e7c76ea05ab2ab1dbec0efe547ee2ff259e374 (diff)
Fix of a bug where daemon grants non-valid licenseHEADdev
(clitoolhandler.h) - Server response validity was only checked when requesting longterm reservation - Could have exploited with telnet - Server response JSON status field check moved to the beginning of method (HttpClient, Licenser classes) - Pass the REST endpoint to the HTTP client per request, rather than trying to guess it in HTTP client Change-Id: I13d05b33f1032a91d393e7315552f1b9d391142d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Diffstat (limited to 'src/libs/qlicenseservice/httpclient.h')
-rw-r--r--src/libs/qlicenseservice/httpclient.h16
1 files changed, 5 insertions, 11 deletions
diff --git a/src/libs/qlicenseservice/httpclient.h b/src/libs/qlicenseservice/httpclient.h
index 13d2478..9df41c6 100644
--- a/src/libs/qlicenseservice/httpclient.h
+++ b/src/libs/qlicenseservice/httpclient.h
@@ -38,22 +38,16 @@ struct HttpRequest {
class HttpClient
{
public:
- explicit HttpClient(const std::string &serverUrl,
- const std::string &requestAccessPoint,
- const std::string &permanentccessPoint,
- const std::string &versionAccessPoint);
+ explicit HttpClient(const std::string &serverUrl);
+
~HttpClient() {}
- int sendRequest(std::string &reply, const std::string &payload,
- const std::string &server, const std::string &authKey="");
- std::string error() { return m_lastError; }
+ int sendAndReceive(std::string &reply, const std::string &payload,
+ const std::string &accessPoint, const std::string &server,
+ const std::string &authKey="");
private:
std::string m_serverUrl;
- std::string m_requestAccessPoint;
- std::string m_permanentAccessPoint;
- std::string m_versionAccessPoint;
std::string m_userAgent = "License daemon / ";
- std::string m_lastError;
int doRequest(CURL *curl, HttpRequest &request);
};