Commit 63da222a authored by unknown's avatar unknown

Merge pnousiainen@bk-internal.mysql.com:/home/bk/mysql-5.0

into  mysql.com:/space/pekka/ndb/version/my50

parents 3109dcdf 6257ab54
......@@ -2785,14 +2785,13 @@ static my_bool dump_all_views_in_db(char *database)
different case (e.g. T1 vs t1)
RETURN
int - 0 if a tablename was retrieved. 1 if not
pointer to the table name
0 if error
*/
static int get_actual_table_name(const char *old_table_name,
char *new_table_name,
int buf_size)
static char *get_actual_table_name(const char *old_table_name, MEM_ROOT *root)
{
int retval;
char *name= 0;
MYSQL_RES *table_res;
MYSQL_ROW row;
char query[50 + 2*NAME_LEN];
......@@ -2809,66 +2808,55 @@ static int get_actual_table_name(const char *old_table_name,
safe_exit(EX_MYSQLERR);
}
retval = 1;
if ((table_res= mysql_store_result(sock)))
{
my_ulonglong num_rows= mysql_num_rows(table_res);
if (num_rows > 0)
{
ulong *lengths;
/*
Return first row
TODO: Return all matching rows
*/
row= mysql_fetch_row(table_res);
strmake(new_table_name, row[0], buf_size-1);
retval= 0;
lengths= mysql_fetch_lengths(table_res);
name= strmake_root(root, row[0], lengths[0]);
}
mysql_free_result(table_res);
}
return retval;
DBUG_PRINT("exit", ("new_table_name: %s", name));
DBUG_RETURN(name);
}
static int dump_selected_tables(char *db, char **table_names, int tables)
{
uint i;
char table_buff[NAME_LEN*+3];
char new_table_name[NAME_LEN];
DYNAMIC_STRING lock_tables_query;
HASH dump_tables;
char *table_name;
MEM_ROOT root;
char **dump_tables, **pos, **end;
DBUG_ENTER("dump_selected_tables");
if (init_dumping(db))
return 1;
/* Init hash table for storing the actual name of tables to dump */
if (hash_init(&dump_tables, charset_info, 16, 0, 0,
(hash_get_key) get_table_key, (hash_free_key) free_table_ent,
0))
exit(EX_EOM);
init_alloc_root(&root, 8192, 0);
if (!(dump_tables= pos= (char**) alloc_root(&root, tables * sizeof(char *))))
exit(EX_EOM);
init_dynamic_string(&lock_tables_query, "LOCK TABLES ", 256, 1024);
for (; tables > 0 ; tables-- , table_names++)
{
/* the table name passed on commandline may be wrong case */
if (!get_actual_table_name(*table_names,
new_table_name, sizeof(new_table_name)))
if ((*pos= get_actual_table_name(*table_names, &root)))
{
/* Add found table name to lock_tables_query */
if (lock_tables)
{
dynstr_append(&lock_tables_query,
quote_name(new_table_name, table_buff, 1));
dynstr_append(&lock_tables_query, quote_name(*pos, table_buff, 1));
dynstr_append(&lock_tables_query, " READ /*!32311 LOCAL */,");
}
/* Add found table name to dump_tables list */
if (my_hash_insert(&dump_tables,
(byte*)my_strdup(new_table_name, MYF(0))))
exit(EX_EOM);
pos++;
}
else
{
......@@ -2878,6 +2866,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
/* We shall countinue here, if --force was given */
}
}
end= pos;
if (lock_tables)
{
......@@ -2897,24 +2886,20 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
print_xml_tag1(md_result_file, "", "database name=", db, "\n");
/* Dump each selected table */
for (i= 0; i < dump_tables.records; i++)
for (pos= dump_tables; pos < end; pos++)
{
table_name= hash_element(&dump_tables, i);
DBUG_PRINT("info",("Dumping table %s", table_name));
dump_table(table_name,db);
DBUG_PRINT("info",("Dumping table %s", *pos));
dump_table(*pos, db);
if (opt_dump_triggers &&
mysql_get_server_version(sock) >= 50009)
dump_triggers_for_table(table_name, db);
dump_triggers_for_table(*pos, db);
}
/* Dump each selected view */
if (was_views)
{
for(i=0; i < dump_tables.records; i++)
{
table_name= hash_element(&dump_tables, i);
get_view_structure(table_name, db);
}
for (pos= dump_tables; pos < end; pos++)
get_view_structure(*pos, db);
}
/* obtain dump of routines (procs/functions) */
if (opt_routines && !opt_xml &&
......@@ -2923,7 +2908,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
DBUG_PRINT("info", ("Dumping routines for database %s", db));
dump_routines_for_db(db);
}
hash_free(&dump_tables);
free_root(&root, MYF(0));
my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
order_by= 0;
if (opt_xml)
......
......@@ -65,7 +65,8 @@ THREAD_RETURN YASSL_API echoserver_test(void* args)
while (!shutdown) {
sockaddr_in client;
socklen_t client_len = sizeof(client);
int clientfd = accept(sockfd, (sockaddr*)&client, &client_len);
int clientfd = accept(sockfd, (sockaddr*)&client,
(ACCEPT_THIRD_T)&client_len);
if (clientfd == -1) err_sys("tcp accept failed");
SSL* ssl = SSL_new(ctx);
......
......@@ -273,6 +273,7 @@ int SSL_pending(SSL*);
enum { /* ssl Constants */
SSL_WOULD_BLOCK = -8,
SSL_BAD_STAT = -7,
SSL_BAD_PATH = -6,
SSL_BAD_FILETYPE = -5,
......@@ -494,7 +495,7 @@ ASN1_TIME* X509_get_notAfter(X509* x);
typedef struct MD4_CTX {
void* ptr;
int buffer[32]; /* big enough to hold, check size in Init */
} MD4_CTX;
void MD4_Init(MD4_CTX*);
......
......@@ -66,6 +66,7 @@ typedef unsigned char byte;
// Wraps Windows Sockets and BSD Sockets
class Socket {
socket_t socket_; // underlying socket descriptor
bool wouldBlock_; // for non-blocking data
public:
explicit Socket(socket_t s = INVALID_SOCKET);
~Socket();
......@@ -75,9 +76,10 @@ public:
socket_t get_fd() const;
uint send(const byte* buf, unsigned int len, int flags = 0) const;
uint receive(byte* buf, unsigned int len, int flags = 0) const;
uint receive(byte* buf, unsigned int len, int flags = 0);
bool wait() const;
bool wait();
bool WouldBlock() const;
void closeSocket();
void shutDown(int how = SD_SEND);
......
......@@ -26,7 +26,6 @@
#ifndef yaSSL_ERROR_HPP
#define yaSSL_ERROR_HPP
#include "stdexcept.hpp"
namespace yaSSL {
......@@ -63,7 +62,7 @@ enum { MAX_ERROR_SZ = 80 };
void SetErrorString(YasslError, char*);
/* remove for now, if go back to exceptions use this wrapper
// Base class for all yaSSL exceptions
class Error : public mySTL::runtime_error {
YasslError error_;
......@@ -75,6 +74,7 @@ public:
YasslError get_number() const;
Library get_lib() const;
};
*/
} // naemspace
......
......@@ -656,7 +656,7 @@ mySTL::auto_ptr<input_buffer>
DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered)
{
// wait for input if blocking
if (!ssl.getSocket().wait()) {
if (!ssl.useSocket().wait()) {
ssl.SetError(receive_error);
buffered.reset(0);
return buffered;
......@@ -673,7 +673,7 @@ DoProcessReply(SSL& ssl, mySTL::auto_ptr<input_buffer> buffered)
}
// add new data
uint read = ssl.getSocket().receive(buffer.get_buffer() + buffSz, ready);
uint read = ssl.useSocket().receive(buffer.get_buffer() + buffSz, ready);
buffer.add_size(read);
uint offset = 0;
const MessageFactory& mf = ssl.getFactory().getMessage();
......@@ -858,6 +858,9 @@ void sendFinished(SSL& ssl, ConnectionEnd side, BufferOutput buffer)
// send data
int sendData(SSL& ssl, const void* buffer, int sz)
{
if (ssl.GetError() == YasslError(SSL_ERROR_WANT_READ))
ssl.SetError(no_error);
ssl.verfiyHandShakeComplete();
if (ssl.GetError()) return 0;
int sent = 0;
......@@ -893,6 +896,9 @@ int sendAlert(SSL& ssl, const Alert& alert)
// process input data
int receiveData(SSL& ssl, Data& data)
{
if (ssl.GetError() == YasslError(SSL_ERROR_WANT_READ))
ssl.SetError(no_error);
ssl.verfiyHandShakeComplete();
if (ssl.GetError()) return 0;
......@@ -902,6 +908,11 @@ int receiveData(SSL& ssl, Data& data)
ssl.useLog().ShowData(data.get_length());
if (ssl.GetError()) return 0;
if (data.get_length() == 0 && ssl.getSocket().WouldBlock()) {
ssl.SetError(YasslError(SSL_ERROR_WANT_READ));
return SSL_WOULD_BLOCK;
}
return data.get_length();
}
......
......@@ -58,7 +58,7 @@ namespace yaSSL {
Socket::Socket(socket_t s)
: socket_(s)
: socket_(s), wouldBlock_(false)
{}
......@@ -123,17 +123,21 @@ uint Socket::send(const byte* buf, unsigned int sz, int flags) const
}
uint Socket::receive(byte* buf, unsigned int sz, int flags) const
uint Socket::receive(byte* buf, unsigned int sz, int flags)
{
assert(socket_ != INVALID_SOCKET);
wouldBlock_ = false;
int recvd = ::recv(socket_, reinterpret_cast<char *>(buf), sz, flags);
// idea to seperate error from would block by arnetheduck@gmail.com
if (recvd == -1) {
if (get_lastError() == SOCKET_EWOULDBLOCK ||
get_lastError() == SOCKET_EAGAIN)
get_lastError() == SOCKET_EAGAIN) {
wouldBlock_ = true;
return 0;
}
}
else if (recvd == 0)
return static_cast<uint>(-1);
......@@ -142,7 +146,7 @@ uint Socket::receive(byte* buf, unsigned int sz, int flags) const
// wait if blocking for input, return false for error
bool Socket::wait() const
bool Socket::wait()
{
byte b;
return receive(&b, 1, MSG_PEEK) != static_cast<uint>(-1);
......@@ -166,6 +170,12 @@ int Socket::get_lastError()
}
bool Socket::WouldBlock() const
{
return wouldBlock_;
}
void Socket::set_lastError(int errorCode)
{
#ifdef _WIN32
......
......@@ -37,6 +37,7 @@
#include "handshake.hpp"
#include "yassl_int.hpp"
#include "md5.hpp" // for TaoCrypt MD5 size assert
#include "md4.hpp" // for TaoCrypt MD4 size assert
#include <stdio.h>
#ifdef _WIN32
......@@ -1131,17 +1132,26 @@ void* X509_get_ext_d2i(X509* x, int nid, int* crit, int* idx)
void MD4_Init(MD4_CTX* md4)
{
assert(0); // not yet supported, build compat. only
// make sure we have a big enough buffer
typedef char ok[sizeof(md4->buffer) >= sizeof(TaoCrypt::MD4) ? 1 : -1];
(void) sizeof(ok);
// using TaoCrypt since no dynamic memory allocated
// and no destructor will be called
new (reinterpret_cast<yassl_pointer>(md4->buffer)) TaoCrypt::MD4();
}
void MD4_Update(MD4_CTX* md4, const void* data, unsigned long sz)
{
reinterpret_cast<TaoCrypt::MD4*>(md4->buffer)->Update(
static_cast<const byte*>(data), static_cast<unsigned int>(sz));
}
void MD4_Final(unsigned char* hash, MD4_CTX* md4)
{
reinterpret_cast<TaoCrypt::MD4*>(md4->buffer)->Final(hash);
}
......
......@@ -31,6 +31,7 @@
#include "hmac.hpp"
#include "md5.hpp"
#include "sha.hpp"
#include "ripemd.hpp"
#include "openssl/ssl.h"
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
......
......@@ -26,13 +26,17 @@
#include "runtime.hpp"
#include "timer.hpp"
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else
#include <sys/time.h>
#endif
namespace yaSSL {
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
timer_d timer()
{
static bool init(false);
......@@ -57,8 +61,6 @@ namespace yaSSL {
#else // _WIN32
#include <sys/time.h>
timer_d timer()
{
struct timeval tv;
......
......@@ -26,10 +26,13 @@
#include "runtime.hpp"
#include "yassl_error.hpp"
#include "error.hpp" // TaoCrypt error numbers
#include "openssl/ssl.h" // SSL_ERROR_WANT_READ
#include <string.h> // strncpy
namespace yaSSL {
/* may bring back in future
Error::Error(const char* s, YasslError e, Library l)
: mySTL::runtime_error(s), error_(e), lib_(l)
{
......@@ -47,6 +50,7 @@ Library Error::get_lib() const
return lib_;
}
*/
void SetErrorString(YasslError error, char* buffer)
......@@ -117,6 +121,11 @@ void SetErrorString(YasslError error, char* buffer)
strncpy(buffer, "unable to proccess cerificate", max);
break;
// openssl errors
case SSL_ERROR_WANT_READ :
strncpy(buffer, "the read operation would block", max);
break;
// TaoCrypt errors
case NO_ERROR :
strncpy(buffer, "not in error state", max);
......
......@@ -1415,15 +1415,6 @@ BulkCipher* CryptProvider::NewDesEde()
}
extern "C" void yaSSL_CleanUp()
{
TaoCrypt::CleanUp();
ysDelete(cryptProviderInstance);
ysDelete(sslFactoryInstance);
ysDelete(sessionsInstance);
}
typedef Mutex::Lock Lock;
......@@ -2109,9 +2100,23 @@ ASN1_STRING* StringHolder::GetString()
}
} // namespace
extern "C" void yaSSL_CleanUp()
{
TaoCrypt::CleanUp();
yaSSL::ysDelete(yaSSL::cryptProviderInstance);
yaSSL::ysDelete(yaSSL::sslFactoryInstance);
yaSSL::ysDelete(yaSSL::sessionsInstance);
// In case user calls more than once, prevent seg fault
yaSSL::cryptProviderInstance = 0;
yaSSL::sslFactoryInstance = 0;
yaSSL::sessionsInstance = 0;
}
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
namespace mySTL {
template yaSSL::yassl_int_cpp_local1::SumData for_each<mySTL::list<yaSSL::input_buffer*>::iterator, yaSSL::yassl_int_cpp_local1::SumData>(mySTL::list<yaSSL::input_buffer*>::iterator, mySTL::list<yaSSL::input_buffer*>::iterator, yaSSL::yassl_int_cpp_local1::SumData);
......
......@@ -96,7 +96,7 @@ public:
pointer allocate(size_type n, const void* = 0)
{
CheckSize(n);
this->CheckSize(n);
if (n == 0)
return 0;
return NEW_TC T[n];
......
/* md4.hpp
*
* Copyright (C) 2003 Sawtooth Consulting Ltd.
*
* This file is part of yaSSL.
*
* yaSSL 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.
*
* yaSSL 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
*/
/* md4.hpp provides MD4 digest support
* WANRING: MD4 is considered insecure, only use if you have to, e.g., yaSSL
* libcurl supports needs this for NTLM authentication
*/
#ifndef TAO_CRYPT_MD4_HPP
#define TAO_CRYPT_MD4_HPP
#include "hash.hpp"
namespace TaoCrypt {
// MD4 digest
class MD4 : public HASHwithTransform {
public:
enum { BLOCK_SIZE = 64, DIGEST_SIZE = 16, PAD_SIZE = 56,
TAO_BYTE_ORDER = LittleEndianOrder }; // in Bytes
MD4() : HASHwithTransform(DIGEST_SIZE / sizeof(word32), BLOCK_SIZE)
{ Init(); }
ByteOrder getByteOrder() const { return ByteOrder(TAO_BYTE_ORDER); }
word32 getBlockSize() const { return BLOCK_SIZE; }
word32 getDigestSize() const { return DIGEST_SIZE; }
word32 getPadSize() const { return PAD_SIZE; }
MD4(const MD4&);
MD4& operator= (const MD4&);
void Init();
void Swap(MD4&);
private:
void Transform();
};
inline void swap(MD4& a, MD4& b)
{
a.Swap(b);
}
} // namespace
#endif // TAO_CRYPT_MD4_HPP
......@@ -28,10 +28,6 @@
#ifndef yaSSL_NEW_HPP
#define yaSSL_NEW_HPP
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef __sun
......
......@@ -4,7 +4,7 @@ noinst_LTLIBRARIES = libtaocrypt.la
libtaocrypt_la_SOURCES = aes.cpp aestables.cpp algebra.cpp arc4.cpp \
asn.cpp bftables.cpp blowfish.cpp coding.cpp des.cpp dh.cpp \
dsa.cpp file.cpp hash.cpp integer.cpp md2.cpp md5.cpp misc.cpp \
dsa.cpp file.cpp hash.cpp integer.cpp md2.cpp md4.cpp md5.cpp misc.cpp \
random.cpp ripemd.cpp rsa.cpp sha.cpp template_instnt.cpp \
tftables.cpp twofish.cpp
......
......@@ -2735,8 +2735,11 @@ void CleanUp()
{
tcDelete(one);
tcDelete(zero);
}
// In case user calls more than once, prevent seg fault
one = 0;
zero = 0;
}
Integer::Integer(RandomNumberGenerator& rng, const Integer& min,
const Integer& max)
......
/* md4.cpp
*
* Copyright (C) 2003 Sawtooth Consulting Ltd.
*
* This file is part of yaSSL.
*
* yaSSL 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.
*
* yaSSL 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
*/
/* based on Wei Dai's md4.cpp from CryptoPP */
#include "runtime.hpp"
#include "md4.hpp"
#include "algorithm.hpp" // mySTL::swap
namespace TaoCrypt {
void MD4::Init()
{
digest_[0] = 0x67452301L;
digest_[1] = 0xefcdab89L;
digest_[2] = 0x98badcfeL;
digest_[3] = 0x10325476L;
buffLen_ = 0;
loLen_ = 0;
hiLen_ = 0;
}
MD4::MD4(const MD4& that) : HASHwithTransform(DIGEST_SIZE / sizeof(word32),
BLOCK_SIZE)
{
buffLen_ = that.buffLen_;
loLen_ = that.loLen_;
hiLen_ = that.hiLen_;
memcpy(digest_, that.digest_, DIGEST_SIZE);
memcpy(buffer_, that.buffer_, BLOCK_SIZE);
}
MD4& MD4::operator= (const MD4& that)
{
MD4 tmp(that);
Swap(tmp);
return *this;
}
void MD4::Swap(MD4& other)
{
mySTL::swap(loLen_, other.loLen_);
mySTL::swap(hiLen_, other.hiLen_);
mySTL::swap(buffLen_, other.buffLen_);
memcpy(digest_, other.digest_, DIGEST_SIZE);
memcpy(buffer_, other.buffer_, BLOCK_SIZE);
}
void MD4::Transform()
{
#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
#define G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z)))
#define H(x, y, z) ((x) ^ (y) ^ (z))
word32 A, B, C, D;
A = digest_[0];
B = digest_[1];
C = digest_[2];
D = digest_[3];
#define function(a,b,c,d,k,s) a=rotlFixed(a+F(b,c,d)+buffer_[k],s);
function(A,B,C,D, 0, 3);
function(D,A,B,C, 1, 7);
function(C,D,A,B, 2,11);
function(B,C,D,A, 3,19);
function(A,B,C,D, 4, 3);
function(D,A,B,C, 5, 7);
function(C,D,A,B, 6,11);
function(B,C,D,A, 7,19);
function(A,B,C,D, 8, 3);
function(D,A,B,C, 9, 7);
function(C,D,A,B,10,11);
function(B,C,D,A,11,19);
function(A,B,C,D,12, 3);
function(D,A,B,C,13, 7);
function(C,D,A,B,14,11);
function(B,C,D,A,15,19);
#undef function
#define function(a,b,c,d,k,s) a=rotlFixed(a+G(b,c,d)+buffer_[k]+0x5a827999,s);
function(A,B,C,D, 0, 3);
function(D,A,B,C, 4, 5);
function(C,D,A,B, 8, 9);
function(B,C,D,A,12,13);
function(A,B,C,D, 1, 3);
function(D,A,B,C, 5, 5);
function(C,D,A,B, 9, 9);
function(B,C,D,A,13,13);
function(A,B,C,D, 2, 3);
function(D,A,B,C, 6, 5);
function(C,D,A,B,10, 9);
function(B,C,D,A,14,13);
function(A,B,C,D, 3, 3);
function(D,A,B,C, 7, 5);
function(C,D,A,B,11, 9);
function(B,C,D,A,15,13);
#undef function
#define function(a,b,c,d,k,s) a=rotlFixed(a+H(b,c,d)+buffer_[k]+0x6ed9eba1,s);
function(A,B,C,D, 0, 3);
function(D,A,B,C, 8, 9);
function(C,D,A,B, 4,11);
function(B,C,D,A,12,15);
function(A,B,C,D, 2, 3);
function(D,A,B,C,10, 9);
function(C,D,A,B, 6,11);
function(B,C,D,A,14,15);
function(A,B,C,D, 1, 3);
function(D,A,B,C, 9, 9);
function(C,D,A,B, 5,11);
function(B,C,D,A,13,15);
function(A,B,C,D, 3, 3);
function(D,A,B,C,11, 9);
function(C,D,A,B, 7,11);
function(B,C,D,A,15,15);
digest_[0] += A;
digest_[1] += B;
digest_[2] += C;
digest_[3] += D;
}
} // namespace
......@@ -81,6 +81,19 @@ extern "C" {
}
#if defined(__ICC) || defined(__INTEL_COMPILER)
extern "C" {
int __cxa_pure_virtual() {
assert("Pure virtual method called." == "Aborted");
return 0;
}
} // extern "C"
#endif
#endif // YASSL_PURE_C
......
......@@ -30,11 +30,11 @@
#include "sha.hpp"
#include "md5.hpp"
#include "hmac.hpp"
#include "ripemd.hpp"
#include "pwdbased.hpp"
#include "algebra.hpp"
#include "vector.hpp"
#include "hash.hpp"
#include "ripemd.hpp"
#ifdef HAVE_EXPLICIT_TEMPLATE_INSTANTIATION
namespace TaoCrypt {
......
......@@ -146,6 +146,10 @@ SOURCE=.\src\md2.cpp
# End Source File
# Begin Source File
SOURCE=.\src\md4.cpp
# End Source File
# Begin Source File
SOURCE=.\src\md5.cpp
# End Source File
# Begin Source File
......@@ -246,6 +250,10 @@ SOURCE=.\include\md2.hpp
# End Source File
# Begin Source File
SOURCE=.\include\md4.hpp
# End Source File
# Begin Source File
SOURCE=.\include\md5.hpp
# End Source File
# Begin Source File
......
......@@ -396,6 +396,27 @@
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\md4.cpp">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BasicRuntimeChecks="3"
BrowseInformation="1"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
</File>
<File
RelativePath="src\md5.cpp">
<FileConfiguration
......@@ -571,6 +592,9 @@
<File
RelativePath="include\md2.hpp">
</File>
<File
RelativePath="include\md4.hpp">
</File>
<File
RelativePath="include\md5.hpp">
</File>
......
......@@ -8,6 +8,7 @@
#include "sha.hpp"
#include "md5.hpp"
#include "md2.hpp"
#include "md4.hpp"
#include "ripemd.hpp"
#include "hmac.hpp"
#include "arc4.hpp"
......@@ -30,6 +31,7 @@ using TaoCrypt::word32;
using TaoCrypt::SHA;
using TaoCrypt::MD5;
using TaoCrypt::MD2;
using TaoCrypt::MD4;
using TaoCrypt::RIPEMD160;
using TaoCrypt::HMAC;
using TaoCrypt::ARC4;
......@@ -89,6 +91,7 @@ void file_test(int, char**);
int sha_test();
int md5_test();
int md2_test();
int md4_test();
int ripemd_test();
int hmac_test();
int arc4_test();
......@@ -165,6 +168,11 @@ void taocrypt_test(void* args)
else
printf( "MD2 test passed!\n");
if ( (ret = md4_test()) )
err_sys("MD4 test failed!\n", ret);
else
printf( "MD4 test passed!\n");
if ( (ret = ripemd_test()) )
err_sys("RIPEMD test failed!\n", ret);
else
......@@ -348,6 +356,51 @@ int md5_test()
}
int md4_test()
{
MD4 md4;
byte hash[MD4::DIGEST_SIZE];
testVector test_md4[] =
{
testVector("",
"\x31\xd6\xcf\xe0\xd1\x6a\xe9\x31\xb7\x3c\x59\xd7\xe0\xc0\x89"
"\xc0"),
testVector("a",
"\xbd\xe5\x2c\xb3\x1d\xe3\x3e\x46\x24\x5e\x05\xfb\xdb\xd6\xfb"
"\x24"),
testVector("abc",
"\xa4\x48\x01\x7a\xaf\x21\xd8\x52\x5f\xc1\x0a\xe8\x7a\xa6\x72"
"\x9d"),
testVector("message digest",
"\xd9\x13\x0a\x81\x64\x54\x9f\xe8\x18\x87\x48\x06\xe1\xc7\x01"
"\x4b"),
testVector("abcdefghijklmnopqrstuvwxyz",
"\xd7\x9e\x1c\x30\x8a\xa5\xbb\xcd\xee\xa8\xed\x63\xdf\x41\x2d"
"\xa9"),
testVector("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345"
"6789",
"\x04\x3f\x85\x82\xf2\x41\xdb\x35\x1c\xe6\x27\xe1\x53\xe7\xf0"
"\xe4"),
testVector("1234567890123456789012345678901234567890123456789012345678"
"9012345678901234567890",
"\xe3\x3b\x4d\xdc\x9c\x38\xf2\x19\x9c\x3e\x7b\x16\x4f\xcc\x05"
"\x36")
};
int times( sizeof(test_md4) / sizeof(testVector) );
for (int i = 0; i < times; ++i) {
md4.Update(test_md4[i].input_, test_md4[i].inLen_);
md4.Final(hash);
if (memcmp(hash, test_md4[i].output_, MD4::DIGEST_SIZE) != 0)
return -5 - i;
}
return 0;
}
int md2_test()
{
MD2 md5;
......
......@@ -33,10 +33,16 @@
// HPUX doesn't use socklent_t for third parameter to accept
#if !defined(__hpux__)
#if !defined(__hpux)
typedef socklen_t* ACCEPT_THIRD_T;
#else
typedef int* ACCEPT_THIRD_T;
// HPUX does not define _POSIX_THREADS as it's not _fully_ implemented
#ifndef _POSIX_THREADS
#define _POSIX_THREADS
#endif
#endif
......
DROP TABLE IF EXISTS t1, `"t"1`, t1aa, t2, t2aa;
DROP TABLE IF EXISTS t1, `"t"1`, t1aa, t2, t2aa, t3;
drop database if exists mysqldump_test_db;
drop database if exists db1;
drop database if exists db2;
......@@ -1508,6 +1508,7 @@ a b
12 meg
drop table t1, t2;
drop database db1;
--fields-optionally-enclosed-by="
CREATE DATABASE mysqldump_test_db;
USE mysqldump_test_db;
CREATE TABLE t1 ( a INT );
......@@ -2669,6 +2670,44 @@ UNLOCK TABLES;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop table t1;
create table t1(a int);
create table t2(a int);
create table t3(a int);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
DROP TABLE IF EXISTS `t3`;
CREATE TABLE `t3` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `t2`;
CREATE TABLE `t2` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
drop table t1, t2, t3;
End of 4.1 tests
create table t1 (a int);
insert into t1 values (289), (298), (234), (456), (789);
create definer = CURRENT_USER view v1 as select * from t1;
......
[mysqldump]
fields-optionally-enclosed-by="
......@@ -2,7 +2,7 @@
--source include/not_embedded.inc
--disable_warnings
DROP TABLE IF EXISTS t1, `"t"1`, t1aa, t2, t2aa;
DROP TABLE IF EXISTS t1, `"t"1`, t1aa, t2, t2aa, t3;
drop database if exists mysqldump_test_db;
drop database if exists db1;
drop database if exists db2;
......@@ -606,6 +606,13 @@ select * from t2 order by a;
drop table t1, t2;
drop database db1;
#
# BUG#15328 Segmentation fault occured if my.cnf is invalid for escape sequence
#
--exec $MYSQL_MY_PRINT_DEFAULTS --defaults-extra-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump
#
# Bug #9558 mysqldump --no-data db t1 t2 format still dumps data
#
......@@ -1065,7 +1072,18 @@ insert into t1 values ('','');
--exec $MYSQL_DUMP --skip-comments --hex-blob test t1
drop table t1;
# End of 4.1 tests
#
# Bug #18536: wrong table order
#
create table t1(a int);
create table t2(a int);
create table t3(a int);
--error 6
--exec $MYSQL_DUMP --skip-comments --force --no-data test t3 t1 non_existing t2
drop table t1, t2, t3;
--echo End of 4.1 tests
#
# Bug 14871 Invalid view dump output
......
......@@ -755,7 +755,9 @@ static int search_default_file_with_ext(Process_option_func opt_handler,
value_end=value;
/* remove quotes around argument */
if ((*value == '\"' || *value == '\'') && *value == value_end[-1])
if ((*value == '\"' || *value == '\'') && /* First char is quote */
(value + 1 < value_end ) && /* String is longer than 1 */
*value == value_end[-1] ) /* First char is equal to last char */
{
value++;
value_end--;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment