Bläddra i källkod

Merge branch '0_0_2_test1' of http://mayun.itc.cmbchina.cn/QD_RemoteBankArea/LR04.02_RVCTerminalPlus into 0_0_2_test1

gifur 4 år sedan
förälder
incheckning
31163cacea

+ 6 - 6
Module/mod_CardReadAdapter/CardReadAdapterFSM.cpp

@@ -1347,7 +1347,7 @@ void CCardReadAdapterFSM::CheckAndReconnectSession()
 		{
 			if (m_pCardIssuer != NULL)
 			{
-				m_pCardIssuer->SafeDelete();
+				//m_pCardIssuer->SafeDelete();
 				m_pCardIssuer = NULL;
 			}
 			m_pCardIssuer = new CardIssuerService_ClientBase(GetEntityBase());
@@ -1359,7 +1359,7 @@ void CCardReadAdapterFSM::CheckAndReconnectSession()
 					if (cardIssuerCount%120 == 0)//about 10 minutes can't connect to entity
 						Dbg("connect to entity CardIssuer failed.%d", eErr);
 					cardIssuerCount++;
-					m_pCardIssuer->SafeDelete();
+					//m_pCardIssuer->SafeDelete();
 					m_pCardIssuer = NULL;
 				}
 				else
@@ -1375,7 +1375,7 @@ void CCardReadAdapterFSM::CheckAndReconnectSession()
 		{
 			if (m_pContactless != NULL)
 			{
-				m_pContactless->SafeDelete();
+				//m_pContactless->SafeDelete();
 				m_pContactless = NULL;
 			}
 			m_pContactless = new ContactlessCardService_ClientBase(GetEntityBase());
@@ -1387,7 +1387,7 @@ void CCardReadAdapterFSM::CheckAndReconnectSession()
 					if (contactlessCardCount % 120 == 0)//about 10 minutes can't connect to entity
 						Dbg("connect to entity ContactlessCard failed.%d", eErr);
 					contactlessCardCount++;
-					m_pContactless->SafeDelete();
+					//m_pContactless->SafeDelete();
 					m_pContactless = NULL;
 				}
 				else
@@ -1402,7 +1402,7 @@ void CCardReadAdapterFSM::CheckAndReconnectSession()
 		{
 			if (m_pCardSwiper != NULL)
 			{
-				m_pCardSwiper->SafeDelete();
+				//m_pCardSwiper->SafeDelete();
 				m_pCardSwiper = NULL;
 			}
 			m_pCardSwiper = new CardSwiperService_ClientBase(GetEntityBase());
@@ -1414,7 +1414,7 @@ void CCardReadAdapterFSM::CheckAndReconnectSession()
 					if (cardSwiperCount%120 == 0)//about 10 minutes can't connect to entity
 						Dbg("connect to entity CardSwiper failed.%d", eErr);
 					cardSwiperCount++;
-					m_pCardSwiper->SafeDelete();
+					//m_pCardSwiper->SafeDelete();
 					m_pCardSwiper = NULL;
 				}
 				else

+ 17 - 15
Module/mod_Initializer/InitializerConn.cpp

@@ -674,21 +674,23 @@ DWORD CInitializerConn::HandleInitMKRet(const CSmartPointer<IPackage> &pRecvPkg)
 			}
 		}
 		*/
-		//只支持国密
-		rc = pEntity->LoadKeysToPinPad(true);
-		if (rc != Error_Succeed)
-		{
-			strRetErrMsg = "加载SM密钥到密码键盘失败";
-			LogWarn(Severity_Middle, (ErrorCodeEnum)rc, ERR_INITIALIZER_LOAD_KEYS_TO_PINPAD,
-				GetOutPutStr("%s%08X%s%s", "LoadKeysToPinPad", rc, "strRetErrMsg", strRetErrMsg).c_str());
-		}
-		if (rc != Error_Succeed) {
-			Dbg("%s", strRetErrMsg.GetData());
-			//当为国密改造之后的第一次准入,直接认为初始化成功
-			//因为自动初始化时,pinpad有可能没有准备好,但是初始化不能中断,只打日志,不上报错误
-			if (pEntity->m_afterSMIsFirst) {
-				Dbg("国密改造之后的第一次准入");
-				rc = Error_Succeed;
+		if (!pEntity->m_afterSMIsFirst) {
+			//只支持国密
+			rc = pEntity->LoadKeysToPinPad(true);
+			if (rc != Error_Succeed)
+			{
+				strRetErrMsg = "加载SM密钥到密码键盘失败";
+				LogWarn(Severity_Middle, (ErrorCodeEnum)rc, ERR_INITIALIZER_LOAD_KEYS_TO_PINPAD,
+					GetOutPutStr("%s%08X%s%s", "LoadKeysToPinPad", rc, "strRetErrMsg", strRetErrMsg).c_str());
+			}
+			if (rc != Error_Succeed) {
+				Dbg("%s", strRetErrMsg.GetData());
+				//当为国密改造之后的第一次准入,直接认为初始化成功
+				//因为自动初始化时,pinpad有可能没有准备好,但是初始化不能中断,只打日志,不上报错误
+				if (pEntity->m_afterSMIsFirst) {
+					Dbg("国密改造之后的第一次准入");
+					rc = Error_Succeed;
+				}
 			}
 		}
 	}

+ 13 - 13
Module/mod_Initializer/mod_Initializer.cpp

@@ -755,11 +755,11 @@ DWORD CInitializerEntity::LoadKeysToPinPad(bool bSM)
 			LogWarn(Severity_Middle, Error_Unexpect, ERR_INITIALIZER_GET_KMC_KEY_NULL,
 				GetOutPutStr("%s%s", "m_bGetKMCKey", "False").c_str());
 			rc = ERR_INITIALIZER_GET_KMC_KEY_NULL;
-			pPinPad->SafeDelete();
+			//pPinPad->SafeDelete();
 			return rc;
 		}
-
 		PinPadService_LoadKeysSM_Ans ans = {};
+
 		rc = pPinPad->LoadKeysSM(req, ans, 30000);
 		if (rc == Error_Succeed)
 			Dbg("load sm key to pinpad succ");
@@ -779,7 +779,7 @@ DWORD CInitializerEntity::LoadKeysToPinPad(bool bSM)
 		rc = ERR_INITIALIZER_CONNECT_PINPAD;
 	}
 
-	pPinPad->SafeDelete();
+	//pPinPad->SafeDelete();
 	return rc;
 }
 
@@ -949,7 +949,7 @@ bool CInitializerEntity::GetInitializedFlg(int &nInitializedFlg)
 		return false;
 	}
 
-	Dbg("InitState[%s]", strInitState);	
+	Dbg("InitState[%s]", strInitState.GetData());	
 
 	if (strInitState.Compare("0", true) == 0)
 	{
@@ -1011,7 +1011,7 @@ DWORD CInitializerEntity::InitCardSwiper()
 	{
 		LogWarn(Severity_Middle, Error_Unexpect, ERR_INITIALIZER_CONNECT_CARDSWIPER, GetOutPutStr("%s%s", "Connect", "False").c_str());
 		m_strLastErrMsg = "连接CardSwiper实体失败";
-		pCardSwiperClient->SafeDelete();
+		//pCardSwiperClient->SafeDelete();
 		pCardSwiperClient = NULL;
 		return Error_InvalidState;
 	}
@@ -1035,7 +1035,7 @@ DWORD CInitializerEntity::InitCardSwiper()
 	}
 
 	pCardSwiperClient->GetFunction()->CloseSession();
-	pCardSwiperClient->SafeDelete();
+	//pCardSwiperClient->SafeDelete();
 	pCardSwiperClient = NULL;
 	return rc;
 }
@@ -1057,7 +1057,7 @@ ErrorCodeEnum CInitializerEntity::DownloadCfg(const char *pszSettingServer, int
 	if (pCenterSettingClient->Connect() != Error_Succeed)
 	{
 		m_strLastErrMsg = "连接集中配置实体失败";
-		pCenterSettingClient->SafeDelete();
+		//pCenterSettingClient->SafeDelete();
 		pCenterSettingClient = NULL;
 		return Error_InvalidState;
 	}
@@ -1072,7 +1072,7 @@ ErrorCodeEnum CInitializerEntity::DownloadCfg(const char *pszSettingServer, int
 		m_strLastErrMsg = "集中配置实体Download接口调用失败";
 
 	pCenterSettingClient->GetFunction()->CloseSession();
-	pCenterSettingClient->SafeDelete();
+	//pCenterSettingClient->SafeDelete();
 	pCenterSettingClient = NULL;
 	return rc;
 }
@@ -1175,7 +1175,7 @@ void CInitializerEntity::BeginLogin(const char *pszAuthServer, int nAuthPort, co
 					(const char*)m_strAuthTime);
 			}
 
-			pClient->SafeDelete();
+			//pClient->SafeDelete();
 			pClient = NULL;
 		}
 	}	
