Skip to content

Commit

Permalink
Updated Realmd to now accept both local and external connections
Browse files Browse the repository at this point in the history
Thanks to Shauren and TrinityCore for the first implementation
  • Loading branch information
Foereaper committed Apr 12, 2015
1 parent 85484cf commit 19851a0
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/realmd
15 changes: 15 additions & 0 deletions src/shared/Utilities/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,21 @@ bool IsIPAddress(char const* ipaddress)
return ACE_OS::inet_addr(ipaddress) != INADDR_NONE;
}

std::string GetAddressString(ACE_INET_Addr const& addr)
{
char buf[ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 16];
addr.addr_to_string(buf, ACE_MAX_FULLY_QUALIFIED_NAME_LEN + 16);
return buf;
}

bool IsIPAddrInNetwork(ACE_INET_Addr const& net, ACE_INET_Addr const& addr, ACE_INET_Addr const& subnetMask)
{
uint32 mask = subnetMask.get_ip_address();
if ((net.get_ip_address() & mask) == (addr.get_ip_address() & mask))
return true;
return false;
}

/// create PID file
uint32 CreatePIDFile(const std::string& filename)
{
Expand Down
9 changes: 9 additions & 0 deletions src/shared/Utilities/Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#define MANGOS_H_UTIL

#include "Common/Common.h"
#include <ace/Null_Mutex.h>
#include <ace/INET_Addr.h>

#include <string>
#include <vector>
Expand Down Expand Up @@ -700,6 +702,13 @@ void vutf8printf(FILE* out, const char* str, va_list* ap);
* @return bool
*/
bool IsIPAddress(char const* ipaddress);

/// Checks if address belongs to the a network with specified submask
bool IsIPAddrInNetwork(ACE_INET_Addr const& net, ACE_INET_Addr const& addr, ACE_INET_Addr const& subnetMask);

/// Transforms ACE_INET_Addr address into string format "dotted_ip:port"
std::string GetAddressString(ACE_INET_Addr const& addr);

/**
* @brief
*
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@
#define REVISION_NR "21000"
#define REVISION_DB_CHARACTERS "required_21000_01_warden_action"
#define REVISION_DB_MANGOS "required_21000_08_warden_checks"
#define REVISION_DB_REALMD "required_20150412_warden_db_log"
#define REVISION_DB_REALMD "required_20150412_auth_realmlist"
#endif // __REVISION_H__

0 comments on commit 19851a0

Please sign in to comment.