feat(ANSLS): know ANSMIND as 1009, and stop filing unknown products under it

The gateway's product table already runs to 1009 ANSMIND and 1010 ANSGW.
The licensing library stopped at 1008, so a real ANSMIND licence could not
be named, deactivated or listed here, while every product name it did not
recognise quietly became product 1009. With 1009 now a real product, that
fallback would mint an ANSMIND trial for a typo.

ANSPRODUCTS gains ANSMIND = 1009 and ANSGW = 1010, and both are added
wherever the product table is spelled out: ActivateTrialLicense,
DeactivateLicense, ActivateLicense, ActivateLicenseWithCustomHWID and
ListLicenses, which now reports an ANSMIND and an ANSGW row like the
gateway does.

Unknown names no longer map to any id. ActivateTrialLicense returns 0, its
existing failure value, instead of generating a key. ListLicenses skips
the row. ActivateLicense and ActivateLicenseWithCustomHWID keep passing
the name through as the registration name: they never assigned an id, the
key's own validation data rejects a name it was not issued for, and the
gateway resolves an unknown product the same way.

The ANSVIS master-licence rule in LicenseVerification is untouched.

Separately, the fallback loops in ANSUtilities, ANSAWSS3 and ANSLLM asked
for product 1008 under the registration name "ANSSRT". The product is
ANSTS, so a genuine ANSTS licence could never satisfy them. Only that
string changes; the loops still stop at 1008.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-13 10:38:31 +10:00
co-authored by Claude Opus 5
parent cd99fcf6d9
commit cb964907f0
5 changed files with 53 additions and 8 deletions
+47 -4
View File
@@ -1777,10 +1777,19 @@ namespace ANSCENTER
registrationName = "ANSTS"; registrationName = "ANSTS";
productId = 1008; productId = 1008;
} }
else { else if (productName == "ANSMIND") {//1009
registrationName = productName; registrationName = "ANSMIND";
productId = 1009; productId = 1009;
} }
else if (productName == "ANSGW") {//1010
registrationName = "ANSGW";
productId = 1010;
}
else {
// Unknown product: refuse rather than mint a trial under some real product's id.
std::cout << "ActivateTrialLicense: unknown product name '" << productName << "'" << std::endl;
return 0;
}
std::string trialLicenseKey = GetTrialLicenseKey(registrationName); std::string trialLicenseKey = GetTrialLicenseKey(registrationName);
if (trialLicenseKey.empty()) { if (trialLicenseKey.empty()) {
@@ -1849,6 +1858,12 @@ namespace ANSCENTER
case ANSCENTER::ANSPRODUCTS::ANS_TS://1008 case ANSCENTER::ANSPRODUCTS::ANS_TS://1008
_productName = "ANSTS"; _productName = "ANSTS";
break; break;
case ANSCENTER::ANSPRODUCTS::ANSMIND://1009
_productName = "ANSMIND";
break;
case ANSCENTER::ANSPRODUCTS::ANSGW://1010
_productName = "ANSGW";
break;
} }
if (_productName == productName) { if (_productName == productName) {
// Delete the license file // Delete the license file
@@ -1896,6 +1911,12 @@ namespace ANSCENTER
else if (productName == "ANSTS") {//1008 else if (productName == "ANSTS") {//1008
registrationName = "ANSTS"; registrationName = "ANSTS";
} }
else if (productName == "ANSMIND") {//1009
registrationName = "ANSMIND";
}
else if (productName == "ANSGW") {//1010
registrationName = "ANSGW";
}
else { else {
registrationName = productName; registrationName = productName;
} }
@@ -1936,6 +1957,12 @@ namespace ANSCENTER
else if (productName == "ANSTS") {//1008 else if (productName == "ANSTS") {//1008
registrationName = "ANSTS"; registrationName = "ANSTS";
} }
else if (productName == "ANSMIND") {//1009
registrationName = "ANSMIND";
}
else if (productName == "ANSGW") {//1010
registrationName = "ANSGW";
}
else { else {
registrationName = productName; registrationName = productName;
} }
@@ -2002,6 +2029,8 @@ namespace ANSCENTER
ansLicenseCollection.push_back("ANSALPR");//1006 ansLicenseCollection.push_back("ANSALPR");//1006
ansLicenseCollection.push_back("ANSCV");//1007 ansLicenseCollection.push_back("ANSCV");//1007
ansLicenseCollection.push_back("ANSTS");//1008 ansLicenseCollection.push_back("ANSTS");//1008
ansLicenseCollection.push_back("ANSMIND");//1009
ansLicenseCollection.push_back("ANSGW");//1010
for (auto& element : ansLicenseCollection) { for (auto& element : ansLicenseCollection) {
boost::property_tree::ptree dataNode; boost::property_tree::ptree dataNode;
@@ -2064,6 +2093,12 @@ namespace ANSCENTER
case ANSCENTER::ANSPRODUCTS::ANS_TS: case ANSCENTER::ANSPRODUCTS::ANS_TS:
_productName = "ANSTS"; _productName = "ANSTS";
break; break;
case ANSCENTER::ANSPRODUCTS::ANSMIND:
_productName = "ANSMIND";
break;
case ANSCENTER::ANSPRODUCTS::ANSGW:
_productName = "ANSGW";
break;
} }
if (_productName == element) { if (_productName == element) {
_registrationName = ANSUtility::DecodeBase64Utility(_validationData.c_str());// Decode _registrationName = ANSUtility::DecodeBase64Utility(_validationData.c_str());// Decode
@@ -2141,10 +2176,18 @@ namespace ANSCENTER
registrationName = "ANSTS"; registrationName = "ANSTS";
productId = 1008; productId = 1008;
} }
else { else if (ansLicenseInfo.productName == "ANSMIND") {
registrationName = ansLicenseInfo.productName; registrationName = "ANSMIND";
productId = 1009; productId = 1009;
} }
else if (ansLicenseInfo.productName == "ANSGW") {
registrationName = "ANSGW";
productId = 1010;
}
else {
// Unknown product: skip the row rather than report it under some real product's id.
continue;
}
dataNode.put("product_name", ansLicenseInfo.productName); dataNode.put("product_name", ansLicenseInfo.productName);
std::string trialLicenseKey = GetTrialLicenseKey(registrationName); std::string trialLicenseKey = GetTrialLicenseKey(registrationName);
if (trialLicenseKey.empty()) { if (trialLicenseKey.empty()) {
+3 -1
View File
@@ -259,7 +259,9 @@ namespace ANSCENTER
ANS_OCR = 1005, ANS_OCR = 1005,
ANS_ALPR =1006, ANS_ALPR =1006,
ANS_CV = 1007, ANS_CV = 1007,
ANS_TS = 1008 ANS_TS = 1008,
ANSMIND = 1009,
ANSGW = 1010
}; };
enum ANSLICENSESTATUS { enum ANSLICENSESTATUS {
ACTIVE = 0, ACTIVE = 0,
+1 -1
View File
@@ -22,7 +22,7 @@ namespace ANSCENTER
{1005, "ANSOCR"}, {1005, "ANSOCR"},
{1006, "ANSALPR"}, {1006, "ANSALPR"},
{1007, "ANSCV"}, {1007, "ANSCV"},
{1008, "ANSSRT"} {1008, "ANSTS"}
}; };
ansllmLicenceValid = false; ansllmLicenceValid = false;
for (const auto& [productId, productName] : licenseChecks) { for (const auto& [productId, productName] : licenseChecks) {
+1 -1
View File
@@ -33,7 +33,7 @@ namespace ANSCENTER
{1005, "ANSOCR"}, {1005, "ANSOCR"},
{1006, "ANSALPR"}, {1006, "ANSALPR"},
{1007, "ANSCV"}, {1007, "ANSCV"},
{1008, "ANSSRT"} {1008, "ANSTS"}
}; };
ansawss3LicenceValid = false; ansawss3LicenceValid = false;
for (const auto& [productId, productName] : licenseChecks) { for (const auto& [productId, productName] : licenseChecks) {
+1 -1
View File
@@ -40,7 +40,7 @@ namespace ANSCENTER
{1005, "ANSOCR"}, {1005, "ANSOCR"},
{1006, "ANSALPR"}, {1006, "ANSALPR"},
{1007, "ANSCV"}, {1007, "ANSCV"},
{1008, "ANSSRT"} {1008, "ANSTS"}
}; };
ansutilityLicenceValid = false; ansutilityLicenceValid = false;
for (const auto& [productId, productName] : licenseChecks) { for (const auto& [productId, productName] : licenseChecks) {