@@ -1898,7 +1898,7 @@ bool CInitializerEntity::HasPinPad()
 			pPinPadClient->GetFunction()->CloseSession();
 		}
 
-		pPinPadClient->SafeDelete();
+		//pPinPadClient->SafeDelete();
 		pPinPadClient = NULL;
 		return bPinPadExist;
 	}
@@ -1950,7 +1950,7 @@ int CInitializerEntity::GetPinPadCapability()
 		pPinPadClient->GetFunction()->CloseSession();
 	}
 
-	pPinPadClient->SafeDelete();
+	//pPinPadClient->SafeDelete();
 	pPinPadClient = NULL;
 
 	if (HasCkCodeFlg())
@@ -2541,7 +2541,7 @@ int CInitializerEntity::GetPinPadIDAndDeviceID(CSimpleStringA &strPinPadID, CSim
 		}
 	}
 
-	pPinPadClient->SafeDelete();
+	//pPinPadClient->SafeDelete();
 	pPinPadClient = NULL;
 
 	if (bPinPadID)
@@ -2668,7 +2668,7 @@ bool CInitializerEntity::HasCkCodeFlg()
 			}
 		}
 
-		pPinPadClient->SafeDelete();
+		//pPinPadClient->SafeDelete();
 		pPinPadClient = NULL;
 
 		return m_bHasCkCode? true:false;

+ 26 - 162
Module/mod_accessauth/mod_AccessAuth.cpp

