aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Littow <sami.littow@qt.io>2022-11-30 15:37:26 +0200
committerSami Littow <sami.littow@qt.io>2022-11-30 15:43:59 +0200
commit29e06d5d22fbda6d7294e2f9785cc4393628023e (patch)
tree77a39078b1e237f213fecf64675b699a96cb3f7e
parent94297157bb5fdb449cd1706608234751995b86e1 (diff)
[v2.0.3] Corrected wrapped behaviour
- Daemon now supports app names also in uppercase - Mocwrapper made even less verbose
-rwxr-xr-x[-rw-r--r--]build_linux.sh0
-rw-r--r--include/version.h2
-rw-r--r--licenser.cpp20
-rwxr-xr-x[-rw-r--r--]linux_service_scripts/installer.sh0
-rwxr-xr-x[-rw-r--r--]linux_service_scripts/uninstaller.sh0
-rw-r--r--mocwrapper/mocwrapper.cpp4
6 files changed, 12 insertions, 14 deletions
diff --git a/build_linux.sh b/build_linux.sh
index c02b731..c02b731 100644..100755
--- a/build_linux.sh
+++ b/build_linux.sh
diff --git a/include/version.h b/include/version.h
index e5e7b67..2243e51 100644
--- a/include/version.h
+++ b/include/version.h
@@ -6,7 +6,7 @@
#pragma once
#define DAEMON_VERSION_MAJOR "2"
-#define DAEMON_VERSION_MINOR "0.2"
+#define DAEMON_VERSION_MINOR "0.3"
#define DAEMON_VERSION DAEMON_VERSION_MAJOR "." DAEMON_VERSION_MINOR
#define LICD_SERVICE_DESCRIPTION "Qt Licensing service"
#define COPYRIGHT_TEXT "Copyright (C) 2022 The Qt Company Ltd"
diff --git a/licenser.cpp b/licenser.cpp
index 832dc6a..dd250cb 100644
--- a/licenser.cpp
+++ b/licenser.cpp
@@ -50,9 +50,10 @@ int Licenser::listen()
std::string payload = "";
if (request.type == RequestType::normal_license_renewal) {
std::cout << "Standard license renewal request\n";
- // See if it's MOC who's calling us (special case)
- if (request.appName == MOCWRAPPER_APP_NAME) {
- // More than MOC_RENEWAL_INTERVAL from last successful request?
+ // See if it's MOC who's calling. Make sure app name is accepted, no matter of the case.
+ // request.appname is set in lowercase already in parseIncoming() method at this point
+ if (request.appName == utils::strToLower(MOCWRAPPER_APP_NAME)) {
+ // More than 24hrs (licd.ini default) from last successful request?
if (!isMocRenewalDue(request.licenseFile)) {
// No - Just send ok message and no further actions needed
reply = replyString[e_license_granted];
@@ -107,8 +108,6 @@ std::string Licenser::getVersion()
int Licenser::parseIncoming(const std::string &incoming, RequestInfo &request)
{
- // Cycle through input and all given parameters to find essential info for request JSON
- // Start from item 1, since item 0 is the command itself
std::vector<std::string> req = utils::splitStr(incoming, '-');
// First find out the command (and operation for longterm case)
@@ -126,7 +125,7 @@ int Licenser::parseIncoming(const std::string &incoming, RequestInfo &request)
request.operation = op;
} else if (cmd == SERVER_VERSION_CMD) {
request.type = RequestType::server_version;
- }else if (cmd == DAEMON_VERSION_CMD) {
+ } else if (cmd == DAEMON_VERSION_CMD) {
request.type = RequestType::daemon_version;
return 0;
} else if (cmd == RESERVATION_QUERY_CMD) {
@@ -149,7 +148,7 @@ int Licenser::parseIncoming(const std::string &incoming, RequestInfo &request)
return e_bad_request;
}
- if (arg == 'a') request.appName = val;
+ if (arg == 'a') request.appName = utils::strToLower(val);
else if (arg == 'v') request.appVersion = val;
else if (arg == 'u') request.userId = val;
else if (arg == 'i') request.licenseId = val;
@@ -289,9 +288,8 @@ bool Licenser::checkLicenseExpiryDate(std::string &reply, const RequestInfo &req
// See if the time has expire
if (current > expEpoch) {
std::cout << "Expiry date " << expDate << " exceeded" << std::endl;
- // License expired
- if (request.appName == MOCWRAPPER_APP_NAME) {
- // For MOC, allow some leeway time
+ // License expired: Allow some leeway time for MOC and Plugin, but not for qtlicensetool
+ if (utils::strToLower(request.appName) != utils::strToLower(QTLICENSETOOL_APP_NAME)) {
int leewayTimeLeft = expEpoch + (license.getInt("leeway_hours") * SECS_IN_HOUR) - current;
if (leewayTimeLeft > 0) {
std::stringstream ss;
@@ -304,7 +302,7 @@ bool Licenser::checkLicenseExpiryDate(std::string &reply, const RequestInfo &req
std::cout << "No leeway time left" << std::endl;
}
}
- std::cout << "License already expired at " << expDate << ", rejecting\n";
+ std::cout << "Rejecting license\n";
reply = replyString[e_license_rejected];
return false;
}
diff --git a/linux_service_scripts/installer.sh b/linux_service_scripts/installer.sh
index 404fb90..404fb90 100644..100755
--- a/linux_service_scripts/installer.sh
+++ b/linux_service_scripts/installer.sh
diff --git a/linux_service_scripts/uninstaller.sh b/linux_service_scripts/uninstaller.sh
index a1f19e4..a1f19e4 100644..100755
--- a/linux_service_scripts/uninstaller.sh
+++ b/linux_service_scripts/uninstaller.sh
diff --git a/mocwrapper/mocwrapper.cpp b/mocwrapper/mocwrapper.cpp
index ec80769..f4ca9ef 100644
--- a/mocwrapper/mocwrapper.cpp
+++ b/mocwrapper/mocwrapper.cpp
@@ -77,8 +77,8 @@ int requestLicense(const std::string &mocBinPath)
return -1; // TCP/IP error
}
reply = utils::trimStr(reply);
-
- std::cout << reply << std::endl;
+ if (reply != "License acquired.")
+ std::cout << reply << std::endl;
if (reply.substr(0,2) == "No" || reply.substr(0,5) == "ERROR") {
return -1; // No license
}