summaryrefslogtreecommitdiff
path: root/src/account-server/accounthandler.cpp
diff options
context:
space:
mode:
authorDavid Athay <ko2fan@gmail.com>2009-01-12 12:25:42 +0000
committerDavid Athay <ko2fan@gmail.com>2009-01-12 12:25:42 +0000
commitd1b73b1195f8e8b2ad64ff692e7ddb17ed0bbad1 (patch)
tree3cfb22ab8b13fc47284f808d5da37ec2fa97d6a1 /src/account-server/accounthandler.cpp
parent83ecbeff8d09b212cddc33b1879a63002fad46c0 (diff)
downloadmanaserv-d1b73b1195f8e8b2ad64ff692e7ddb17ed0bbad1.tar.gz
manaserv-d1b73b1195f8e8b2ad64ff692e7ddb17ed0bbad1.tar.bz2
manaserv-d1b73b1195f8e8b2ad64ff692e7ddb17ed0bbad1.tar.xz
manaserv-d1b73b1195f8e8b2ad64ff692e7ddb17ed0bbad1.zip
Added getting IP, and restricting time between logins
Diffstat (limited to 'src/account-server/accounthandler.cpp')
-rw-r--r--src/account-server/accounthandler.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp
index 0b81787b..506d80f8 100644
--- a/src/account-server/accounthandler.cpp
+++ b/src/account-server/accounthandler.cpp
@@ -169,6 +169,22 @@ static void handleLoginMessage(AccountClient &computer, MessageIn &msg)
return;
}
+ // get the IP address
+ int address = computer.getIP();
+
+ // TODO: Check IP against blacklist
+
+ time_t lastAttempt = computer.getLastLoginAttempt();
+ if ((time(NULL) - lastAttempt) < 1)
+ {
+ reply.writeByte(LOGIN_INVALID_TIME);
+ computer.send(reply);
+ return;
+ }
+
+ // updates the time last attempted to login
+ computer.updateLoginAttempt();
+
std::string username = msg.readString();
std::string password = msg.readString();