@@ -444,157 +444,7 @@ ErrorCodeEnum CAccessAuthEntity::ReleaseKMC()
 // 加载新WK
 DWORD CAccessAuthEntity::LoadPinPadWK(bool bSM)
 {
-	/*
-#ifdef IGNORE_PINPAD
-	return Error_Succeed;
-#else
-	// 1:3des only; 2: sm4 only; 3: both 3des and sm4
-	//int nCapability = GetPinPadCapability();
-	//Dbg("pinpad capability: %d", nCapability);
 	
-	CSimpleStringA strErrMsg;
-	CSmartPointer<IEntityFunction> spFunction = this->GetFunction();
-
-	char *retKeyBuf = NULL;
-	if (!bSM)
-	{
-		// support des key
-		// 读取工作密钥TPK
-		char keyBuf[64];
-		memset(keyBuf, 0, 64);
-
-		retKeyBuf = RvcGetKey(m_pkeys, TPK, keyBuf);
-		if (NULL == retKeyBuf)
-		{
-			strErrMsg = CSimpleStringA::Format("在加载密钥至PinPad时调用KMC接口(DES TPK)失败, ErrMsg: [%s]", (const char*)GetKMCLastErrMsg());
-			LogWarn(Severity_Middle, Error_Unexpect, ERR_ACCESSAUTH_GET_KEY,
-				GetOutPutStr("%s%s%s%s", "RvcGetKey", retKeyBuf, "strErrMsg", (const char*)GetKMCLastErrMsg()).c_str());
-			return ERR_ACCESSAUTH_GET_KEY;
-		}
-
-		PinPadService_LoadKeys_Req req = {};
-		req.initializeflag = false;
-		req.workingkey1 = keyBuf;
-
-		// 读取加密密钥EDK
-		memset(keyBuf, 0, 64);
-		retKeyBuf = RvcGetKey(m_pkeys, EDK, keyBuf);
-		if (NULL == retKeyBuf)
-		{
-			strErrMsg = CSimpleStringA::Format("在加载密钥至PinPad时调用KMC接口(DES EDK)失败,ErrMsg: [%s]", (const char*)GetKMCLastErrMsg());
-			LogWarn(Severity_Middle, Error_Unexpect, ERR_ACCESSAUTH_GET_KEY,
-				GetOutPutStr("%s%s%s%s", "RvcGetKey", retKeyBuf, "strErrMsg", (const char*)GetKMCLastErrMsg()).c_str());
-			return ERR_ACCESSAUTH_GET_KEY;
-		}
-
-		req.workingkey2 = keyBuf;
-
-		Dbg("load des key to pinpad...");
-		PinPadService_ClientBase *pPinPad = new PinPadService_ClientBase(this);
-		DWORD rc = pPinPad->Connect();
-		if (rc == Error_Succeed)
-		{
-			PinPadService_LoadKeys_Ans ans = {};
-			rc = pPinPad->LoadKeys(req, ans, 30000);
-			if (rc == Error_Succeed)
-				Dbg("load des key to pinpad succ");
-			else
-			{
-				strErrMsg = "加载DES密钥到PinPad失败";
-				SetAuthErrMsg((const char*)strErrMsg);
-				spFunction->SetSysVar("AuthErrMsg", (const char*)strErrMsg, true);
-
-				LogWarn(Severity_Middle, Error_Unexpect, ERR_ACCESSAUTH_LOAD_KEYS_TO_PINPAD,
-					GetOutPutStr("%s%08x%s%s", "LoadKeys", rc, "strErrMsg", strErrMsg).c_str());
-				rc = ERR_ACCESSAUTH_LOAD_KEYS_TO_PINPAD;
-			}
-
-			pPinPad->GetFunction()->CloseSession();
-		}
-		else
-		{
-			strErrMsg = "连接PinPad实体失败";
-			SetAuthErrMsg((const char*)strErrMsg);
-			spFunction->SetSysVar("AuthErrMsg", (const char*)strErrMsg, true);
-			LogWarn(Severity_Middle, Error_Unexpect, ERR_ACCESSAUTH_CONNECT_PINPAD,
-				GetOutPutStr("%s%08x%s%s", "Connect", rc, "strErrMsg", strErrMsg).c_str());
-			rc = ERR_ACCESSAUTH_CONNECT_PINPAD;
-		}
-		pPinPad->SafeDelete();
-		return rc;
-	}
-	else
-	{
-		// support sm key
-		// 读取工作密钥TPK
-		char keyBuf[64];
-		memset(keyBuf, 0, 64);
-
-		retKeyBuf = RvcGetKey(m_pkeys, TPK, keyBuf);
-		if (NULL == retKeyBuf)
-		{
-			strErrMsg = CSimpleStringA::Format("在加载密钥至PinPad时调用KMC接口(SM TPK)失败,  ErrMsg: [%s]", (const char*)GetKMCLastErrMsg());
-
-			LogWarn(Severity_Middle, Error_Unexpect, ERR_ACCESSAUTH_GET_KEY,
-				GetOutPutStr("%s%s%s%s", "RvcGetKey", retKeyBuf, "strErrMsg", (const char*)GetKMCLastErrMsg()).c_str());
-			return ERR_ACCESSAUTH_GET_KEY;
-		}
-
-		PinPadService_LoadKeysSM_Req req = {};
-		req.smflag = 1;
-		req.initializeflag = false;
-		req.workingkey1 = keyBuf;
-
-		// 读取加密密钥EDK
-		memset(keyBuf, 0, 64);
-		retKeyBuf = RvcGetKey(m_pkeys, EDK, keyBuf);
-		if (NULL == retKeyBuf)
-		{
-			strErrMsg = CSimpleStringA::Format("在加载密钥至PinPad时调用KMC接口(SM EDK)失败,  ErrMsg: [%s]", (const char*)GetKMCLastErrMsg());
-		
-			LogWarn(Severity_Middle, Error_Unexpect, ERR_ACCESSAUTH_GET_KEY,
-				GetOutPutStr("%s%s%s%s", "RvcGetKey", retKeyBuf, "strErrMsg", (const char*)GetKMCLastErrMsg()).c_str());
-			return ERR_ACCESSAUTH_GET_KEY;
-		}
-
-		req.workingkey2 = keyBuf;
-
-		Dbg("load sm key to pinpad...");
-		PinPadService_ClientBase *pPinPad = new PinPadService_ClientBase(this);
-		DWORD rc = pPinPad->Connect();
-		if (rc == Error_Succeed)
-		{
-			PinPadService_LoadKeysSM_Ans ans = {};
-			rc = pPinPad->LoadKeysSM(req, ans, 30000);
-			if (rc == Error_Succeed)
-				Dbg("load sm key to pinpad succ");
-			else
-			{
-				strErrMsg = "加载SM密钥到PinPad失败";
-				SetAuthErrMsg((const char*)strErrMsg);
-				spFunction->SetSysVar("AuthErrMsg", (const char*)strErrMsg, true);
-				LogWarn(Severity_Middle, Error_Unexpect, ERR_ACCESSAUTH_LOAD_KEYS_TO_PINPAD,
-					GetOutPutStr("%s%08x%s%s", "LoadKeys", rc, "strErrMsg", strErrMsg).c_str());
-				rc = ERR_ACCESSAUTH_LOAD_KEYS_TO_PINPAD;
-			}
-
-			pPinPad->GetFunction()->CloseSession();
-		}
-		else
-		{
-			strErrMsg = "连接PinPad实体失败";
-			SetAuthErrMsg((const char*)strErrMsg);
-			spFunction->SetSysVar("AuthErrMsg", (const char*)strErrMsg, true);
-
-			LogWarn(Severity_Middle, Error_Unexpect, ERR_ACCESSAUTH_CONNECT_PINPAD,
-				GetOutPutStr("%s%08x%s%s", "Connect", rc, "strErrMsg", strErrMsg).c_str());
-			rc = ERR_ACCESSAUTH_CONNECT_PINPAD;
-		}
-		pPinPad->SafeDelete();
-		return rc;
-	}
-#endif
-*/
 	//@test	
 	//return Error_Succeed;
 
@@ -608,7 +458,7 @@ DWORD CAccessAuthEntity::LoadPinPadWK(bool bSM)
 		
 		PinPadService_LoadKeysSM_Req req = {};
 		req.smflag = 1;
-		req.initializeflag = false;
+		req.initializeflag = true;
 		if (m_bGetKMCKey) {
 			Dbg("使用云接口更新KMC密钥");
 			req.masterkey = m_TMK.c_str();
@@ -623,12 +473,22 @@ DWORD CAccessAuthEntity::LoadPinPadWK(bool bSM)
 			LogWarn(Severity_Middle, Error_Unexpect, ERR_ACCESSAUTH_GET_KMC_NULL,
 				GetOutPutStr("%s%s", "m_bGetKMCKey", "False").c_str());
 			rc = ERR_ACCESSAUTH_GET_KMC_NULL;
-			pPinPad->SafeDelete();
+			//pPinPad->SafeDelete();
 			return rc;
 		}
 
+		if (req.initializeflag) Dbg("initializeflag is true");
+		else Dbg("initializeflag is false");
+		Dbg("req.smflag=%d", req.smflag);
+		Dbg("req.masterkey=%s", req.masterkey.GetData());
+		Dbg("req.workingkey1=%s", req.workingkey1.GetData());
+		Dbg("req.workingkey2=%s", req.workingkey2.GetData());
+		Dbg("req.reserved3=%s", req.reserved3.GetData());
+
 		PinPadService_LoadKeysSM_Ans ans = {};
+		Dbg("1");
 		rc = pPinPad->LoadKeysSM(req, ans, 30000);
+		Dbg("2");
 		if (rc == Error_Succeed)
 			Dbg("load sm key to pinpad succ");
 		else
@@ -637,7 +497,7 @@ DWORD CAccessAuthEntity::LoadPinPadWK(bool bSM)
 			SetAuthErrMsg((const char*)strErrMsg);
 			spFunction->SetSysVar("AuthErrMsg", (const char*)strErrMsg, true);
 			LogWarn(Severity_Middle, Error_Unexpect, ERR_ACCESSAUTH_LOAD_KEYS_TO_PINPAD,
-				GetOutPutStr("%s%08x%s%s", "LoadKeys", rc, "strErrMsg", strErrMsg).c_str());
+				GetOutPutStr("%s%08x%s%s", "LoadKeysSM", rc, "strErrMsg", strErrMsg).c_str());
 			rc = ERR_ACCESSAUTH_LOAD_KEYS_TO_PINPAD;
 		}
 
@@ -652,7 +512,8 @@ DWORD CAccessAuthEntity::LoadPinPadWK(bool bSM)
 			GetOutPutStr("%s%08x%s%s", "Connect", rc, "strErrMsg", strErrMsg).c_str());
 		rc = ERR_ACCESSAUTH_CONNECT_PINPAD;
 	}
-	pPinPad->SafeDelete();
+    //@test 调此接口会挂
+	//pPinPad->SafeDelete();
 	return rc;
 }
 
@@ -773,7 +634,7 @@ DWORD CAccessAuthEntity::EncryptDataWithPinPad(const CBlob &raw, CBlob &enc)
 			GetOutPutStr("%s%08x%s%s", "Connect", rc, "strErrMsg", strErrMsg).c_str());
 		rc = ERR_ACCESSAUTH_CONNECT_PINPAD;
 	}
-	pPinPad->SafeDelete();
+	//pPinPad->SafeDelete();
 	if (rc != Error_Succeed)
 		return rc;
 
@@ -860,7 +721,7 @@ DWORD CAccessAuthEntity::SaveSM2KeyPair(const CBlob &pubKey, const CBlob &priKey
 			Dbg("set sm2 key pair succ");
 	}
 
-	pTokenServiceClient->SafeDelete();
+	//pTokenServiceClient->SafeDelete();
 	return rc;
 }
 
