From 085543b0f1970e4bb3de98a3171e42d8165d16d1 Mon Sep 17 00:00:00 2001 From: yuanyuanxiang <962914132@qq.com> Date: Wed, 27 May 2026 15:28:56 +0200 Subject: [PATCH] Fix(license): respect BindType when validating SN on import --- server/2015Remote/LicenseFile.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server/2015Remote/LicenseFile.cpp b/server/2015Remote/LicenseFile.cpp index d15bc02..214e7af 100644 --- a/server/2015Remote/LicenseFile.cpp +++ b/server/2015Remote/LicenseFile.cpp @@ -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; } }