diff --git a/IRCSock.cpp b/IRCSock.cpp index 66125dcf..ccdc4cc7 100644 --- a/IRCSock.cpp +++ b/IRCSock.cpp @@ -19,7 +19,6 @@ const unsigned int CIRCSock::m_uCTCPFloodCount = 5; CIRCSock::CIRCSock(CUser* pUser) : CZNCSock() { m_pUser = pUser; - m_bISpoofReleased = false; m_bAuthed = false; m_bNamesx = false; m_bUHNames = false; @@ -66,10 +65,6 @@ CIRCSock::~CIRCSock() { delete a->second; } - if (!m_bISpoofReleased) { - CZNC::Get().ReleaseISpoof(); - } - Quit(); m_msChans.clear(); GetUser()->AddBytesRead(GetBytesRead()); @@ -158,9 +153,6 @@ void CIRCSock::ReadLine(const CString& sData) { m_pUser->ClearRawBuffer(); m_pUser->AddRawBuffer(":" + sServer + " " + sCmd + " ", " " + sRest); - CZNC::Get().ReleaseISpoof(); - m_bISpoofReleased = true; - break; } case 5: diff --git a/IRCSock.h b/IRCSock.h index e66eef28..91a302f7 100644 --- a/IRCSock.h +++ b/IRCSock.h @@ -101,7 +101,6 @@ private: void SendAltNick(const CString& sBadNick); void SendNextCap(); protected: - bool m_bISpoofReleased; bool m_bAuthed; bool m_bNamesx; bool m_bUHNames; diff --git a/modules/data/webadmin/tmpl/settings.tmpl b/modules/data/webadmin/tmpl/settings.tmpl index 2e575637..ff0863d6 100644 --- a/modules/data/webadmin/tmpl/settings.tmpl +++ b/modules/data/webadmin/tmpl/settings.tmpl @@ -66,18 +66,6 @@
-
-
ISpoofFile:
-
-
Example: ~/.oidentd.conf -
- -
-
ISpoofFormat:
-
-
-
-
Maximum Buffer Size:
diff --git a/modules/webadmin.cpp b/modules/webadmin.cpp index e6732525..f5f19e31 100644 --- a/modules/webadmin.cpp +++ b/modules/webadmin.cpp @@ -967,8 +967,6 @@ public: Tmpl["Action"] = "settings"; Tmpl["Title"] = "Settings"; Tmpl["StatusPrefix"] = CZNC::Get().GetStatusPrefix(); - Tmpl["ISpoofFile"] = CZNC::Get().GetISpoofFile(); - Tmpl["ISpoofFormat"] = CZNC::Get().GetISpoofFormat(); Tmpl["MaxBufferSize"] = CString(CZNC::Get().GetMaxBufferSize()); Tmpl["ConnectDelay"] = CString(CZNC::Get().GetConnectDelay()); Tmpl["ServerThrottle"] = CString(CZNC::Get().GetServerThrottle()); @@ -1059,8 +1057,6 @@ public: CString sArg; sArg = WebSock.GetParam("statusprefix"); CZNC::Get().SetStatusPrefix(sArg); - sArg = WebSock.GetParam("ispooffile"); CZNC::Get().SetISpoofFile(sArg); - sArg = WebSock.GetParam("ispoofformat"); CZNC::Get().SetISpoofFormat(sArg); sArg = WebSock.GetParam("maxbufsize"); CZNC::Get().SetMaxBufferSize(sArg.ToUInt()); sArg = WebSock.GetParam("connectdelay"); CZNC::Get().SetConnectDelay(sArg.ToUInt()); sArg = WebSock.GetParam("serverthrottle"); CZNC::Get().SetServerThrottle(sArg.ToUInt()); diff --git a/znc.cpp b/znc.cpp index 0c9782e5..c8a9297b 100644 --- a/znc.cpp +++ b/znc.cpp @@ -37,10 +37,8 @@ CZNC::CZNC() { } m_pModules = new CGlobalModules(); - m_pISpoofLockFile = NULL; m_uiConnectDelay = 5; m_uiAnonIPLimit = 10; - SetISpoofFormat(""); // Set ISpoofFormat to default m_uBytesRead = 0; m_uBytesWritten = 0; m_uiMaxBufferSize = 500; @@ -51,9 +49,6 @@ CZNC::CZNC() { } CZNC::~CZNC() { - if (m_pISpoofLockFile) - ReleaseISpoof(); - m_pModules->UnloadAll(); for (map::iterator a = m_msUsers.begin(); a != m_msUsers.end(); ++a) { @@ -117,10 +112,6 @@ bool CZNC::ConnectUser(CUser *pUser) { CString sSockName = "IRC::" + pUser->GetUserName(); CIRCSock* pIRCSock = pUser->GetIRCSock(); - if (m_pISpoofLockFile != NULL) { - return false; - } - if (!pUser->GetIRCConnectEnabled()) return false; @@ -135,12 +126,6 @@ bool CZNC::ConnectUser(CUser *pUser) { if (m_sConnectThrottle.GetItem(pServer->GetName())) return false; - if (!WriteISpoof(pUser)) { - DEBUG("ISpoof [" + m_sISpoofFile + "] could not be written"); - pUser->PutStatus("ISpoof [" + m_sISpoofFile + "] could not be written, retrying..."); - return true; - } - m_sConnectThrottle.AddItem(pServer->GetName()); DEBUG("User [" << pUser->GetUserName() << "] is connecting to [" << pServer->GetString(false) << "] ..."); @@ -159,13 +144,11 @@ bool CZNC::ConnectUser(CUser *pUser) { MODULECALL(OnIRCConnecting(pIRCSock), pUser, NULL, DEBUG("Some module aborted the connection attempt"); pUser->PutStatus("Some module aborted the connection attempt"); - ReleaseISpoof(); delete pIRCSock; return false; ); if (!m_Manager.Connect(pServer->GetName(), pServer->GetPort(), sSockName, 120, bSSL, pUser->GetBindHost(), pIRCSock)) { - ReleaseISpoof(); pUser->PutStatus("Unable to connect. (Bad host?)"); } @@ -250,61 +233,6 @@ void CZNC::Loop() { } } -bool CZNC::WriteISpoof(CUser* pUser) { - if (m_pISpoofLockFile != NULL) - return false; - - if (!GetISpoofFile().empty()) { - m_pISpoofLockFile = new CFile; - if (!m_pISpoofLockFile->TryExLock(GetISpoofFile(), O_RDWR | O_CREAT)) { - DEBUG("Couldn't open and lock ISpoofFile: " << strerror(errno)); - delete m_pISpoofLockFile; - m_pISpoofLockFile = NULL; - return false; - } - - char buf[1024]; - memset((char*) buf, 0, 1024); - m_pISpoofLockFile->Read(buf, 1023); - m_sOrigISpoof = buf; - - if (!m_pISpoofLockFile->Seek(0) || !m_pISpoofLockFile->Truncate()) { - DEBUG("Couldn't truncate the ISpoofFile: " << strerror(errno)); - delete m_pISpoofLockFile; - m_pISpoofLockFile = NULL; - return false; - } - - CString sData = pUser->ExpandString(m_sISpoofFormat); - - // If the format doesn't contain anything expandable, we'll - // assume this is an "old"-style format string. - if (sData == m_sISpoofFormat) { - sData.Replace("%", pUser->GetIdent()); - } - DEBUG("Writing [" + sData + "] to ISpoofFile [" + m_pISpoofLockFile->GetLongName() + "]"); - m_pISpoofLockFile->Write(sData + "\n"); - } - return true; -} - -void CZNC::ReleaseISpoof() { - if (m_pISpoofLockFile == NULL) - return; - - if (m_pISpoofLockFile->Seek(0) && m_pISpoofLockFile->Truncate()) { - DEBUG("Writing [" + m_sOrigISpoof + "] to ISpoofFile [" + m_pISpoofLockFile->GetLongName() + "]"); - m_pISpoofLockFile->Write(m_sOrigISpoof); - } else { - DEBUG("Error while restoring ISpoof: " << strerror(errno)); - } - - m_sOrigISpoof = ""; - - delete m_pISpoofLockFile; - m_pISpoofLockFile = NULL; -} - CFile* CZNC::InitPidFile() { if (!m_sPidFile.empty()) { CString sFile; @@ -547,13 +475,6 @@ bool CZNC::WriteConfig() { m_LockFile.Write("ConnectDelay = " + CString(m_uiConnectDelay) + "\n"); m_LockFile.Write("ServerThrottle = " + CString(m_sConnectThrottle.GetTTL()/1000) + "\n"); - if (!m_sISpoofFile.empty()) { - m_LockFile.Write("ISpoofFile = " + m_sISpoofFile.FirstLine() + "\n"); - if (!m_sISpoofFormat.empty()) { - m_LockFile.Write("ISpoofFormat = " + m_sISpoofFormat.FirstLine() + "\n"); - } - } - if (!m_sPidFile.empty()) { m_LockFile.Write("PidFile = " + m_sPidFile.FirstLine() + "\n"); } @@ -1620,12 +1541,6 @@ bool CZNC::DoRehash(CString& sError) msModules[sModName] = sArgs; continue; - } else if (sName.Equals("ISpoofFormat")) { - m_sISpoofFormat = sValue; - continue; - } else if (sName.Equals("ISpoofFile")) { - m_sISpoofFile = sValue; - continue; } else if (sName.Equals("MOTD")) { AddMotd(sValue); continue; @@ -1989,11 +1904,6 @@ protected: const map& mUsers = CZNC::Get().GetUserMap(); map::const_iterator it = mUsers.begin(); - if (CZNC::Get().IsISpoofLocked()) { - // Meh, gotta retry later - return; - } - uiUserCount = CZNC::Get().GetUserMap().size(); if (m_uiPosNextUser >= uiUserCount) { diff --git a/znc.h b/znc.h index 414d4aeb..8ee64b35 100644 --- a/znc.h +++ b/znc.h @@ -35,9 +35,6 @@ public: void DeleteUsers(); void Loop(); - bool WriteISpoof(CUser* pUser); - void ReleaseISpoof(); - bool IsISpoofLocked() { return m_pISpoofLockFile != NULL; } bool WritePidFile(int iPid); bool DeletePidFile(); bool WaitForChildLock(); @@ -83,8 +80,6 @@ public: void SetConfigState(enum ConfigState e) { m_eConfigState = e; } void SetSkinName(const CString& s) { m_sSkinName = s; } void SetStatusPrefix(const CString& s) { m_sStatusPrefix = (s.empty()) ? "*" : s; } - void SetISpoofFile(const CString& s) { m_sISpoofFile = s; } - void SetISpoofFormat(const CString& s) { m_sISpoofFormat = (s.empty()) ? "global { reply \"%\" }" : s; } void SetMaxBufferSize(unsigned int i) { m_uiMaxBufferSize = i; } void SetAnonIPLimit(unsigned int i) { m_uiAnonIPLimit = i; } void SetServerThrottle(unsigned int i) { m_sConnectThrottle.SetTTL(i*1000); } @@ -108,8 +103,6 @@ public: CString GetPemLocation() const { return CDir::ChangeDir("", m_sSSLCertFile); } const CString& GetConfigFile() const { return m_sConfigFile; } bool WritePemFile(); - const CString& GetISpoofFile() const { return m_sISpoofFile; } - const CString& GetISpoofFormat() const { return m_sISpoofFormat; } const VCString& GetBindHosts() const { return m_vsBindHosts; } const vector& GetListeners() const { return m_vpListeners; } time_t TimeStarted() const { return m_TimeStarted; } @@ -171,15 +164,11 @@ protected: CString m_sConfigFile; CString m_sSkinName; CString m_sStatusPrefix; - CString m_sISpoofFile; - CString m_sOrigISpoof; - CString m_sISpoofFormat; CString m_sPidFile; CString m_sSSLCertFile; VCString m_vsBindHosts; VCString m_vsMotd; CFile m_LockFile; - CFile* m_pISpoofLockFile; unsigned int m_uiConnectDelay; unsigned int m_uiAnonIPLimit; unsigned int m_uiMaxBufferSize;