@@ -918,7 +779,7 @@ ErrorCodeEnum CAccessAuthEntity::SaveTokenAndSharedSK(const CBlob &token, const
 		pTokenServiceClient->GetFunction()->CloseSession();
 	}
 
-	pTokenServiceClient->SafeDelete();
+	//pTokenServiceClient->SafeDelete();
 	return rc;
 }
 
@@ -987,7 +848,7 @@ bool CAccessAuthEntity::HasPinPad()
 			pPinPadClient->GetFunction()->CloseSession();
 		}
 
-		pPinPadClient->SafeDelete();
+		//pPinPadClient->SafeDelete();
 		pPinPadClient = NULL;
 		return bPinPadExist;
 	}
@@ -1038,7 +899,7 @@ int CAccessAuthEntity::GetPinPadCapability()
 		LogWarn(Severity_Middle, Error_Unexpect, ERR_ACCESSAUTH_CONNECT_PINPAD,
 			GetOutPutStr("%s%08X%s%s", "Connect", rc,"AuthErrMsg", "连接PinPad实体失败").c_str());
 	}
-	pPinPad->SafeDelete();
+	//pPinPad->SafeDelete();
 
 	return nCapability;
 }
@@ -1108,7 +969,10 @@ bool CAccessAuthEntity::SaveAuthVerAndKey(int nAuthVer, BYTE *pKey)
 			return false;
 		}
 		delete[] pDecodedPrivateKey;
-		Dbg("DecWithSM4_ECB succeess.");
+		//添加调试信息
+		char * pEncPriKey = Str2Hex((char*)pDecryptPrivateKey, decryprtLen);
+		Dbg("DecWithSM4_ECB succeess.privateKey=%s", pEncPriKey);
+		delete pEncPriKey;
 
 		char pPlainKey[KEY_SIZE];
 		int plainKeyLen = KEY_SIZE;
@@ -1545,7 +1409,7 @@ int CAccessAuthEntity::GetPinPadIDAndDeviceID(CSimpleStringA &strPinPadID, CSimp
 			GetOutPutStr("%s%08X%s%s", "Connect", rc, "strErrMsg", "连接PinPad实体失败").c_str());
 	}
 
-	pPinPadClient->SafeDelete();
+	//pPinPadClient->SafeDelete();
 	pPinPadClient = NULL;
 
 	if (bPinPadID)
@@ -1671,7 +1535,7 @@ bool CAccessAuthEntity::HasCkCodeFlg()
 			GetOutPutStr("%s%s", "strErrMsg", strErrMsg).c_str());
 	}
 
-	pPinPadClient->SafeDelete();
+	//pPinPadClient->SafeDelete();
 	pPinPadClient = NULL;
 
 	return bCheckCode? true:false;

+ 4 - 4
Module/mod_cardissuer/CardIssuerFSM.cpp

@@ -4592,7 +4592,7 @@ int CCardIssuerFSM::SyncDataToDB(bool bMaintain[3], bool bSetCaptured)
 	if (eConn != Error_Succeed)
 	{
 		Dbg("SyncDataToDB can't connect to GUIConsole.");
-		pGuiConsoleClient->SafeDelete();
+		//pGuiConsoleClient->SafeDelete();
 		pGuiConsoleClient = NULL;
 		return -1;
 	}
@@ -4668,7 +4668,7 @@ int CCardIssuerFSM::SyncDataToDB(bool bMaintain[3], bool bSetCaptured)
 		eConn = pGuiConsoleClient->SyncMaterialCount(info);
 		Dbg("%d", eConn);
 		pGuiConsoleClient->GetFunction()->CloseSession();
-		pGuiConsoleClient->SafeDelete();
+		//pGuiConsoleClient->SafeDelete();
 		pGuiConsoleClient = NULL;
 		if (eConn != Error_Succeed)
 			return -2;
@@ -4879,7 +4879,7 @@ bool CCardIssuerFSM::RegistCardWhileCaptureCard()
 				if (pGuiConsoleClient != NULL)
 				{
 					pGuiConsoleClient->GetFunction()->CloseSession();
-					pGuiConsoleClient->SafeDelete();
+					//pGuiConsoleClient->SafeDelete();
 					pGuiConsoleClient = NULL;
 				}
 			}
@@ -6096,7 +6096,7 @@ int CCardIssuerFSM::PreOnlineOnStore(SpReqAnsContext<CardIssuerService_PreOnline
 			eErr = pHeartBeatClient->CardActive(req, ans, 60000);
 			Dbg("card active result:%x", eErr);
 			//clear
-			pHeartBeatClient->SafeDelete();
+			//pHeartBeatClient->SafeDelete();
 			pHeartBeatClient = NULL;
 		}
 	}

