Skip to content

Commit

Permalink
Merge branch '10.0' into 10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Oct 11, 2015
2 parents b785857 + e7cb032 commit dfb74de
Show file tree
Hide file tree
Showing 239 changed files with 7,223 additions and 2,734 deletions.
3 changes: 2 additions & 1 deletion client/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
#
# 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
Expand Down Expand Up @@ -51,6 +51,7 @@ MYSQL_ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c)
TARGET_LINK_LIBRARIES(mysqldump mysqlclient)

MYSQL_ADD_EXECUTABLE(mysqlimport mysqlimport.c)
SET_SOURCE_FILES_PROPERTIES(mysqlimport.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqlimport mysqlclient)

MYSQL_ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c COMPONENT Server)
Expand Down
5 changes: 2 additions & 3 deletions client/mysqlimport.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2011, 2015, MariaDB
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
Expand Down Expand Up @@ -30,7 +31,6 @@

#include "client_priv.h"
#include "mysql_version.h"
#include <my_pthread.h>

#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */

Expand Down Expand Up @@ -484,7 +484,6 @@ static void db_disconnect(char *host, MYSQL *mysql)
}



static void safe_exit(int error, MYSQL *mysql)
{
if (error && ignore_errors)
Expand Down
10 changes: 6 additions & 4 deletions cmake/os/Windows.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
#
# 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
Expand Down Expand Up @@ -49,10 +49,12 @@ IF(CMAKE_C_COMPILER MATCHES "icl")
SET(MSVC TRUE)
ENDIF()

ADD_DEFINITIONS("-D_WINDOWS -D__WIN__ -D_CRT_SECURE_NO_DEPRECATE")
ADD_DEFINITIONS("-D_WIN32_WINNT=0x0501")
ADD_DEFINITIONS(-D_WINDOWS -D__WIN__ -D_CRT_SECURE_NO_DEPRECATE)
ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501)
# We do not want the windows.h macros min/max
ADD_DEFINITIONS(-DNOMINMAX)
# Speed up build process excluding unused header files
ADD_DEFINITIONS("-DWIN32_LEAN_AND_MEAN")
ADD_DEFINITIONS(-DWIN32_LEAN_AND_MEAN)

# Adjust compiler and linker flags
IF(MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4)
Expand Down
29 changes: 29 additions & 0 deletions extra/yassl/README
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,35 @@ before calling SSL_new();

*** end Note ***

yaSSL Release notes, version 2.3.8 (9/17/2015)
This release of yaSSL fixes a high security vulnerability. All users
SHOULD update. If using yaSSL for TLS on the server side with private
RSA keys allowing ephemeral key exchange you MUST update and regenerate
the RSA private keys. This report is detailed in:
https://people.redhat.com/~fweimer/rsa-crt-leaks.pdf
yaSSL now detects RSA signature faults and returns an error.

yaSSL Patch notes, version 2.3.7e (6/26/2015)
This release of yaSSL includes a fix for Date less than comparison.
Previously yaSSL would return true on less than comparisons if the Dates
were equal. Reported by Oracle. No security problem, but if a cert was
generated right now, a server started using it in the same second, and a
client tried to verify it in the same second it would report not yet valid.

yaSSL Patch notes, version 2.3.7d (6/22/2015)
This release of yaSSL includes a fix for input_buffer set_current with
index 0. SSL_peek() at front of waiting data could trigger. Robert
Golebiowski of Oracle identified and suggested a fix, thanks!

yaSSL Patch notes, version 2.3.7c (6/12/2015)
This release of yaSSL does certificate DATE comparisons to the second
instead of to the minute, helpful when using freshly generated certs.
Though keep in mind that time sync differences could still show up.

yaSSL Patch notes, version 2.3.7b (3/18/2015)
This release of yaSSL fixes a potential crash with corrupted private keys.
Also detects bad keys earlier for user.

