From c58f11fb22ca5e9f312bda3ee265dc8455de292c Mon Sep 17 00:00:00 2001 From: Thulinma Date: Wed, 8 Mar 2017 16:22:26 +0100 Subject: [PATCH] License system enabled. --- src/controller/controller_license.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/controller/controller_license.cpp b/src/controller/controller_license.cpp index 05fd3068..56ee86a5 100644 --- a/src/controller/controller_license.cpp +++ b/src/controller/controller_license.cpp @@ -40,13 +40,10 @@ namespace Controller{ INFO_MSG("Verifying license against %llu: %s", now, currentLicense.toString().c_str()); #endif //The loop below is timechecker loop - if (!currentLicense.isMember("valid_from") || !currentLicense.isMember("valid_till")){ -#if DEBUG >= DLVL_DEVEL - INFO_MSG("Accepting license despite lack of date range, because early build"); -#endif - return true;//temporary - } - if (now < currentLicense["valid_from"].asInt() || now > currentLicense["valid_till"].asInt()){ + if (!currentLicense.isMember("valid_from") || !currentLicense.isMember("valid_till") || now < currentLicense["valid_from"].asInt() || now > currentLicense["valid_till"].asInt()){ + if (currentLicense.isMember("user_msg") && currentLicense["user_msg"].asStringRef().size()){ + FAIL_MSG("%s", currentLicense["user_msg"].asStringRef().c_str()); + } return false;//license is expired } if (RELEASE != currentLicense["release"].asStringRef() || PACKAGE_VERSION != currentLicense["version"].asStringRef()){ @@ -63,7 +60,7 @@ namespace Controller{ } INFO_MSG("Checking license time"); if(!isLicensed()){ - FAIL_MSG("License expired, shutting down"); + FAIL_MSG("Not licensed, shutting down"); kill(getpid(), SIGINT); return false; }