Explorar o código

!10776 去除对本地dep目录文件签名的校验
Merge pull request !10776 from 80374374/bugfix_hsps_invalidstate

杨诗友80174847 hai 3 meses
pai
achega
badd04bd44
Modificáronse 1 ficheiros con 17 adicións e 12 borrados
  1. 17 12
      Module/mod_ResourceWatcher/ResourceWatcherFSM.cpp

+ 17 - 12
Module/mod_ResourceWatcher/ResourceWatcherFSM.cpp

@@ -266,11 +266,11 @@ void ResourceWatcherFSM::TriggerAtStatusChanged(bool bMStatus)
         GetEntityBase()->GetFunction()->OpenConfig(Config_CenterSetting, spCtSettingConfig);
         spCtSettingConfig->ReadConfigValueInt(m_pEntity->GetEntityName(), "VerifySignature", m_iVerify);
 #if defined(RVC_OS_WIN)
-        if (m_iVerify == 1) {//文件签名校验
-            DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Verify digitsign...");
-            VerifyDigitSignTask* task = new VerifyDigitSignTask(this);
-            GetEntityBase()->GetFunction()->PostThreadPoolTask(task);
-        }
+		if (m_iVerify == 1) {//文件签名校验
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Verify digitsign...");
+			VerifyDigitSignTask* task = new VerifyDigitSignTask(this);
+			GetEntityBase()->GetFunction()->PostThreadPoolTask(task);
+		}
         
 #endif //RVC_OS_WIN
         
@@ -574,7 +574,7 @@ void ResourceWatcherFSM::CenterSettingDelete()
     if (delResult.failCnt != 0) {
         bFailFlag = true;
     }
-    else {
+    else if(delResult.sucCnt > 0){
 		LogWarn(Severity_Low, Error_Debug, LOG_WARN_FILE_DELETE_SUC, CSimpleStringA::Format("Delete files in [%s] success", tempPath.GetData()));
     }
 }
@@ -624,11 +624,15 @@ int ResourceWatcherFSM::ProcessFileDelete(const DeleteParam& delParam, DeleteRes
 
     DWORD attrs = GetFileAttributesA(delParam.path);
     if (attrs == INVALID_FILE_ATTRIBUTES)
-    {     
-        CSimpleStringA errMsg = CSimpleStringA::Format("Can not find path:[%s], GLE = %u.", delParam.path.GetData(), GetLastError());
-        DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setLogCode(delParam.logCode).setResultCode(delParam.rtaCode).setAPI("DeleteFiles")(errMsg.GetData());
-        LogWarn(Severity_Middle, Error_Debug, LOG_WARN_FILE_DELETE_FAILED, errMsg);
-        delResult.failCnt++;
+    {
+        const DWORD lastError = GetLastError();
+        if (lastError != 2) /*NOT Found*/
+        {
+			CSimpleStringA errMsg = CSimpleStringA::Format("Can not find path:[%s], GLE = %u.", delParam.path.GetData(), lastError);
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setLogCode(delParam.logCode).setResultCode(delParam.rtaCode).setAPI("DeleteFiles")(errMsg.GetData());
+			LogWarn(Severity_Middle, Error_Debug, LOG_WARN_FILE_DELETE_FAILED, errMsg);
+			delResult.failCnt++;
+        }
     }
     else if (attrs & FILE_ATTRIBUTE_DIRECTORY) //文件夹类型
     {
@@ -2592,7 +2596,7 @@ void ResourceWatcherFSM::VerifySignature()
 
     strMsg = strMsg + CSimpleStringA::Format("签名耗时:%dms", elapsed);
     LogWarn(Severity_Low, Error_Unexpect, LOG_WARN_FILE_NOT_TRUSTED, (LPCTSTR)strMsg);
-    delete buffer;
+    delete[] buffer;
 }
 
 void ResourceWatcherFSM::VerifySignature(const CSimpleStringA& filePath)
@@ -2605,6 +2609,7 @@ void ResourceWatcherFSM::VerifySignature(const CSimpleStringA& filePath)
         return;
 
     string strDirPath = filePath;
+    if (strDirPath.find("\\dep\\*") != std::string::npos) return;
     do
     {
         if (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)