Fix(license): respect BindType when validating SN on import
This commit is contained in:
@@ -100,15 +100,17 @@ SNMatchResult ValidateLicenseSN(const std::string& licenseSN) {
|
|||||||
}
|
}
|
||||||
return SNMatchResult::IPMismatch;
|
return SNMatchResult::IPMismatch;
|
||||||
} else {
|
} else {
|
||||||
// Hardware binding: check if matches current device ID
|
// 哈希 SN:源头由本机 BindType 决定(硬件 ID 或 master/公网 IP)。
|
||||||
// Use GetHardwareID() to respect HWIDVersion (V1 or V2)
|
// 接收机在生成 SN 时已配置好 BindType,这里直接读 settings 即可,
|
||||||
std::string hardwareID = CMy2015RemoteDlg::GetHardwareID(0);
|
// 不能硬编码 0,否则 IP 绑定的授权会被误判为硬件不匹配。
|
||||||
|
std::string hardwareID = CMy2015RemoteDlg::GetHardwareID();
|
||||||
std::string hashedID = hashSHA256(hardwareID);
|
std::string hashedID = hashSHA256(hardwareID);
|
||||||
std::string currentDeviceID = getFixedLengthID(hashedID);
|
std::string currentDeviceID = getFixedLengthID(hashedID);
|
||||||
if (licenseSN == currentDeviceID) {
|
if (licenseSN == currentDeviceID) {
|
||||||
return SNMatchResult::Match;
|
return SNMatchResult::Match;
|
||||||
}
|
}
|
||||||
return SNMatchResult::HardwareMismatch;
|
int bindType = THIS_CFG.GetInt("settings", "BindType", 0);
|
||||||
|
return (bindType == 1) ? SNMatchResult::IPMismatch : SNMatchResult::HardwareMismatch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user