summaryrefslogtreecommitdiffstats
path: root/src/game-server/accountconnection.cpp
diff options
context:
space:
mode:
authorChuck Miller <shadowmil@gmail.com>2009-10-07 13:39:24 -0400
committerChuck Miller <shadowmil@gmail.com>2009-10-07 13:39:24 -0400
commitc19244ddca910dbfc566a61772296cb59fa28d80 (patch)
tree5771c2d385487e311959f48e3f0de47e264712ff /src/game-server/accountconnection.cpp
parent9a35609facf9fbb511467d607f83ecd1f4d1ee1b (diff)
downloadmanaserv-c19244ddca910dbfc566a61772296cb59fa28d80.tar.gz
manaserv-c19244ddca910dbfc566a61772296cb59fa28d80.tar.xz
manaserv-c19244ddca910dbfc566a61772296cb59fa28d80.zip
Adds server auth, also adds the "net_password" configure option
Diffstat (limited to 'src/game-server/accountconnection.cpp')
-rw-r--r--src/game-server/accountconnection.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/game-server/accountconnection.cpp b/src/game-server/accountconnection.cpp
index 41f7162..13c924a 100644
--- a/src/game-server/accountconnection.cpp
+++ b/src/game-server/accountconnection.cpp
@@ -67,11 +67,14 @@ bool AccountConnection::start()
Configuration::getValue("net_gameServerAddress", "localhost");
const int gameServerPort =
Configuration::getValue("net_gameServerPort", DEFAULT_SERVER_PORT + 3);
+ const std::string password =
+ Configuration::getValue("net_password", "P@s$w0rd");
// Register with the account server and send the list of maps we handle
MessageOut msg(GAMSG_REGISTER);
msg.writeString(gameServerAddress);
msg.writeShort(gameServerPort);
+ msg.writeString(password);
msg.writeLong(ItemManager::GetDatabaseVersion());
const MapManager::Maps &m = MapManager::getMaps();
for (MapManager::Maps::const_iterator i = m.begin(), i_end = m.end();
@@ -113,6 +116,12 @@ void AccountConnection::processMessage(MessageIn &msg)
{
LOG_DEBUG("Local item database is in sync with account server.");
}
+ if (msg.readShort() != PASSWORD_OK)
+ {
+ LOG_ERROR("This game server sent a invaild password");
+ stop();
+ exit(1);
+ }
} break;
case AGMSG_PLAYER_ENTER: