aboutsummaryrefslogtreecommitdiff
path: root/src/server/authserver/Authentication
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/authserver/Authentication')
-rw-r--r--src/server/authserver/Authentication/AuthCodes.cpp87
-rw-r--r--src/server/authserver/Authentication/AuthCodes.h132
-rw-r--r--src/server/authserver/Authentication/TOTP.cpp95
-rw-r--r--src/server/authserver/Authentication/TOTP.h29
4 files changed, 0 insertions, 343 deletions
diff --git a/src/server/authserver/Authentication/AuthCodes.cpp b/src/server/authserver/Authentication/AuthCodes.cpp
deleted file mode 100644
index 44921f6a1cd..00000000000
--- a/src/server/authserver/Authentication/AuthCodes.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "AuthCodes.h"
-#include <cstddef>
-
-namespace AuthHelper
-{
- static RealmBuildInfo const PostBcAcceptedClientBuilds[] =
- {
- {15595, 4, 3, 4, ' '},
- {14545, 4, 2, 2, ' '},
- {13623, 4, 0, 6, 'a'},
- {13930, 3, 3, 5, 'a'}, // 3.3.5a China Mainland build
- {12340, 3, 3, 5, 'a'},
- {11723, 3, 3, 3, 'a'},
- {11403, 3, 3, 2, ' '},
- {11159, 3, 3, 0, 'a'},
- {10505, 3, 2, 2, 'a'},
- {9947, 3, 1, 3, ' '},
- {8606, 2, 4, 3, ' '},
- {0, 0, 0, 0, ' '} // terminator
- };
-
- static RealmBuildInfo const PreBcAcceptedClientBuilds[] =
- {
- {6141, 1, 12, 3, ' '},
- {6005, 1, 12, 2, ' '},
- {5875, 1, 12, 1, ' '},
- {0, 0, 0, 0, ' '} // terminator
- };
-
- bool IsPreBCAcceptedClientBuild(int build)
- {
- for (int i = 0; PreBcAcceptedClientBuilds[i].Build; ++i)
- if (PreBcAcceptedClientBuilds[i].Build == build)
- return true;
-
- return false;
- }
-
- bool IsPostBCAcceptedClientBuild(int build)
- {
- for (int i = 0; PostBcAcceptedClientBuilds[i].Build; ++i)
- if (PostBcAcceptedClientBuilds[i].Build == build)
- return true;
-
- return false;
- }
-
- bool IsAcceptedClientBuild(int build)
- {
- return (IsPostBCAcceptedClientBuild(build) || IsPreBCAcceptedClientBuild(build));
- }
-
- RealmBuildInfo const* GetBuildInfo(int build)
- {
- for (int i = 0; PostBcAcceptedClientBuilds[i].Build; ++i)
- if (PostBcAcceptedClientBuilds[i].Build == build)
- return &PostBcAcceptedClientBuilds[i];
-
- for (int i = 0; PreBcAcceptedClientBuilds[i].Build; ++i)
- if (PreBcAcceptedClientBuilds[i].Build == build)
- return &PreBcAcceptedClientBuilds[i];
-
- return NULL;
- }
-
- bool IsBuildSupportingBattlenet(int build)
- {
- return build >= 15595;
- }
-}
diff --git a/src/server/authserver/Authentication/AuthCodes.h b/src/server/authserver/Authentication/AuthCodes.h
deleted file mode 100644
index bc7f0c43f17..00000000000
--- a/src/server/authserver/Authentication/AuthCodes.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
- * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _AUTHCODES_H
-#define _AUTHCODES_H
-
-enum AuthResult
-{
- WOW_SUCCESS = 0x00,
- WOW_FAIL_BANNED = 0x03,
- WOW_FAIL_UNKNOWN_ACCOUNT = 0x04,
- WOW_FAIL_INCORRECT_PASSWORD = 0x05,
- WOW_FAIL_ALREADY_ONLINE = 0x06,
- WOW_FAIL_NO_TIME = 0x07,
- WOW_FAIL_DB_BUSY = 0x08,
- WOW_FAIL_VERSION_INVALID = 0x09,
- WOW_FAIL_VERSION_UPDATE = 0x0A,
- WOW_FAIL_INVALID_SERVER = 0x0B,
- WOW_FAIL_SUSPENDED = 0x0C,
- WOW_FAIL_FAIL_NOACCESS = 0x0D,
- WOW_SUCCESS_SURVEY = 0x0E,
- WOW_FAIL_PARENTCONTROL = 0x0F,
- WOW_FAIL_LOCKED_ENFORCED = 0x10,
- WOW_FAIL_TRIAL_ENDED = 0x11,
- WOW_FAIL_USE_BATTLENET = 0x12,
- WOW_FAIL_ANTI_INDULGENCE = 0x13,
- WOW_FAIL_EXPIRED = 0x14,
- WOW_FAIL_NO_GAME_ACCOUNT = 0x15,
- WOW_FAIL_CHARGEBACK = 0x16,
- WOW_FAIL_INTERNET_GAME_ROOM_WITHOUT_BNET = 0x17,
- WOW_FAIL_GAME_ACCOUNT_LOCKED = 0x18,
- WOW_FAIL_UNLOCKABLE_LOCK = 0x19,
- WOW_FAIL_CONVERSION_REQUIRED = 0x20,
- WOW_FAIL_DISCONNECTED = 0xFF
-};
-
-enum LoginResult
-{
- LOGIN_OK = 0x00,
- LOGIN_FAILED = 0x01,
- LOGIN_FAILED2 = 0x02,
- LOGIN_BANNED = 0x03,
- LOGIN_UNKNOWN_ACCOUNT = 0x04,
- LOGIN_UNKNOWN_ACCOUNT3 = 0x05,
- LOGIN_ALREADYONLINE = 0x06,
- LOGIN_NOTIME = 0x07,
- LOGIN_DBBUSY = 0x08,
- LOGIN_BADVERSION = 0x09,
- LOGIN_DOWNLOAD_FILE = 0x0A,
- LOGIN_FAILED3 = 0x0B,
- LOGIN_SUSPENDED = 0x0C,
- LOGIN_FAILED4 = 0x0D,
- LOGIN_CONNECTED = 0x0E,
- LOGIN_PARENTALCONTROL = 0x0F,
- LOGIN_LOCKED_ENFORCED = 0x10
-};
-
-enum GameAccountFlags
-{
- GAMEACCOUNT_FLAG_GM = 0x00000001,
- GAMEACCOUNT_FLAG_NOKICK = 0x00000002,
- GAMEACCOUNT_FLAG_COLLECTOR = 0x00000004,
- GAMEACCOUNT_FLAG_WOW_TRIAL = 0x00000008,
- GAMEACCOUNT_FLAG_CANCELLED = 0x00000010,
- GAMEACCOUNT_FLAG_IGR = 0x00000020,
- GAMEACCOUNT_FLAG_WHOLESALER = 0x00000040,
- GAMEACCOUNT_FLAG_PRIVILEGED = 0x00000080,
- GAMEACCOUNT_FLAG_EU_FORBID_ELV = 0x00000100,
- GAMEACCOUNT_FLAG_EU_FORBID_BILLING = 0x00000200,
- GAMEACCOUNT_FLAG_WOW_RESTRICTED = 0x00000400,
- GAMEACCOUNT_FLAG_REFERRAL = 0x00000800,
- GAMEACCOUNT_FLAG_BLIZZARD = 0x00001000,
- GAMEACCOUNT_FLAG_RECURRING_BILLING = 0x00002000,
- GAMEACCOUNT_FLAG_NOELECTUP = 0x00004000,
- GAMEACCOUNT_FLAG_KR_CERTIFICATE = 0x00008000,
- GAMEACCOUNT_FLAG_EXPANSION_COLLECTOR = 0x00010000,
- GAMEACCOUNT_FLAG_DISABLE_VOICE = 0x00020000,
- GAMEACCOUNT_FLAG_DISABLE_VOICE_SPEAK = 0x00040000,
- GAMEACCOUNT_FLAG_REFERRAL_RESURRECT = 0x00080000,
- GAMEACCOUNT_FLAG_EU_FORBID_CC = 0x00100000,
- GAMEACCOUNT_FLAG_OPENBETA_DELL = 0x00200000,
- GAMEACCOUNT_FLAG_PROPASS = 0x00400000,
- GAMEACCOUNT_FLAG_PROPASS_LOCK = 0x00800000,
- GAMEACCOUNT_FLAG_PENDING_UPGRADE = 0x01000000,
- GAMEACCOUNT_FLAG_RETAIL_FROM_TRIAL = 0x02000000,
- GAMEACCOUNT_FLAG_EXPANSION2_COLLECTOR = 0x04000000,
- GAMEACCOUNT_FLAG_OVERMIND_LINKED = 0x08000000,
- GAMEACCOUNT_FLAG_DEMOS = 0x10000000,
- GAMEACCOUNT_FLAG_DEATH_KNIGHT_OK = 0x20000000,
-};
-
-enum ExpansionFlags
-{
- POST_BC_EXP_FLAG = 0x2,
- PRE_BC_EXP_FLAG = 0x1,
- NO_VALID_EXP_FLAG = 0x0
-};
-
-struct RealmBuildInfo
-{
- int Build;
- int MajorVersion;
- int MinorVersion;
- int BugfixVersion;
- int HotfixVersion;
-};
-
-namespace AuthHelper
-{
- RealmBuildInfo const* GetBuildInfo(int build);
- bool IsAcceptedClientBuild(int build);
- bool IsPostBCAcceptedClientBuild(int build);
- bool IsPreBCAcceptedClientBuild(int build);
- bool IsBuildSupportingBattlenet(int build);
-}
-
-#endif
diff --git a/src/server/authserver/Authentication/TOTP.cpp b/src/server/authserver/Authentication/TOTP.cpp
deleted file mode 100644
index 01842cfe234..00000000000
--- a/src/server/authserver/Authentication/TOTP.cpp
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "TOTP.h"
-#include <cstring>
-
-int base32_decode(const char* encoded, char* result, int bufSize)
-{
- // Base32 implementation
- // Copyright 2010 Google Inc.
- // Author: Markus Gutschke
- // Licensed under the Apache License, Version 2.0
- int buffer = 0;
- int bitsLeft = 0;
- int count = 0;
- for (const char *ptr = encoded; count < bufSize && *ptr; ++ptr)
- {
- char ch = *ptr;
- if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n' || ch == '-')
- continue;
- buffer <<= 5;
-
- // Deal with commonly mistyped characters
- if (ch == '0')
- ch = 'O';
- else if (ch == '1')
- ch = 'L';
- else if (ch == '8')
- ch = 'B';
-
- // Look up one base32 digit
- if ((ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'))
- ch = (ch & 0x1F) - 1;
- else if (ch >= '2' && ch <= '7')
- ch -= '2' - 26;
- else
- return -1;
-
- buffer |= ch;
- bitsLeft += 5;
- if (bitsLeft >= 8)
- {
- result[count++] = buffer >> (bitsLeft - 8);
- bitsLeft -= 8;
- }
- }
-
- if (count < bufSize)
- result[count] = '\000';
- return count;
-}
-
-#define HMAC_RES_SIZE 20
-
-namespace TOTP
-{
- unsigned int GenerateToken(const char* b32key)
- {
- size_t keySize = strlen(b32key);
- int bufsize = (keySize + 7)/8*5;
- char* encoded = new char[bufsize];
- memset(encoded, 0, bufsize);
- unsigned int hmacResSize = HMAC_RES_SIZE;
- unsigned char hmacRes[HMAC_RES_SIZE];
- unsigned long timestamp = time(NULL)/30;
- unsigned char challenge[8];
-
- for (int i = 8; i--;timestamp >>= 8)
- challenge[i] = timestamp;
-
- base32_decode(b32key, encoded, bufsize);
- HMAC(EVP_sha1(), encoded, bufsize, challenge, 8, hmacRes, &hmacResSize);
- unsigned int offset = hmacRes[19] & 0xF;
- unsigned int truncHash = (hmacRes[offset] << 24) | (hmacRes[offset+1] << 16 )| (hmacRes[offset+2] << 8) | (hmacRes[offset+3]);
- truncHash &= 0x7FFFFFFF;
-
- delete[] encoded;
-
- return truncHash % 1000000;
- }
-}
diff --git a/src/server/authserver/Authentication/TOTP.h b/src/server/authserver/Authentication/TOTP.h
deleted file mode 100644
index 7ced260758c..00000000000
--- a/src/server/authserver/Authentication/TOTP.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef _TOTP_H
-#define _TOTP_H
-
-#include "openssl/hmac.h"
-#include "openssl/evp.h"
-
-namespace TOTP
-{
- unsigned int GenerateToken(const char* b32key);
-}
-
-#endif