mirror of
https://github.com/znc/znc.git
synced 2026-07-06 01:41:12 +02:00
Add new config option AnonIPLimit
This makes the limit added in r1561 configurable. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1563 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user