yaSSL Release notes, version 2.3.7 (12/10/2014)
This release of yaSSL fixes the potential to process duplicate handshake
messages by explicitly marking/checking received handshake messages.
Expand Down
2 changes: 1 addition & 1 deletion extra/yassl/include/openssl/ssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "rsa.h"


#define YASSL_VERSION "2.3.7"
#define YASSL_VERSION "2.3.8"


#if defined(__cplusplus)
Expand Down
3 changes: 2 additions & 1 deletion extra/yassl/include/yassl_error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ enum YasslError {
compress_error = 118,
decompress_error = 119,
pms_version_error = 120,
sanityCipher_error = 121
sanityCipher_error = 121,
rsaSignFault_error = 122

// !!!! add error message to .cpp !!!!

Expand Down
2 changes: 1 addition & 1 deletion extra/yassl/src/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ void input_buffer::set_error()

void input_buffer::set_current(uint i)
{
if (error_ == 0 && (i == 0 || check(i - 1, size_) == 0))
if (error_ == 0 && check(i ? i - 1 : 0, size_) == 0)
current_ = i;
else
error_ = -1;
Expand Down
2 changes: 2 additions & 0 deletions extra/yassl/src/handshake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,8 @@ void sendCertificateVerify(SSL& ssl, BufferOutput buffer)

CertificateVerify verify;
verify.Build(ssl);
if (ssl.GetError()) return;

RecordLayerHeader rlHeader;
HandShakeHeader hsHeader;
mySTL::auto_ptr<output_buffer> out(NEW_YS output_buffer);
Expand Down
29 changes: 28 additions & 1 deletion extra/yassl/src/ssl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#include "file.hpp" // for TaoCrypt Source
#include "coding.hpp" // HexDecoder
#include "helpers.hpp" // for placement new hack
#include "rsa.hpp" // for TaoCrypt RSA key decode
#include "dsa.hpp" // for TaoCrypt DSA key decode
#include <stdio.h>
#include <time.h>

Expand All @@ -55,6 +57,8 @@ namespace yaSSL {

int read_file(SSL_CTX* ctx, const char* file, int format, CertType type)
{
int ret = SSL_SUCCESS;

if (format != SSL_FILETYPE_ASN1 && format != SSL_FILETYPE_PEM)
return SSL_BAD_FILETYPE;

Expand Down Expand Up @@ -142,8 +146,31 @@ int read_file(SSL_CTX* ctx, const char* file, int format, CertType type)
}
}
}

if (type == PrivateKey && ctx->privateKey_) {
// see if key is valid early
TaoCrypt::Source rsaSource(ctx->privateKey_->get_buffer(),
ctx->privateKey_->get_length());
TaoCrypt::RSA_PrivateKey rsaKey;
rsaKey.Initialize(rsaSource);

if (rsaSource.GetError().What()) {
// rsa failed see if DSA works

TaoCrypt::Source dsaSource(ctx->privateKey_->get_buffer(),
ctx->privateKey_->get_length());
TaoCrypt::DSA_PrivateKey dsaKey;
dsaKey.Initialize(dsaSource);

if (rsaSource.GetError().What()) {
// neither worked
ret = SSL_FAILURE;
}
}
}

fclose(input);
return SSL_SUCCESS;
return ret;
}


Expand Down
4 changes: 4 additions & 0 deletions extra/yassl/src/yassl_error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ void SetErrorString(YasslError error, char* buffer)
strncpy(buffer, "sanity check on cipher text size error", max);
break;

case rsaSignFault_error:
strncpy(buffer, "rsa signature fault error", max);
break;

// openssl errors
case SSL_ERROR_WANT_READ :
strncpy(buffer, "the read operation would block", max);
Expand Down
15 changes: 14 additions & 1 deletion extra/yassl/src/yassl_imp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,16 @@ void DH_Server::build(SSL& ssl)
sha.update(tmp.get_buffer(), tmp.get_size());
sha.get_digest(&hash[MD5_LEN]);

