Small fix for my previous commit

This commit is contained in:
tomrus88 2009-03-15 10:10:21 +03:00
parent 85d707ec74
commit e774fd3730
19 changed files with 151 additions and 755 deletions

View file

@ -1,163 +0,0 @@
/* ====================================================================
* Copyright (c) 2003 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* openssl-core@openssl.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <openssl/opensslconf.h>
#ifndef OPENSSL_FIPS
#error FIPS is disabled.
#endif
#ifdef OPENSSL_FIPS
#ifdef __cplusplus
extern "C" {
#endif
struct dsa_st;
struct evp_pkey_st;
struct env_md_st;
struct evp_cipher_st;
struct evp_cipher_ctx_st;
int FIPS_mode_set(int onoff);
int FIPS_mode(void);
const void *FIPS_rand_check(void);
int FIPS_selftest_failed(void);
void FIPS_selftest_check(void);
void FIPS_corrupt_sha1(void);
int FIPS_selftest_sha1(void);
void FIPS_corrupt_aes(void);
int FIPS_selftest_aes(void);
void FIPS_corrupt_des(void);
int FIPS_selftest_des(void);
void FIPS_corrupt_rsa(void);
void FIPS_corrupt_rsa_keygen(void);
int FIPS_selftest_rsa(void);
void FIPS_corrupt_dsa(void);
void FIPS_corrupt_dsa_keygen(void);
int FIPS_selftest_dsa(void);
void FIPS_corrupt_rng(void);
void FIPS_rng_stick(void);
int FIPS_selftest_rng(void);
int FIPS_selftest_hmac(void);
int fips_pkey_signature_test(struct evp_pkey_st *pkey,
const unsigned char *tbs, int tbslen,
const unsigned char *kat, unsigned int katlen,
const struct env_md_st *digest, unsigned int md_flags,
const char *fail_str);
int fips_cipher_test(struct evp_cipher_ctx_st *ctx,
const struct evp_cipher_st *cipher,
const unsigned char *key,
const unsigned char *iv,
const unsigned char *plaintext,
const unsigned char *ciphertext,
int len);
/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
* made after this point may be overwritten when the script is next run.
*/
void ERR_load_FIPS_strings(void);
/* Error codes for the FIPS functions. */
/* Function codes. */
#define FIPS_F_DH_BUILTIN_GENPARAMS 100
#define FIPS_F_DSA_BUILTIN_PARAMGEN 101
#define FIPS_F_DSA_DO_SIGN 102
#define FIPS_F_DSA_DO_VERIFY 103
#define FIPS_F_EVP_CIPHERINIT_EX 124
#define FIPS_F_EVP_DIGESTINIT_EX 125
#define FIPS_F_FIPS_CHECK_DSA 104
#define FIPS_F_FIPS_CHECK_INCORE_FINGERPRINT 105
#define FIPS_F_FIPS_CHECK_RSA 106
#define FIPS_F_FIPS_DSA_CHECK 107
#define FIPS_F_FIPS_MODE_SET 108
#define FIPS_F_FIPS_PKEY_SIGNATURE_TEST 109
#define FIPS_F_FIPS_SELFTEST_AES 110
#define FIPS_F_FIPS_SELFTEST_DES 111
#define FIPS_F_FIPS_SELFTEST_DSA 112
#define FIPS_F_FIPS_SELFTEST_HMAC 113
#define FIPS_F_FIPS_SELFTEST_RNG 114
#define FIPS_F_FIPS_SELFTEST_SHA1 115
#define FIPS_F_HASH_FINAL 123
#define FIPS_F_RSA_BUILTIN_KEYGEN 116
#define FIPS_F_RSA_EAY_PRIVATE_DECRYPT 117
#define FIPS_F_RSA_EAY_PRIVATE_ENCRYPT 118
#define FIPS_F_RSA_EAY_PUBLIC_DECRYPT 119
#define FIPS_F_RSA_EAY_PUBLIC_ENCRYPT 120
#define FIPS_F_RSA_X931_GENERATE_KEY_EX 121
#define FIPS_F_SSLEAY_RAND_BYTES 122
/* Reason codes. */
#define FIPS_R_CANNOT_READ_EXE 103
#define FIPS_R_CANNOT_READ_EXE_DIGEST 104
#define FIPS_R_CONTRADICTING_EVIDENCE 114
#define FIPS_R_EXE_DIGEST_DOES_NOT_MATCH 105
#define FIPS_R_FINGERPRINT_DOES_NOT_MATCH 110
#define FIPS_R_FINGERPRINT_DOES_NOT_MATCH_NONPIC_RELOCATED 111
#define FIPS_R_FINGERPRINT_DOES_NOT_MATCH_SEGMENT_ALIASING 112
#define FIPS_R_FIPS_MODE_ALREADY_SET 102
#define FIPS_R_FIPS_SELFTEST_FAILED 106
#define FIPS_R_INVALID_KEY_LENGTH 109
#define FIPS_R_KEY_TOO_SHORT 108
#define FIPS_R_NON_FIPS_METHOD 100
#define FIPS_R_PAIRWISE_TEST_FAILED 107
#define FIPS_R_RSA_DECRYPT_ERROR 115
#define FIPS_R_RSA_ENCRYPT_ERROR 116
#define FIPS_R_SELFTEST_FAILED 101
#define FIPS_R_TEST_FAILURE 117
#define FIPS_R_UNSUPPORTED_PLATFORM 113
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,77 +0,0 @@
/* ====================================================================
* Copyright (c) 2003 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* openssl-core@openssl.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef HEADER_FIPS_RAND_H
#define HEADER_FIPS_RAND_H
#include "des.h"
#ifdef OPENSSL_FIPS
#ifdef __cplusplus
extern "C" {
#endif
int FIPS_rand_set_key(const unsigned char *key, FIPS_RAND_SIZE_T keylen);
int FIPS_rand_seed(const void *buf, FIPS_RAND_SIZE_T num);
int FIPS_rand_bytes(unsigned char *out, FIPS_RAND_SIZE_T outlen);
int FIPS_rand_test_mode(void);
void FIPS_rand_reset(void);
int FIPS_rand_set_dt(unsigned char *dt);
int FIPS_rand_status(void);
const RAND_METHOD *FIPS_rand_method(void);
#ifdef __cplusplus
}
#endif
#endif
#endif

View file

@ -1,96 +0,0 @@
/* crypto/mdc2/mdc2.h */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
#ifndef HEADER_MDC2_H
#define HEADER_MDC2_H
#include <openssl/des.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef OPENSSL_NO_MDC2
#error MDC2 is disabled.
#endif
#define MDC2_BLOCK 8
#define MDC2_DIGEST_LENGTH 16
typedef struct mdc2_ctx_st
{
int num;
unsigned char data[MDC2_BLOCK];
DES_cblock h,hh;
int pad_type; /* either 1 or 2, default 1 */
} MDC2_CTX;
int MDC2_Init(MDC2_CTX *c);
int MDC2_Update(MDC2_CTX *c, const unsigned char *data, unsigned long len);
int MDC2_Final(unsigned char *md, MDC2_CTX *c);
unsigned char *MDC2(const unsigned char *d, unsigned long n,
unsigned char *md);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -2,6 +2,9 @@
/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
/* OpenSSL was configured with the following options: */
#ifndef OPENSSL_SYSNAME_WIN32
# define OPENSSL_SYSNAME_WIN32
#endif
#ifndef OPENSSL_DOING_MAKEDEPEND
@ -38,8 +41,8 @@
#endif /* OPENSSL_DOING_MAKEDEPEND */
#ifndef OPENSSL_NO_DYNAMIC_ENGINE
# define OPENSSL_NO_DYNAMIC_ENGINE
#ifndef OPENSSL_THREADS
# define OPENSSL_THREADS
#endif
/* The OPENSSL_NO_* macros are also defined as NO_* if the application
@ -101,8 +104,8 @@
#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
#define ENGINESDIR "/usr/local/ssl/lib/engines"
#define OPENSSLDIR "/usr/local/ssl"
#define ENGINESDIR "G:\openssl_build/lib/engines"
#define OPENSSLDIR "G:\openssl_build/ssl"
#endif
#endif
@ -110,6 +113,7 @@
#define OPENSSL_UNISTD <unistd.h>
#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
#define OPENSSL_EXPORT_VAR_AS_FUNCTION
#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
#define IDEA_INT unsigned int
@ -154,7 +158,7 @@
#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
#define CONFIG_HEADER_BN_H
#undef BN_LLONG
#define BN_LLONG
/* Should we define BN_DIV2W here? */
@ -173,7 +177,7 @@
#define CONFIG_HEADER_RC4_LOCL_H
/* if this is defined data[i] is used instead of *data, this is a %20
* speedup on x86 */
#undef RC4_INDEX
#define RC4_INDEX
#endif
#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)

View file

@ -1,121 +0,0 @@
/* crypto/rc5/rc5.h */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
#ifndef HEADER_RC5_H
#define HEADER_RC5_H
#include <openssl/opensslconf.h> /* OPENSSL_NO_RC5 */
#ifdef __cplusplus
extern "C" {
#endif
#ifdef OPENSSL_NO_RC5
#error RC5 is disabled.
#endif
#define RC5_ENCRYPT 1
#define RC5_DECRYPT 0
/* 32 bit. For Alpha, things may get weird */
#define RC5_32_INT unsigned long
#define RC5_32_BLOCK 8
#define RC5_32_KEY_LENGTH 16 /* This is a default, max is 255 */
/* This are the only values supported. Tweak the code if you want more
* The most supported modes will be
* RC5-32/12/16
* RC5-32/16/8
*/
#define RC5_8_ROUNDS 8
#define RC5_12_ROUNDS 12
#define RC5_16_ROUNDS 16
typedef struct rc5_key_st
{
/* Number of rounds */
int rounds;
RC5_32_INT data[2*(RC5_16_ROUNDS+1)];
} RC5_32_KEY;
#ifdef OPENSSL_FIPS
void private_RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
int rounds);
#endif
void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
int rounds);
void RC5_32_ecb_encrypt(const unsigned char *in,unsigned char *out,RC5_32_KEY *key,
int enc);
void RC5_32_encrypt(unsigned long *data,RC5_32_KEY *key);
void RC5_32_decrypt(unsigned long *data,RC5_32_KEY *key);
void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out,
long length, RC5_32_KEY *ks, unsigned char *iv,
int enc);
void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out,
long length, RC5_32_KEY *schedule,
unsigned char *ivec, int *num, int enc);
void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out,
long length, RC5_32_KEY *schedule,
unsigned char *ivec, int *num);
#ifdef __cplusplus
}
#endif
#endif

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,229 +0,0 @@
/*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "AddonHandler.h"
#include "Database/DatabaseEnv.h"
#include "Opcodes.h"
#include "Log.h"
#include "Policies/SingletonImp.h"
#include "zlib/zlib.h"
INSTANTIATE_SINGLETON_1( AddonHandler );
AddonHandler::AddonHandler()
{
}
AddonHandler::~AddonHandler()
{
}
bool AddonHandler::BuildAddonPacket(WorldPacket *Source, WorldPacket *Target)
{
ByteBuffer AddOnPacked;
uLongf AddonRealSize;
uint32 CurrentPosition;
uint32 TempValue;
unsigned char tdata[256] =
{
0xC3, 0x5B, 0x50, 0x84, 0xB9, 0x3E, 0x32, 0x42, 0x8C, 0xD0, 0xC7, 0x48, 0xFA, 0x0E, 0x5D, 0x54,
0x5A, 0xA3, 0x0E, 0x14, 0xBA, 0x9E, 0x0D, 0xB9, 0x5D, 0x8B, 0xEE, 0xB6, 0x84, 0x93, 0x45, 0x75,
0xFF, 0x31, 0xF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0x10, 0x6F, 0xF3, 0xF5, 0xE0, 0xA6,
0xC3, 0xFB, 0x1B, 0x8C, 0x29, 0xEF, 0x8E, 0xE5, 0x34, 0xCB, 0xD1, 0x2A, 0xCE, 0x79, 0xC3, 0x9A,
0x0D, 0x36, 0xEA, 0x01, 0xE0, 0xAA, 0x91, 0x20, 0x54, 0xF0, 0x72, 0xD8, 0x1E, 0xC7, 0x89, 0xD2
};
// broken addon packet, can't be received from real client
if (Source->rpos() + 4 > Source->size())
return false;
*Source >> TempValue; // get real size of the packed structure
// empty addon packet, nothing process, can't be received from real client
if(!TempValue)
return false;
AddonRealSize = TempValue; // temp value because ZLIB only excepts uLongf
CurrentPosition = Source->rpos(); // get the position of the pointer in the structure
AddOnPacked.resize(AddonRealSize); // resize target for zlib action
if (!uncompress(const_cast<uint8*>(AddOnPacked.contents()), &AddonRealSize, const_cast<uint8*>((*Source).contents() + CurrentPosition), (*Source).size() - CurrentPosition)!= Z_OK)
{
Target->Initialize(SMSG_ADDON_INFO);
uint32 addonsCount;
AddOnPacked >> addonsCount; // addons count?
for(uint32 i = 0; i < addonsCount; ++i)
{
std::string addonName;
uint8 enabled;
uint32 crc, unk2;
// check next addon data format correctness
if(AddOnPacked.rpos()+1 > AddOnPacked.size())
return false;
AddOnPacked >> addonName;
// recheck next addon data format correctness
if(AddOnPacked.rpos()+1+4+4 > AddOnPacked.size())
return false;
AddOnPacked >> enabled >> crc >> unk2;
sLog.outDebug("ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk2);
uint8 state = (enabled ? 2 : 1);
*Target << uint8(state);
uint8 unk1 = (enabled ? 1 : 0);
*Target << uint8(unk1);
if (unk1)
{
uint8 unk2 = (crc != 0x4c1c776d); // If addon is Standard addon CRC
*Target << uint8(unk2);
if (unk2)
Target->append(tdata, sizeof(tdata));
*Target << uint32(0);
}
uint8 unk3 = (enabled ? 0 : 1);
*Target << uint8(unk3);
if (unk3)
{
// String, 256 (null terminated?)
*Target << uint8(0);
}
}
uint32 unk4;
AddOnPacked >> unk4;
uint32 count = 0;
*Target << uint32(count);
/*for(uint32 i = 0; i < count; ++i)
{
uint32
string (16 bytes)
string (16 bytes)
uint32
}*/
if(AddOnPacked.rpos() != AddOnPacked.size())
sLog.outDebug("packet under read!");
}
else
{
sLog.outError("Addon packet uncompress error :(");
return false;
}
return true;
}
/* Code use in 1.10.2 when client not ignore ban state sended for addons. Saved for reference if client switch to use server ban state information
void AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target, uint32 Packetoffset)
{
ByteBuffer AddOnPacked;
uLongf AddonRealSize;
uint32 CurrentPosition;
uint32 TempValue;
*Source >> TempValue; //get real size of the packed structure
AddonRealSize = TempValue; //temp value becouse ZLIB only excepts uLongf
CurrentPosition = Source->rpos(); //get the position of the pointer in the structure
AddOnPacked.resize(AddonRealSize); //resize target for zlib action
if (!uncompress((uint8*)AddOnPacked.contents(), &AddonRealSize, (uint8*)(*Source).contents() + CurrentPosition, (*Source).size() - CurrentPosition)!= Z_OK)
{
bool* AddonAllowed = new bool; //handle addon check and enable-ing
uint32 Unknown1;
uint8 Unknown0;
AddOnPacked >> Unknown0;
AddOnPacked >> Unknown1;
Target->Initialize(SMSG_ADDON_INFO);
uint32 i = 5; //offset for addon extraction
while(i != AddOnPacked.size())
{
std::string AddonNames;
AddOns* Addonstr = new AddOns;
uint8 unk6;
uint64 CRCCHECK;
AddOnPacked >> AddonNames >> CRCCHECK >> unk6;
//sLog.outDebug("ADDON: Name:%s CRC:%x Unknown:%x",AddonNames.c_str(), CRCCHECK,unk6);
Addonstr->Name = AddonNames;
Addonstr->CRC = CRCCHECK;
//if not allowed but unknown added to list
if (GetAddonStatus(Addonstr, AddonAllowed)) // If addon is new
{
Addonstr->Enabled = m_Addon_Default; // by default new addons are set from Config file
*AddonAllowed = m_Addon_Default; // Set addon allowed on default value
_AddAddon(Addonstr);
sLog.outDetail("Found new Addon, Name:%s CRC:%x Unknown:%x",AddonNames.c_str(), CRCCHECK, unk6);
}
if (CRCCHECK == 0x4C1C776D01LL) //If addon is Standard addon CRC
{
//value's standard Addons
*Target << uint8(0) << uint8(2) << uint8(1) << uint8(0) << uint32(0);
}
else if (*AddonAllowed) //if addon is Custom addons
//value's enable addon
*Target << uint8(0x00) << uint8(0x01) << uint8(0x00) << uint8(0x01);
else
//value's disable addom
*Target << uint8(0x00) << uint8(0x0) << uint8(0x00) << uint8(0x0);
i += AddonNames.size() + 10;
}
*Target << uint8(0x0);
//delete mem allocation
delete AddonAllowed;
}
else
{
//handle uncompress error
}
}
*/

View file

@ -1,37 +0,0 @@
/*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __ADDONHANDLER_H
#define __ADDONHANDLER_H
#include "Common.h"
#include "Policies/Singleton.h"
#include "WorldPacket.h"
#include "Config/ConfigEnv.h"
class AddonHandler
{
public:
/* Construction */
AddonHandler();
~AddonHandler();
//built addon packet
bool BuildAddonPacket(WorldPacket* Source, WorldPacket* Target);
};
#define sAddOnHandler MaNGOS::Singleton<AddonHandler>::Instance()
#endif

View file

@ -32,8 +32,6 @@ libmangosgame_a_SOURCES = \
AccountMgr.h \
AchievementMgr.h \
AchievementMgr.cpp \
AddonHandler.cpp \
AddonHandler.h \
AggressorAI.cpp \
AggressorAI.h \
AnimalRandomMovementGenerator.h \

View file

@ -252,6 +252,7 @@ World::AddSession_ (WorldSession* s)
packet << uint8 (s->Expansion()); // 0 - normal, 1 - TBC, must be set in database manually for each account
s->SendPacket (&packet);
s->SendAddonsInfo();
UpdateMaxSessionCounters ();
// Updates the population

View file

@ -35,6 +35,7 @@
#include "ObjectAccessor.h"
#include "BattleGroundMgr.h"
#include "SocialMgr.h"
#include "zlib/zlib.h"
/// WorldSession constructor
WorldSession::WorldSession(uint32 id, WorldSocket *sock, uint32 sec, uint8 expansion, time_t mute_time, LocaleConstant locale) :
@ -609,3 +610,121 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo *mi)
data >> mi->u_unk1;
}
}
void WorldSession::ReadAddonsInfo(WorldPacket &data)
{
uint32 size;
data >> size;
if(!size)
return;
uLongf uSize = size;
uint32 pos = data.rpos();
ByteBuffer addonInfo;
addonInfo.resize(size);
if (uncompress(const_cast<uint8*>(addonInfo.contents()), &uSize, const_cast<uint8*>(data.contents() + pos), data.size() - pos) == Z_OK)
{
uint32 addonsCount;
addonInfo >> addonsCount; // addons count
for(uint32 i = 0; i < addonsCount; ++i)
{
std::string addonName;
uint8 enabled;
uint32 crc, unk1;
// check next addon data format correctness
if(addonInfo.rpos()+1 > addonInfo.size())
return;
addonInfo >> addonName;
// recheck next addon data format correctness
if(addonInfo.rpos()+1+4+4 > addonInfo.size())
return;
addonInfo >> enabled >> crc >> unk1;
sLog.outDebug("ADDON: Name: %s, Enabled: 0x%x, CRC: 0x%x, Unknown2: 0x%x", addonName.c_str(), enabled, crc, unk1);
m_addonsList.push_back(AddonInfo(addonName, enabled, crc));
}
uint32 unk2;
addonInfo >> unk2;
if(addonInfo.rpos() != addonInfo.size())
sLog.outDebug("packet under read!");
}
else
sLog.outError("Addon packet uncompress error!");
}
void WorldSession::SendAddonsInfo()
{
unsigned char tdata[256] =
{
0xC3, 0x5B, 0x50, 0x84, 0xB9, 0x3E, 0x32, 0x42, 0x8C, 0xD0, 0xC7, 0x48, 0xFA, 0x0E, 0x5D, 0x54,
0x5A, 0xA3, 0x0E, 0x14, 0xBA, 0x9E, 0x0D, 0xB9, 0x5D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x45, 0x6E, 0xD5, 0x64, 0x79, 0x0F, 0x17, 0xFC, 0x64, 0xDD, 0x10, 0x6F, 0xF3, 0xF5, 0xE0, 0xA6,
0xC3, 0xFB, 0x1B, 0x8C, 0x29, 0xEF, 0x8E, 0xE5, 0x34, 0xCB, 0xD1, 0x2A, 0xCE, 0x79, 0xC3, 0x9A,
0x0D, 0x36, 0xEA, 0x01, 0xE0, 0xAA, 0x91, 0x20, 0x54, 0xF0, 0x72, 0xD8, 0x1E, 0xC7, 0x89, 0xD2
};
WorldPacket data(SMSG_ADDON_INFO, 4);
for(AddonsList::iterator itr = m_addonsList.begin(); itr != m_addonsList.end(); ++itr)
{
uint8 state = (itr->Enabled ? 2 : 1);
data << uint8(state);
uint8 unk1 = (itr->Enabled ? 1 : 0);
data << uint8(unk1);
if (unk1)
{
uint8 unk2 = (itr->CRC != 0x4c1c776d); // If addon is Standard addon CRC
data << uint8(unk2);
if (unk2)
data.append(tdata, sizeof(tdata));
data << uint32(0);
}
uint8 unk3 = (itr->Enabled ? 0 : 1);
data << uint8(unk3);
if (unk3)
{
// String, 256 (null terminated?)
data << uint8(0);
}
}
m_addonsList.clear();
uint32 count = 0;
data << uint32(count);
/*for(uint32 i = 0; i < count; ++i)
{
uint32
string (16 bytes)
string (16 bytes)
uint32
}*/
SendPacket(&data);
}

View file

@ -56,6 +56,22 @@ struct AccountData
std::string Data;
};
struct AddonInfo
{
AddonInfo(std::string name, uint8 enabled, uint32 crc)
{
Name = name;
Enabled = enabled;
CRC = crc;
}
std::string Name;
uint8 Enabled;
uint32 CRC;
};
typedef std::list<AddonInfo> AddonsList;
enum PartyOperation
{
PARTY_OP_INVITE = 0,
@ -90,6 +106,9 @@ class MANGOS_DLL_SPEC WorldSession
void SizeError(WorldPacket const& packet, uint32 size) const;
void ReadAddonsInfo(WorldPacket &data);
void SendAddonsInfo();
void ReadMovementInfo(WorldPacket &data, MovementInfo *mi);
void SendPacket(WorldPacket const* packet);
@ -693,6 +712,7 @@ class MANGOS_DLL_SPEC WorldSession
int m_sessionDbLocaleIndex;
uint32 m_latency;
AccountData m_accountData[NUM_ACCOUNT_DATA_TYPES];
AddonsList m_addonsList;
ZThread::LockedQueue<WorldPacket*,ZThread::FastMutex> _recvQueue;
};

View file

@ -986,6 +986,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
m_Crypt.Init ();
m_Session->LoadAccountData();
m_Session->ReadAddonsInfo(recvPacket);
// In case needed sometime the second arg is in microseconds 1 000 000 = 1 sec
ACE_OS::sleep (ACE_Time_Value (0, 10000));

View file

@ -137,17 +137,9 @@
</File>
<File
RelativePath="..\..\src\game\AchievementMgr.cpp">
</File>
<File
RelativePath="..\..\src\game\AchievementMgr.h">
</File>
<File
RelativePath="..\..\src\game\AddonHandler.cpp">
</File>
<File
RelativePath="..\..\src\game\AddonHandler.h">
</File>
<File
RelativePath="..\..\src\game\ArenaTeamHandler.cpp">

View file

@ -362,14 +362,6 @@
RelativePath="..\..\src\game\AchievementMgr.h"
>
</File>
<File
RelativePath="..\..\src\game\AddonHandler.cpp"
>
</File>
<File
RelativePath="..\..\src\game\AddonHandler.h"
>
</File>
<File
RelativePath="..\..\src\game\ArenaTeamHandler.cpp"
>

View file

@ -364,14 +364,6 @@
RelativePath="..\..\src\game\AchievementMgr.h"
>
</File>
<File
RelativePath="..\..\src\game\AddonHandler.cpp"
>
</File>
<File
RelativePath="..\..\src\game\AddonHandler.h"
>
</File>
<File
RelativePath="..\..\src\game\ArenaTeamHandler.cpp"
>