Commit 7040b0a9c0d88bebfa137303129fd3fb48561e96

Authored by xp.Huang
1 parent f83090ec

fix: 修改TCP数据携带的鉴权逻辑,设备上报的HEX长度,小于产品里面设置数据携带的最小HEX长度,则丢弃

#Based on modifications of the ThingsBoard Community Edition.


(cherry picked from commit fc6d5841e0d4bf53ed8632de636b72650badcea8)
@@ -301,7 +301,8 @@ public class DefaultTransportApiService implements TransportApiService { @@ -301,7 +301,8 @@ public class DefaultTransportApiService implements TransportApiService {
301 for (String key : profiles.keySet()) { 301 for (String key : profiles.keySet()) {
302 TkTcpDeviceProfileTransportConfiguration profile = (TkTcpDeviceProfileTransportConfiguration) profiles.get(key); 302 TkTcpDeviceProfileTransportConfiguration profile = (TkTcpDeviceProfileTransportConfiguration) profiles.get(key);
303 TkTcpDeviceProfileTransportConfiguration.DataCombinationAuth combinationInfo = profile.getCombinationInfo(); 303 TkTcpDeviceProfileTransportConfiguration.DataCombinationAuth combinationInfo = profile.getCombinationInfo();
304 - if(credentialsId.length() != profile.getCombinationInfo().getHexLength()){ 304 + //设备上报的HEX长度,小于产品里面设置数据携带的最小HEX长度,则丢弃
  305 + if(credentialsId.length() < profile.getCombinationInfo().getHexLength()){
305 continue; 306 continue;
306 } 307 }
307 String filterPrefix = combinationInfo.getFilterPrefix(); 308 String filterPrefix = combinationInfo.getFilterPrefix();