Skip to content

Commit 62cdd65

Browse files
committed
Fix OnValidMachine validator when number of machines is unlimited
The OnValidMachine validator incorrectly indicated that the license key was running on an invalid device when the license key had max number of machines set to 0.
1 parent 511ef20 commit 62cdd65

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

include/cryptolens/validators/OnValidMachineValidator.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ class OnValidMachineValidator_ {
2222
auto const& expected_machine_code = env.get_machine_code();
2323
bool floating = env.get_floating();
2424

25-
bool valid = false;
2625
auto const& machines = license_key_information.get_activated_machines();
27-
if (machines) {
26+
auto const& maxnoofmachines = license_key_information.get_maxnoofmachines();
27+
bool valid = (maxnoofmachines && *maxnoofmachines == 0)
28+
|| !machines;
29+
if (machines && !valid) {
2830
std::string full_expected_machine_code;
2931
if (floating) { full_expected_machine_code += "floating:"; }
3032
full_expected_machine_code += expected_machine_code;

0 commit comments

Comments
 (0)