added: IP ban mechanism (not finished yet -- we need a winix function to remove a ban)
now after some incorrent login attempts your IP can be banned or blocked (see new config variables) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@902 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
#include <ctime>
|
||||
|
||||
#include "sessioncontainer.h"
|
||||
#include "ipbancontainer.h"
|
||||
#include "config.h"
|
||||
#include "request.h"
|
||||
#include "lastcontainer.h"
|
||||
@@ -34,6 +35,7 @@ public:
|
||||
void SetSystem(System * psystem);
|
||||
void SetLastContainer(LastContainer * plast_container);
|
||||
|
||||
|
||||
// can return a null pointer
|
||||
Session * FindSession(long id);
|
||||
|
||||
@@ -41,6 +43,7 @@ public:
|
||||
void DeleteSessions(); // deleting all sessions
|
||||
bool ChangeSessionId(long old_id);
|
||||
|
||||
void InitBanList();
|
||||
void InitTmpSession();
|
||||
void UninitTmpSession();
|
||||
|
||||
@@ -56,6 +59,11 @@ public:
|
||||
size_t Size();
|
||||
size_t MarkAllSessionsToRemove(long user_id);
|
||||
|
||||
IPBan & AddIPToBanList(int ip);
|
||||
size_t BanListSize();
|
||||
IPBan & GetIPBan(size_t index);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Config * config;
|
||||
@@ -68,6 +76,9 @@ private:
|
||||
Session * session;
|
||||
|
||||
SessionContainer session_tab;
|
||||
IPBanContainer ban_tab;
|
||||
|
||||
IPBan * current_ip_ban;
|
||||
|
||||
// session with id 0
|
||||
Session temporary_session;
|
||||
@@ -77,7 +88,7 @@ private:
|
||||
long CreateSessionId();
|
||||
void CreateSession();
|
||||
bool SetSessionFromCookie(const std::string & cookie);
|
||||
|
||||
void SetTemporarySession();
|
||||
|
||||
// second thread
|
||||
int deleted;
|
||||
|
Reference in New Issue
Block a user