summaryrefslogtreecommitdiff
path: root/src/account-server/serverhandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/account-server/serverhandler.cpp')
-rw-r--r--src/account-server/serverhandler.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/account-server/serverhandler.cpp b/src/account-server/serverhandler.cpp
index 5bfa6a57..ff523b49 100644
--- a/src/account-server/serverhandler.cpp
+++ b/src/account-server/serverhandler.cpp
@@ -31,6 +31,7 @@
#include "account-server/dalstorage.hpp"
#include "chat-server/post.hpp"
#include "common/transaction.hpp"
+#include "common/configuration.hpp"
#include "net/connectionhandler.hpp"
#include "net/messageout.hpp"
#include "net/netcomputer.hpp"
@@ -176,6 +177,7 @@ void ServerHandler::processMessage(NetComputer *comp, MessageIn &msg)
// TODO: check the credentials of the game server
server->address = msg.readString();
server->port = msg.readShort();
+ const std::string password = msg.readString();
// checks the version of the remote item database with our local copy
unsigned int dbversion = msg.readLong();
@@ -194,7 +196,18 @@ void ServerHandler::processMessage(NetComputer *comp, MessageIn &msg)
LOG_DEBUG("Item database of game server has a wrong version");
outMsg.writeShort(DATA_VERSION_OUTDATED);
}
- comp->send(outMsg);
+ if (password == Configuration::getValue("net_password", "P@s$w0rd"))
+ {
+ outMsg.writeShort(PASSWORD_OK);
+ comp->send(outMsg);
+ }
+ else
+ {
+ LOG_INFO("The password given by " << server->address << ':' << server->port << " was bad.");
+ outMsg.writeShort(PASSWORD_BAD);
+ comp->disconnect(outMsg);
+ break;
+ }
LOG_INFO("Game server " << server->address << ':' << server->port
<< " wants to register " << (msg.getUnreadLength() / 2)