aboutsummaryrefslogtreecommitdiff
path: root/src/server/authserver/Server/AuthSocket.cpp
diff options
context:
space:
mode:
authorleak <leak@bitmx.net>2012-02-19 13:51:16 +0100
committerleak <leak@bitmx.net>2012-02-19 13:51:16 +0100
commit8e3a4b956e8fcc3ec31240d847a7a630eaf2bba2 (patch)
treec7a797f883906019d9fa820b4d782eb7dfd4c1c5 /src/server/authserver/Server/AuthSocket.cpp
parentf0f68f15a86c5ac0c83c47c6db67786506f8460d (diff)
Core/Warden: Base implementation for Warden functionality
Note: The default config file action for clients failing the checks can be changed for each check via the characters.warden_action table Credits to TOM_RUS
Diffstat (limited to 'src/server/authserver/Server/AuthSocket.cpp')
-rwxr-xr-xsrc/server/authserver/Server/AuthSocket.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp
index 6d295a0bbee..e1d77c60286 100755
--- a/src/server/authserver/Server/AuthSocket.cpp
+++ b/src/server/authserver/Server/AuthSocket.cpp
@@ -16,6 +16,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <algorithm>
#include <openssl/md5.h>
#include "Common.h"
@@ -343,6 +344,13 @@ bool AuthSocket::_HandleLogonChallenge()
_login = (const char*)ch->I;
_build = ch->build;
_expversion = (AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : NO_VALID_EXP_FLAG) | (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG);
+ _os = (const char*)ch->os;
+
+ if (_os.size() > 4)
+ return false;
+
+ // Restore string order as its byte order is reversed
+ std::reverse(_os.begin(), _os.end());
pkt << (uint8)AUTH_LOGON_CHALLENGE;
pkt << (uint8)0x00;
@@ -602,7 +610,8 @@ bool AuthSocket::_HandleLogonProof()
stmt->setString(0, K_hex);
stmt->setString(1, socket().getRemoteAddress().c_str());
stmt->setUInt32(2, GetLocaleByName(_localizationName));
- stmt->setString(3, _login);
+ stmt->setString(3, _os);
+ stmt->setString(4, _login);
LoginDatabase.Execute(stmt);
OPENSSL_free((void*)K_hex);
@@ -741,6 +750,13 @@ bool AuthSocket::_HandleReconnectChallenge()
// Reinitialize build, expansion and the account securitylevel
_build = ch->build;
_expversion = (AuthHelper::IsPostBCAcceptedClientBuild(_build) ? POST_BC_EXP_FLAG : NO_VALID_EXP_FLAG) | (AuthHelper::IsPreBCAcceptedClientBuild(_build) ? PRE_BC_EXP_FLAG : NO_VALID_EXP_FLAG);
+ _os = (const char*)ch->os;
+
+ if (_os.size() > 4)
+ return false;
+
+ // Restore string order as its byte order is reversed
+ std::reverse(_os.begin(), _os.end());
Field* fields = result->Fetch();
uint8 secLevel = fields[2].GetUInt8();