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:
psychon
2009-07-12 11:31:49 +00:00
parent b03bc3cac9
commit 165070019d
2 changed files with 10 additions and 1 deletions
+9 -1
View File
@@ -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;
}
}
+1
View File
@@ -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