Fix(license): respect BindType when validating SN on import

This commit is contained in:
yuanyuanxiang
2026-05-27 15:28:56 +02:00
parent 1fd431ba76
commit 085543b0f1

View File

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