diff --git a/znc.cpp b/znc.cpp index 81b804a0..9bbb1801 100644 --- a/znc.cpp +++ b/znc.cpp @@ -36,6 +36,7 @@ CZNC::CZNC() { #endif m_pISpoofLockFile = NULL; m_uiConnectDelay = 30; + m_uiAnonIPLimit = 10; SetISpoofFormat(""); // Set ISpoofFormat to default m_uBytesRead = 0; m_uBytesWritten = 0; @@ -400,7 +401,9 @@ bool CZNC::IsHostAllowed(const CString& sHostMask) const { } bool CZNC::AllowConnectionFrom(const CString& sIP) const { - if (GetManager().GetAnonConnectionCount(sIP) >= 10) + if (m_uiAnonIPLimit == 0) + return true; + if (GetManager().GetAnonConnectionCount(sIP) >= m_uiAnonIPLimit) return false; return true; } @@ -511,6 +514,8 @@ bool CZNC::WriteConfig() { return false; } + m_LockFile.Write("AnonIPLimit = " + CString(m_uiAnonIPLimit) + "\n"); + for (size_t l = 0; l < m_vpListeners.size(); l++) { CListener* pListener = m_vpListeners[l]; CString sHostPortion = pListener->GetBindHost(); @@ -1497,6 +1502,9 @@ bool CZNC::DoRehash(CString& sError) } else if (sName.Equals("ConnectDelay")) { m_uiConnectDelay = sValue.ToUInt(); continue; + } else if (sName.Equals("AnonIPLimit")) { + m_uiAnonIPLimit = sValue.ToUInt(); + continue; } } diff --git a/znc.h b/znc.h index 7844b30f..42430ecf 100644 --- a/znc.h +++ b/znc.h @@ -158,6 +158,7 @@ protected: CFile m_LockFile; CFile* m_pISpoofLockFile; unsigned int m_uiConnectDelay; + unsigned int m_uiAnonIPLimit; #ifdef _MODULES CGlobalModules* m_pModules; #endif