if (ssl.getSecurity().get_parms().sig_algo_ == rsa_sa_algo)
if (ssl.getSecurity().get_parms().sig_algo_ == rsa_sa_algo) {
auth->sign(signature_, hash, sizeof(hash),
ssl.getCrypto().get_random());
// check for rsa signautre fault
if (!auth->verify(hash, sizeof(hash), signature_,
auth->get_signatureLength())) {
ssl.SetError(rsaSignFault_error);
return;
}
}
else {
auth->sign(signature_, &hash[MD5_LEN], SHA_LEN,
ssl.getCrypto().get_random());
Expand Down Expand Up @@ -2159,6 +2166,12 @@ void CertificateVerify::Build(SSL& ssl)
memcpy(sig.get(), len, VERIFY_HEADER);
rsa.sign(sig.get() + VERIFY_HEADER, hashes_.md5_, sizeof(Hashes),
ssl.getCrypto().get_random());
// check for rsa signautre fault
if (!rsa.verify(hashes_.md5_, sizeof(Hashes), sig.get() + VERIFY_HEADER,
rsa.get_cipherLength())) {
ssl.SetError(rsaSignFault_error);
return;
}
}
else { // DSA
DSS dss(cert.get_privateKey(), cert.get_privateKeyLength(), false);
Expand Down
9 changes: 7 additions & 2 deletions extra/yassl/taocrypt/src/asn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void ASN1_TIME_extract(const unsigned char* date, unsigned char format,
namespace { // locals


// to the minute
// to the second
bool operator>(tm& a, tm& b)
{
if (a.tm_year > b.tm_year)
Expand All @@ -105,13 +105,18 @@ bool operator>(tm& a, tm& b)
a.tm_min > b.tm_min)
return true;

if (a.tm_year == b.tm_year && a.tm_mon == b.tm_mon &&
a.tm_mday == b.tm_mday && a.tm_hour == b.tm_hour &&
a.tm_min == b.tm_min && a.tm_sec > b.tm_sec)
return true;

return false;
}


bool operator<(tm& a, tm&b)
{
return !(a>b);
return (b>a);
}


Expand Down
4 changes: 4 additions & 0 deletions extra/yassl/taocrypt/src/rsa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ word32 RSA_BlockType2::UnPad(const byte *pkcsBlock, unsigned int pkcsBlockLen,
void RSA_BlockType1::Pad(const byte* input, word32 inputLen, byte* pkcsBlock,
word32 pkcsBlockLen, RandomNumberGenerator&) const
{
// sanity checks
if (input == NULL || pkcsBlock == NULL)
return;

// convert from bit length to byte length
if (pkcsBlockLen % 8 != 0)
{
Expand Down
1 change: 1 addition & 0 deletions extra/yassl/testsuite/cipher-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#


no_pid=-1
server_pid=$no_pid


Expand Down
2 changes: 1 addition & 1 deletion include/maria.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extern "C" {
#define MARIA_NAME_IEXT ".MAI"
#define MARIA_NAME_DEXT ".MAD"
/* Max extra space to use when sorting keys */
#define MARIA_MAX_TEMP_LENGTH 2*1024L*1024L*1024L
#define MARIA_MAX_TEMP_LENGTH (2*1024L*1024L*1024L)
/* Possible values for maria_block_size (must be power of 2) */
#define MARIA_KEY_BLOCK_LENGTH 8192 /* default key block length */
#define MARIA_MIN_KEY_BLOCK_LENGTH 1024 /* Min key block length */
Expand Down
2 changes: 1 addition & 1 deletion include/my_alarm.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ extern ulong my_time_to_wait_for_lock;
#define ALARM_INIT
#define ALARM_END
#define ALARM_TEST (alarm_pos++ >= alarm_end_pos)
#define ALARM_REINIT alarm_end_pos+=MY_HOW_OFTEN_TO_WRITE
#define ALARM_REINIT (alarm_end_pos+=MY_HOW_OFTEN_TO_WRITE)
#endif /* HAVE_ALARM */

#ifdef __cplusplus
Expand Down
8 changes: 4 additions & 4 deletions include/my_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -537,13 +537,13 @@ typedef ulong key_part_map;
#define SEARCH_NULL_ARE_EQUAL 32768 /* NULL in keys are equal */
#define SEARCH_NULL_ARE_NOT_EQUAL 65536 /* NULL in keys are not equal */
/* Use this when inserting a key in position order */
#define SEARCH_INSERT SEARCH_NULL_ARE_NOT_EQUAL*2
#define SEARCH_INSERT (SEARCH_NULL_ARE_NOT_EQUAL*2)
/* Only part of the key is specified while reading */
#define SEARCH_PART_KEY SEARCH_INSERT*2
#define SEARCH_PART_KEY (SEARCH_INSERT*2)
/* Used when user key (key 2) contains transaction id's */
#define SEARCH_USER_KEY_HAS_TRANSID SEARCH_PART_KEY*2
#define SEARCH_USER_KEY_HAS_TRANSID (SEARCH_PART_KEY*2)
/* Used when page key (key 1) contains transaction id's */
#define SEARCH_PAGE_KEY_HAS_TRANSID SEARCH_USER_KEY_HAS_TRANSID*2
#define SEARCH_PAGE_KEY_HAS_TRANSID (SEARCH_USER_KEY_HAS_TRANSID*2)

/* bits in opt_flag */
#define QUICK_USED 1
Expand Down
4 changes: 2 additions & 2 deletions include/my_dbug.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ extern void _db_end_(void);
extern void _db_lock_file_(void);
extern void _db_unlock_file_(void);
extern FILE *_db_fp_(void);
extern void _db_flush_();
extern void _db_flush_(void);
extern void dbug_swap_code_state(void **code_state_store);
extern void dbug_free_code_state(void **code_state_store);
extern const char* _db_get_func_(void);
Expand Down Expand Up @@ -123,7 +123,7 @@ extern const char* _db_get_func_(void);
#ifdef __WIN__
#define DBUG_SUICIDE() DBUG_ABORT()
#else
extern void _db_suicide_();
extern void _db_suicide_(void);
#define DBUG_SUICIDE() (_db_flush_(), _db_suicide_())
#endif

Expand Down
2 changes: 1 addition & 1 deletion include/my_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ typedef int my_socket; /* File descriptor for sockets */
/* Type for fuctions that handles signals */
#define sig_handler RETSIGTYPE
C_MODE_START
typedef void (*sig_return)();/* Returns type from signal */
typedef void (*sig_return)(); /* Returns type from signal */
C_MODE_END
#if defined(__GNUC__) && !defined(_lint)
typedef char pchar; /* Mixed prototypes can take char */
Expand Down
8 changes: 4 additions & 4 deletions include/my_pthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -701,8 +701,8 @@ extern void my_thread_end(void);
extern const char *my_thread_name(void);
extern my_thread_id my_thread_dbug_id(void);
extern int pthread_dummy(int);
extern void my_mutex_init();
extern void my_mutex_end();
extern void my_mutex_init(void);
extern void my_mutex_end(void);

/* All thread specific variables are in the following struct */

Expand Down Expand Up @@ -745,8 +745,8 @@ struct st_my_thread_var
};

extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const));
extern void **my_thread_var_dbug();
extern safe_mutex_t **my_thread_var_mutex_in_use();
extern void **my_thread_var_dbug(void);
extern safe_mutex_t **my_thread_var_mutex_in_use(void);
extern uint my_thread_end_wait_time;
extern my_bool safe_mutex_deadlock_detector;
#define my_thread_var (_my_thread_var())
Expand Down
Loading

0 comments on commit dfb74de

Please sign in to comment.