aboutsummaryrefslogtreecommitdiffstats
path: root/licenser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'licenser.cpp')
-rw-r--r--licenser.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/licenser.cpp b/licenser.cpp
index 142164d..35059c5 100644
--- a/licenser.cpp
+++ b/licenser.cpp
@@ -281,9 +281,9 @@ bool Licenser::checkLicenseExpiryDate(std::string &reply, const RequestInfo &req
reply = replyString[e_bad_connection];
return false;
}
- // Expiry date
+ // Expiry date. Add 1 day to expiry date to get the end actually at the beginning of the next day
std::string expDate = license.get("expiry_date");
- std::time_t expEpoch = utils::stringToEpoch(expDate.c_str());
+ std::time_t expEpoch = utils::stringToEpoch(expDate.c_str()) + SECS_IN_DAY;
// Current date
std::time_t current = std::time(0);
// See if the time has expire
@@ -291,14 +291,14 @@ bool Licenser::checkLicenseExpiryDate(std::string &reply, const RequestInfo &req
// License expired
if (request.appName == MOCWRAPPER_APP_NAME) {
// For MOC, allow some leeway time
- int leewayTimeLeft = expEpoch + (license.getInt("leeway_time") * SECS_IN_HOUR) - current;
+ int leewayTimeLeft = expEpoch + (license.getInt("leeway_hours") * SECS_IN_HOUR) - current;
std::cout << "Leeway time left: " << leewayTimeLeft << std::endl;
if (leewayTimeLeft > 0) {
std::stringstream ss;
ss << "Warning: No connection to server. "
<< "Leeway time left: "
<< std::fixed << std::setprecision(1)
- << (float)leewayTimeLeft / (24 * SECS_IN_HOUR) << " days";
+ << (float)leewayTimeLeft / SECS_IN_DAY << " days";
reply = ss.str();
return true;
}
@@ -380,9 +380,10 @@ void Licenser::doHmacHashSha256(const std::string &payload, const std::string &s
}
authKey = ss_result.str();
+ JsonHandler pay(payload);
// Print out the result
- std::cout << "Message: " << payload << std::endl;
+ std::cout << "Message: " << pay.dump(4) << std::endl;
std::cout << "Key: " << secret << std::endl;
std::cout << "HMAC: " << authKey << std::endl;
}