+ 3 - 3
Module/mod_healthmanager/HealthManagerFSM.cpp

@@ -1229,7 +1229,7 @@ int CHealthManagerFSM::DoInitialization()
 			eErr = m_pInitClient->Connect();
 			if (eErr != Error_Succeed) {
 				Dbg("Initializer connected failed.");
-				m_pInitClient->SafeDelete();
+				//m_pInitClient->SafeDelete();
 				m_pInitClient = NULL;
 				return 2;
 			}
@@ -1396,7 +1396,7 @@ INITIALIZATION:
 						eErrCode = m_pACClient->Connect();
 						if (eErrCode != Error_Succeed) {
 							Dbg("accessauth connected failed.");
-							m_pACClient->SafeDelete();
+							//m_pACClient->SafeDelete();
 							m_pACClient = NULL;
 							StartPinPadEntity();
 							return 1;
@@ -1828,7 +1828,7 @@ int CHealthManagerFSM::USBControl()
 			ErrorCodeEnum eErr = m_pDevCtrlClient->Connect();
 			if (eErr != Error_Succeed) {
 				Dbg("DeviceControl connected failed(%d).",eErr);
-				m_pDevCtrlClient->SafeDelete();
+				//m_pDevCtrlClient->SafeDelete();
 				m_pDevCtrlClient = NULL;
 				return -1;
 			}

+ 4 - 4
Module/mod_healthmanager/mod_healthmanager.cpp

@@ -130,7 +130,7 @@ bool CHealthManagerEntity::DoWatchDog(WatchDogOp eOp)
 				ErrorCodeEnum eErrConn = m_pWatchDogClient->Connect();
 				if (eErrConn != Error_Succeed) {
 					Dbg("WatchDog connected failed.");
-					m_pWatchDogClient->SafeDelete();
+					//m_pWatchDogClient->SafeDelete();
 					m_pWatchDogClient = NULL;
 					break;
 				}
@@ -701,7 +701,7 @@ void CHealthManagerEntity::OnCheckTimeTimeout()
 			m_bGetUpsStateFlag = false;
 			if (eErrState == Error_NetBroken)
 			{
-				m_pUpsClient->SafeDelete();
+				//m_pUpsClient->SafeDelete();
 				m_pUpsClient = NULL;
 			}
 		}
@@ -1208,7 +1208,7 @@ int CHealthManagerEntity::ConnectUps()
 		ErrorCodeEnum eErrConn = m_pUpsClient->Connect();
 		if (eErrConn != Error_Succeed) {
 			Dbg("Ups connected failed(%d).",eErrConn);
-			m_pUpsClient->SafeDelete();
+			//m_pUpsClient->SafeDelete();
 			m_pUpsClient = NULL;
 		}
 		else
@@ -1354,7 +1354,7 @@ void CHealthManagerEntity::ReadMachineDataBySyncSerivce()
 			if (eSync != Error_Succeed)
 			{
 				Dbg("connect to SyncService failed %d.",eSync);
-				m_pSync->SafeDelete();
+				//m_pSync->SafeDelete();
 				m_pSync = NULL;
 			}
 		}

+ 3 - 3
Module/mod_heartbeat/HeartBeatFSM.cpp

@@ -890,7 +890,7 @@ int CHeartBeatFSM::LocalProcessCrossCall(CrossCallReq* reqInfo, const int nBufSi
 			{
 				if (m_pIDClient->QuerySessionClosed())
 				{
-					m_pIDClient->SafeDelete();
+					//m_pIDClient->SafeDelete();
 					m_pIDClient = new IDCertService_ClientBase(GetEntityBase());
 					Dbg("to connect to IDCertificate...");
 					if (m_pIDClient != NULL)
@@ -931,7 +931,7 @@ int CHeartBeatFSM::LocalProcessCrossCall(CrossCallReq* reqInfo, const int nBufSi
 			}
 			else {
 				Dbg("Connect to IDCertificate failed %d", ec);
-				m_pIDClient->SafeDelete();
+				//m_pIDClient->SafeDelete();
 				m_pIDClient = NULL;
 			}
 		}
@@ -948,7 +948,7 @@ int CHeartBeatFSM::LocalProcessCrossCall(CrossCallReq* reqInfo, const int nBufSi
 			{
 				if (m_pPinPadClient->QuerySessionClosed())
 				{
-					m_pPinPadClient->SafeDelete();
+					//m_pPinPadClient->SafeDelete();
 					m_pPinPadClient = new PinPadService_ClientBase(GetEntityBase());
 					Dbg("to connect to PinPad...");
 					if (m_pPinPadClient != NULL)

+ 3 - 3
Module/mod_heartbeat/mod_heartbeat.cpp

@@ -36,7 +36,7 @@ ErrorCodeEnum CHeartBeatEntity::GetEntityErrorList(int &warmLevel,CSimpleStringA
 		if (m_pSelfCheckerClient == NULL)
 		{
 			Dbg("create(new) client failed.");
-			m_pSelfCheckerClient->SafeDelete();
+			//m_pSelfCheckerClient->SafeDelete();
 			m_pSelfCheckerClient = NULL;
 			return Error_Resource;
 		}
@@ -53,7 +53,7 @@ ErrorCodeEnum CHeartBeatEntity::GetEntityErrorList(int &warmLevel,CSimpleStringA
 		if (eErrConn != Error_Succeed || eErr != Error_Succeed)
 		{
 			Dbg("connect to selfchecker failed.");
-			m_pSelfCheckerClient->SafeDelete();
+			//m_pSelfCheckerClient->SafeDelete();
 			m_pSelfCheckerClient = NULL;
 			return Error_Unexpect;
 		}
@@ -69,7 +69,7 @@ ErrorCodeEnum CHeartBeatEntity::GetEntityErrorList(int &warmLevel,CSimpleStringA
 	{
 		Dbg("GetEntityErrorList failed.%d",eErr);
 		m_bConnetedSS = false;
-		m_pSelfCheckerClient->SafeDelete();
+		//m_pSelfCheckerClient->SafeDelete();
 		m_pSelfCheckerClient = NULL;
 		return eErr;
 	}

+ 1 - 1
Module/mod_selfchecker/SelfCheckerFSM.cpp

@@ -1568,7 +1568,7 @@ ErrorCodeEnum CSelfCheckerFSM::ConnectToHealthManager()
 		m_pHealthClient = new HealthManagerClient(GetEntityBase());
 		ErrorCodeEnum ErrorConn = m_pHealthClient->Connect();
 		if (ErrorConn != Error_Succeed) {
-			m_pHealthClient->SafeDelete();
+			//m_pHealthClient->SafeDelete();
 			m_pHealthClient = NULL;
 			Dbg("Connect to Healthmanager failed.%d", ErrorConn);
 			return Error_Unexpect;

+ 4 - 4
Module/mod_selfchecker/mod_selfchecker.cpp

@@ -137,7 +137,7 @@ void CSelfCheckerEntity::OnEntityStateHook(const char *pszEntityName,const char
 			{
 				if (m_pAssChanClient != NULL)
 				{
-					m_pAssChanClient->SafeDelete();
+					//m_pAssChanClient->SafeDelete();
 					m_pAssChanClient = NULL;
 				}
 				
@@ -320,7 +320,7 @@ ErrorCodeEnum CSelfCheckerEntity::ConnectToAssistChannel()
 		m_pAssChanClient = new AssistChannelSelfCheckerClient(this);
 		ErrorCodeEnum ErrorConn = m_pAssChanClient->Connect();
 		if (ErrorConn != Error_Succeed) {
-			m_pAssChanClient->SafeDelete();
+			//m_pAssChanClient->SafeDelete();
 			m_pAssChanClient = NULL;
 			return Error_Unexpect;
 		}
@@ -334,7 +334,7 @@ ErrorCodeEnum CSelfCheckerEntity::ConnectToAssistChannel()
 				{
 					Dbg("BeginState biz channel failed!");
 					m_pAssChanClient->GetFunction()->CloseSession();
-					m_pAssChanClient->SafeDelete();
+					//m_pAssChanClient->SafeDelete();
 					m_pAssChanClient = NULL;
 					return Error_Unexpect;
 					//pTransactionContext->SendAnswer(ErrorConn);
@@ -354,7 +354,7 @@ ErrorCodeEnum CSelfCheckerEntity::ConnectToAssistChannel()
 				{
 					Dbg("Begin BeginRecv ACM_TYPE_DEVICE failed!");
 					m_pAssChanClient->GetFunction()->CloseSession();
-					m_pAssChanClient->SafeDelete();
+					//m_pAssChanClient->SafeDelete();
 					m_pAssChanClient = NULL;
 					return Error_Unexpect;
 					//pTransactionContext->SendAnswer(Error);