bool MBMatchServer::IsKeeper( const MUID& uidKeeper ) { MMatchObject* pObj = GetObject( uidKeeper ); if( 0 == pObj ) return false; if( !MGetServerConfig()->IsKeeperIP(pObj->GetIPString()) ) { mlog( "Keeper hacking. " ); if( 0 != pObj->GetIPString() ) mlog( "IP:%s, ", pObj->GetIPString() ); if( (0 != pObj->GetCharInfo()) && (0 != pObj->GetCharInfo()->m_szName) ) mlog( "Name:%s", pObj->GetCharInfo()->m_szName ); mlog( "\n" ); return false; } return true; }
bool MMatchServer::AddObjectOnMatchLogin(const MUID& uidComm, const MMatchAccountInfo* pSrcAccountInfo, const MMatchAccountPenaltyInfo* pSrcAccountPenaltyInfo, bool bFreeLoginIP, string strCountryCode3, unsigned long nChecksumPack) { MCommObject* pCommObj = (MCommObject*)m_CommRefCache.GetRef(uidComm); if (pCommObj == NULL) return false; MUID AllocUID = uidComm; int nErrCode = ObjectAdd(uidComm); if(nErrCode!=MOK) { LOG(LOG_DEBUG, MErrStr(nErrCode) ); } MMatchObject* pObj = GetObject(AllocUID); if (pObj == NULL) { // Notify Message 필요 -> 로그인 관련 - 해결(Login Fail 메세지 이용) // Disconnect(uidComm); MCommand* pCmd = CreateCmdMatchResponseLoginFailed(AllocUID, MERR_FAILED_LOGIN_RETRY); Post(pCmd); return false; } pObj->AddCommListener(uidComm); pObj->SetObjectType(MOT_PC); memcpy(pObj->GetAccountInfo(), pSrcAccountInfo, sizeof(MMatchAccountInfo)); memcpy(pObj->GetAccountPenaltyInfo(), pSrcAccountPenaltyInfo, sizeof(MMatchAccountPenaltyInfo)); pObj->SetFreeLoginIP(bFreeLoginIP); pObj->SetCountryCode3( strCountryCode3 ); pObj->UpdateTickLastPacketRecved(); pObj->UpdateLastHShieldMsgRecved(); if (pCommObj != NULL) { pObj->SetPeerAddr(pCommObj->GetIP(), pCommObj->GetIPString(), pCommObj->GetPort()); } SetClientClockSynchronize(uidComm); // 프리미엄 IP를 체크한다. if (MGetServerConfig()->CheckPremiumIP()) { if (pCommObj) { bool bIsPremiumIP = false; bool bExistPremiumIPCache = false; bExistPremiumIPCache = MPremiumIPCache()->CheckPremiumIP(pCommObj->GetIP(), bIsPremiumIP); // 만약 캐쉬에 없으면 직접 DB에서 찾도록 한다. if (!bExistPremiumIPCache) { if (m_MatchDBMgr.CheckPremiumIP(pCommObj->GetIPString(), bIsPremiumIP)) { // 결과를 캐쉬에 저장 MPremiumIPCache()->AddIP(pCommObj->GetIP(), bIsPremiumIP); } else { MPremiumIPCache()->OnDBFailed(); } } //if (bIsPremiumIP) pObj->GetAccountInfo()->m_nPGrade = MMPG_PREMIUM_IP; } } if (!PreCheckAddObj(uidComm)) { // 보안 관련 초기화 서버 설정에 문제가 생겼다고 로그인 실패를 리턴한다. // MCommand* pCmd = CreateCmdMatchResponseLoginFailed(uidComm, MERR_FAILED_AUTHENTICATION); Post(pCmd); return false; } MCommand* pCmd = CreateCmdMatchResponseLoginOK(uidComm, AllocUID, pObj->GetAccountInfo()->m_szUserID, pObj->GetAccountInfo()->m_nUGrade, pObj->GetAccountInfo()->m_nPGrade, pObj->GetAccountInfo()->m_nECoins, // pObj->GetAntiHackInfo()->m_szRandomValue, pObj->GetHShieldInfo()->m_pbyGuidReqMsg); Post(pCmd); // 접속 로그를 남긴다. //m_MatchDBMgr.InsertConnLog(pObj->GetAccountInfo()->m_nAID, pObj->GetIPString(), pObj->GetCountryCode3() ); // 접속 로그 MAsyncDBJob_InsertConnLog* pNewJob = new MAsyncDBJob_InsertConnLog(uidComm); pNewJob->Input(pObj->GetAccountInfo()->m_nAID, pObj->GetIPString(), pObj->GetCountryCode3() ); PostAsyncJob(pNewJob); // Client DataFile Checksum을 검사한다. // 2006.2.20 dubble. filelist checksum으로 변경 unsigned long nChecksum = nChecksumPack ^ uidComm.High ^ uidComm.Low; if( MGetServerConfig()->IsUseFileCrc() && !MMatchAntiHack::CheckClientFileListCRC(nChecksum, pObj->GetUID()) && !MGetServerConfig()->IsDebugLoginIPList(pObj->GetIPString()) ) { LOG(LOG_PROG, "Invalid filelist crc (%u) , UserID(%s)\n ", nChecksum, pObj->GetAccountInfo()->m_szUserID); // pObj->SetBadFileCRCDisconnectWaitInfo(); pObj->DisconnectHacker( MMHT_BADFILECRC); } /* if (nChecksum != GetItemFileChecksum()) { LOG(LOG_PROG, "Invalid ZItemChecksum(%u) , UserID(%s) ", nChecksum, pObj->GetAccountInfo()->m_szUserID); Disconnect(uidComm); return false; } */ pObj->LoginCompleted(); return true; }