Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Emtec
Created November 7, 2009 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Emtec/228723 to your computer and use it in GitHub Desktop.
Save Emtec/228723 to your computer and use it in GitHub Desktop.
diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp
index 1de190b..fadf92d 100644
--- a/src/game/WorldSocket.cpp
+++ b/src/game/WorldSocket.cpp
@@ -30,6 +30,8 @@
#include "WorldSocket.h"
#include "Common.h"
+#include "Config/ConfigEnv.h"
+
#include "Util.h"
#include "World.h"
#include "WorldPacket.h"
@@ -861,6 +863,25 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
if(security > SEC_ADMINISTRATOR) // prevent invalid security settings in DB
security = SEC_ADMINISTRATOR;
+
+ // CHECK ACCESS TO REALM - FOR ONLY TEST ACCOUNT
+ QueryResult *accAccess = loginDatabase.PQuery("SELECT realm_id FROM account_access WHERE acc_id = '%d'", id);
+ uint32 accessRealm = fieldsAcc[0].GetInt32();
+ if(accAccess){
+ Field* fieldsAcc = accAccess->Fetch();
+ uint32 realmID = sConfig.GetIntDefault("RealmID", 0);
+ if(realmID != accessRealm){
+ packet.Initialize (SMSG_AUTH_RESPONSE, 1);
+ packet << uint8 (AUTH_FAILED);
+ SendPacket (packet);
+
+ delete accAccess, result;
+ sLog.outBasic ("WorldSocket::HandleAuthSession: Account not access to realm).");
+ return -1;
+ }
+ delete accAccess;
+ }
+
K.SetHexStr (fields[2].GetString ());
time_t mutetime = time_t (fields[8].GetUInt64 ());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment