GlLamant
2019-06-26 abab4996db2353caff749d9b41c2ae0af88113a8
src/library/LicenseReader.cpp
@@ -18,14 +18,13 @@
#include <fstream>
#include <sstream>
#include <stdlib.h>
#include <math.h>
#include "pc-identifiers.h"
#include "LicenseReader.h"
#include "base/StringUtils.h"
#include "base/logger.h"
#include "public-key.h"
#include <build_properties.h>
#include "os/os-cpp.h"
namespace license {
@@ -71,7 +70,7 @@
   }
   if (has_client_sig) {
      PcSignature str_code;
      strncpy(str_code, client_signature.c_str(), sizeof(str_code));
      strncpy(str_code, client_signature.c_str(), sizeof(str_code)-1);
      EVENT_TYPE event = validate_pc_signature(str_code);
      if (event != LICENSE_OK) {
         er.addEvent(event, SVRT_ERROR);
@@ -92,9 +91,10 @@
         license->days_left = 999999;
      } else {
         strncpy(license->expiry_date, to_date.c_str(), 11);
         double secs = difftime(time(NULL),
               seconds_from_epoch(to_date.c_str()));
         license->days_left = (int) secs / 60 * 60 * 24;
         double secs = difftime(
            seconds_from_epoch(to_date.c_str()),
            time(NULL));
         license->days_left = round(secs / (60 * 60 * 24));
      }
   }
}
@@ -161,9 +161,11 @@
               FullLicenseInfo::UNUSED_SOFTWARE_VERSION);
         int to_sw_version = ini.GetLongValue(productNamePtr,
               "to_sw_version", FullLicenseInfo::UNUSED_SOFTWARE_VERSION);
         string extra_data = trim_copy(
               ini.GetValue(productNamePtr, "extra_data", ""));
         FullLicenseInfo licInfo(*it, product, license_signature,
               (int) license_version, from_date, to_date, client_signature,
               from_sw_version, to_sw_version);
               from_sw_version, to_sw_version, extra_data);
         licenseInfoOut.push_back(licInfo);
         atLeastOneLicenseComplete = true;
      } else {