Skip to content

Commit

Permalink
Merge branch '10.1' of https://github.com/MariaDB/server into ok-debp…
Browse files Browse the repository at this point in the history
…kg-10.1
  • Loading branch information
ottok committed Sep 5, 2015
2 parents b9fee60 + 67dbfab commit d6c5e7e
Show file tree
Hide file tree
Showing 943 changed files with 17,417 additions and 9,192 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*.dat -text -whitespace

storage/connect/mysql-test/connect/std_data/*.txt -text
pcre/testdata/greppatN4 -text

# Denote all files that are truly binary and should not be modified.
*.png binary
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@ storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result
*.vcproj.*
*.vcproj.*.*
*.vcproj.*.*.*
*.vcxproj
*.vcxproj.*
*.vcxproj.*.*
*.vcxproj.*.*.*

# Build results
[Dd]ebug/
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ IF(WIN32)
ADD_SUBDIRECTORY(win/upgrade_wizard)
ADD_SUBDIRECTORY(win/packaging)
ENDIF()
ADD_SUBDIRECTORY(packaging/solaris)


INCLUDE(for_clients)
Expand Down
3 changes: 2 additions & 1 deletion client/mysql_upgrade.c
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ int main(int argc, char **argv)
printf("This installation of MySQL is already upgraded to %s, "
"use --force if you still need to run mysql_upgrade\n",
MYSQL_SERVER_VERSION);
die(NULL);
goto end;
}

if (opt_version_check && check_version_match())
Expand Down Expand Up @@ -1138,6 +1138,7 @@ int main(int argc, char **argv)

DBUG_ASSERT(phase == phases_total);

end:
free_used_memory();
my_end(my_end_arg);
exit(0);
Expand Down
11 changes: 8 additions & 3 deletions client/mysqlbinlog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2240,7 +2240,7 @@ static Exit_status check_header(IO_CACHE* file,
Format_description_log_event *new_description_event;
my_b_seek(file, tmp_pos); /* seek back to event's start */
if (!(new_description_event= (Format_description_log_event*)
Log_event::read_log_event(file, glob_description_event,
Log_event::read_log_event(file, 0, glob_description_event,
opt_verify_binlog_checksum)))
/* EOF can't be hit here normally, so it's a real error */
{
Expand Down Expand Up @@ -2274,7 +2274,7 @@ static Exit_status check_header(IO_CACHE* file,
{
Log_event *ev;
my_b_seek(file, tmp_pos); /* seek back to event's start */
if (!(ev= Log_event::read_log_event(file, glob_description_event,
if (!(ev= Log_event::read_log_event(file, 0, glob_description_event,
opt_verify_binlog_checksum)))
{
/* EOF can't be hit here normally, so it's a real error */
Expand Down Expand Up @@ -2388,7 +2388,7 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
char llbuff[21];
my_off_t old_off = my_b_tell(file);

Log_event* ev = Log_event::read_log_event(file, glob_description_event,
Log_event* ev = Log_event::read_log_event(file, 0, glob_description_event,
opt_verify_binlog_checksum);
if (!ev)
{
Expand Down Expand Up @@ -2575,6 +2575,11 @@ void *sql_alloc(size_t size)
return alloc_root(&s_mem_root, size);
}

struct encryption_service_st encryption_handler=
{
0, 0, 0, 0, 0, 0, 0
};

/*
We must include this here as it's compiled with different options for
the server
Expand Down
7 changes: 6 additions & 1 deletion client/mysqlimport.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@


/* Global Thread counter */
uint counter;
uint counter= 0;
pthread_mutex_t counter_mutex;
pthread_cond_t count_threshhold;

Expand Down Expand Up @@ -489,6 +489,11 @@ static void safe_exit(int error, MYSQL *mysql)
{
if (error && ignore_errors)
return;

/* in multi-threaded mode protect from concurrent safe_exit's */
if (counter)
pthread_mutex_lock(&counter_mutex);

if (mysql)
mysql_close(mysql);

Expand Down
49 changes: 41 additions & 8 deletions client/mysqlslap.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
Copyright (c) 2005, 2012, Oracle and/or its affiliates.
Copyright (c) 2005, 2015, Oracle and/or its affiliates.
Copyright (c) 2010, 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 @@ -242,7 +243,7 @@ void print_conclusions_csv(conclusions *con);
void generate_stats(conclusions *con, option_string *eng, stats *sptr);
uint parse_comma(const char *string, uint **range);
uint parse_delimiter(const char *script, statement **stmt, char delm);
uint parse_option(const char *origin, option_string **stmt, char delm);
int parse_option(const char *origin, option_string **stmt, char delm);
static int drop_schema(MYSQL *mysql, const char *db);
uint get_random_string(char *buf);
static statement *build_table_string(void);
Expand Down Expand Up @@ -1264,7 +1265,13 @@ get_options(int *argc,char ***argv)
if (num_int_cols_opt)
{
option_string *str;
parse_option(num_int_cols_opt, &str, ',');
if(parse_option(num_int_cols_opt, &str, ',') == -1)
{
fprintf(stderr, "Invalid value specified for the option "
"'number-int-cols'\n");
option_cleanup(str);
return 1;
}
num_int_cols= atoi(str->string);
if (str->option)
num_int_cols_index= atoi(str->option);
Expand All @@ -1275,7 +1282,13 @@ get_options(int *argc,char ***argv)
if (num_char_cols_opt)
{
option_string *str;
parse_option(num_char_cols_opt, &str, ',');
if(parse_option(num_char_cols_opt, &str, ',') == -1)
{
fprintf(stderr, "Invalid value specified for the option "
"'number-char-cols'\n");
option_cleanup(str);
return 1;
}
num_char_cols= atoi(str->string);
if (str->option)
num_char_cols_index= atoi(str->option);
Expand Down Expand Up @@ -1512,7 +1525,13 @@ get_options(int *argc,char ***argv)
printf("Parsing engines to use.\n");

if (default_engine)
parse_option(default_engine, &engine_options, ',');
{
if(parse_option(default_engine, &engine_options, ',') == -1)
{
fprintf(stderr, "Invalid value specified for the option 'engine'\n");
return 1;
}
}

if (tty_password)
opt_password= get_tty_password(NullS);
Expand Down Expand Up @@ -1989,7 +2008,7 @@ pthread_handler_t run_task(void *p)
DBUG_RETURN(0);
}

uint
int
parse_option(const char *origin, option_string **stmt, char delm)
{
char *retstr;
Expand All @@ -2014,6 +2033,13 @@ parse_option(const char *origin, option_string **stmt, char delm)
char buffer[HUGE_STRING_LENGTH]= "";
char *buffer_ptr;

/*
Return an error if the length of the any of the comma seprated value
exceeds HUGE_STRING_LENGTH.
*/
if ((size_t)(retstr - ptr) > HUGE_STRING_LENGTH)
return -1;

count++;
strncpy(buffer, ptr, (size_t)(retstr - ptr));
/*
Expand Down Expand Up @@ -2053,6 +2079,13 @@ parse_option(const char *origin, option_string **stmt, char delm)
{
char *origin_ptr;

/*
Return an error if the length of the any of the comma seprated value
exceeds HUGE_STRING_LENGTH.
*/
if (strlen(ptr) > HUGE_STRING_LENGTH)
return -1;

if ((origin_ptr= strchr(ptr, ':')))
{
char *option_ptr;
Expand All @@ -2063,13 +2096,13 @@ parse_option(const char *origin, option_string **stmt, char delm)
option_ptr= (char *)ptr + 1 + tmp->length;

/* Move past the : and the first string */
tmp->option_length= (size_t)((ptr + length) - option_ptr);
tmp->option_length= strlen(option_ptr);
tmp->option= my_strndup(option_ptr, tmp->option_length,
MYF(MY_FAE));
}
else
{
tmp->length= (size_t)((ptr + length) - ptr);
tmp->length= strlen(ptr);
tmp->string= my_strndup(ptr, tmp->length, MYF(MY_FAE));
}

Expand Down
14 changes: 9 additions & 5 deletions cmake/check_compiler_flag.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@ SET(fail_patterns
FAIL_REGEX "unrecognized .*option"
FAIL_REGEX "ignoring unknown option"
FAIL_REGEX "warning:.*ignored"
FAIL_REGEX "warning:.*is valid for.*but not for"
FAIL_REGEX "warning:.*redefined"
FAIL_REGEX "[Ww]arning: [Oo]ption"
)

MACRO (MY_CHECK_C_COMPILER_FLAG flag result)
MACRO (MY_CHECK_C_COMPILER_FLAG flag)
STRING(REGEX REPLACE "[-,= ]" "_" result "HAVE_C_${flag}")
SET(SAVE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}")
CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${result}
${fail_patterns})
SET(CMAKE_REQUIRED_FLAGS "${SAVE_CMAKE_REQUIRED_FLAGS}")
ENDMACRO()

MACRO (MY_CHECK_CXX_COMPILER_FLAG flag result)
MACRO (MY_CHECK_CXX_COMPILER_FLAG flag)
STRING(REGEX REPLACE "[-,= ]" "_" result "HAVE_CXX_${flag}")
SET(SAVE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}")
CHECK_CXX_SOURCE_COMPILES("int main(void) { return 0; }" ${result}
Expand All @@ -35,10 +38,11 @@ FUNCTION(MY_CHECK_AND_SET_COMPILER_FLAG flag)
IF(WIN32)
RETURN()
ENDIF()
MY_CHECK_C_COMPILER_FLAG(${flag} HAVE_C_${flag})
MY_CHECK_CXX_COMPILER_FLAG(${flag} HAVE_CXX_${flag})
MY_CHECK_C_COMPILER_FLAG(${flag})
MY_CHECK_CXX_COMPILER_FLAG(${flag})
STRING(REGEX REPLACE "[-,= ]" "_" result "${flag}")
FOREACH(lang C CXX)
IF (HAVE_${lang}_${flag})
IF (HAVE_${lang}_${result})
IF(ARGN)
FOREACH(type ${ARGN})
SET(CMAKE_${lang}_FLAGS_${type} "${CMAKE_${lang}_FLAGS_${type}} ${flag}" PARENT_SCOPE)
Expand Down
4 changes: 2 additions & 2 deletions cmake/maintainer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

# Common warning flags for GCC, G++, Clang and Clang++
SET(MY_WARNING_FLAGS "-Wall -Wextra -Wformat-security -Wno-init-self")
MY_CHECK_C_COMPILER_FLAG("-Wvla" HAVE_WVLA) # Requires GCC 4.3+ or Clang
IF(HAVE_WVLA)
MY_CHECK_C_COMPILER_FLAG("-Wvla") # Requires GCC 4.3+ or Clang
IF(HAVE_C__Wvla)
SET(MY_WARNING_FLAGS "${MY_WARNING_FLAGS} -Wvla")
ENDIF()

Expand Down
1 change: 0 additions & 1 deletion cmake/ssl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ MACRO (MYSQL_CHECK_SSL)
IF (WITH_SSL_PATH)
LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
ENDIF()
MESSAGE(STATUS "suffixes <${CMAKE_FIND_LIBRARY_SUFFIXES}>")
FIND_LIBRARY(OPENSSL_LIBRARIES
NAMES ssl ssleay32 ssleay32MD
HINTS ${OPENSSL_ROOT_DIR}/lib)
Expand Down
4 changes: 2 additions & 2 deletions configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ ENDIF()
FIND_PACKAGE (Threads)

FUNCTION(MY_CHECK_PTHREAD_ONCE_INIT)
CHECK_C_COMPILER_FLAG("-Werror" HAVE_WERROR_FLAG)
IF(NOT HAVE_WERROR_FLAG)
MY_CHECK_C_COMPILER_FLAG("-Werror")
IF(NOT HAVE_C__Werror)
RETURN()
ENDIF()
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror")
Expand Down
1 change: 1 addition & 0 deletions debian/additions/mysqld_safe_syslog.cnf
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[mysqld_safe]
skip_log_error
syslog
82 changes: 39 additions & 43 deletions include/my_crypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,58 +36,54 @@ extern "C" {
/* The max key length of all supported algorithms */
#define MY_AES_MAX_KEY_LENGTH 32

#ifdef HAVE_EncryptAes128Ctr

int my_aes_encrypt_ctr(const uchar* source, uint source_length,
uchar* dest, uint* dest_length,
const uchar* key, uint key_length,
const uchar* iv, uint iv_length);

#define my_aes_decrypt_ctr my_aes_encrypt_ctr
#define MY_AES_CTX_SIZE 512

enum my_aes_mode {
MY_AES_ECB, MY_AES_CBC
#ifdef HAVE_EncryptAes128Ctr
, MY_AES_CTR
#endif

#ifdef HAVE_EncryptAes128Gcm
, MY_AES_GCM
#endif
};

int my_aes_crypt_init(void *ctx, enum my_aes_mode mode, int flags,
const unsigned char* key, unsigned int klen,
const unsigned char* iv, unsigned int ivlen);
int my_aes_crypt_update(void *ctx, const uchar *src, uint slen,
uchar *dst, uint *dlen);
int my_aes_crypt_finish(void *ctx, uchar *dst, uint *dlen);
int my_aes_crypt(enum my_aes_mode mode, int flags,
const uchar *src, uint slen, uchar *dst, uint *dlen,
const uchar *key, uint klen, const uchar *iv, uint ivlen);

int my_aes_encrypt_gcm(const uchar* source, uint source_length,
uchar* dest, uint* dest_length,
const uchar* key, uint key_length,
const uchar* iv, uint iv_length);

int my_aes_decrypt_gcm(const uchar* source, uint source_length,
uchar* dest, uint* dest_length,
const uchar* key, uint key_length,
const uchar* iv, uint iv_length);
/*
calculate the length of the cyphertext from the length of the plaintext
for different AES encryption modes with padding enabled.
Without padding (ENCRYPTION_FLAG_NOPAD) cyphertext has the same length
as the plaintext
*/
static inline uint my_aes_get_size(enum my_aes_mode mode __attribute__((unused)), uint source_length)
{
#ifdef HAVE_EncryptAes128Ctr
if (mode == MY_AES_CTR)
return source_length;
#ifdef HAVE_EncryptAes128Gcm
if (mode == MY_AES_GCM)
return source_length + MY_AES_BLOCK_SIZE;
#endif
#endif
return (source_length / MY_AES_BLOCK_SIZE + 1) * MY_AES_BLOCK_SIZE;
}

int my_aes_encrypt_cbc(const uchar* source, uint source_length,
uchar* dest, uint* dest_length,
const uchar* key, uint key_length,
const uchar* iv, uint iv_length,
int no_padding);

int my_aes_decrypt_cbc(const uchar* source, uint source_length,
uchar* dest, uint* dest_length,
const uchar* key, uint key_length,
const uchar* iv, uint iv_length,
int no_padding);

int my_aes_encrypt_ecb(const uchar* source, uint source_length,
uchar* dest, uint* dest_length,
const uchar* key, uint key_length,
const uchar* iv, uint iv_length,
int no_padding);

int my_aes_decrypt_ecb(const uchar* source, uint source_length,
uchar* dest, uint* dest_length,
const uchar* key, uint key_length,
const uchar* iv, uint iv_length,
int no_padding);
static inline uint my_aes_ctx_size(enum my_aes_mode mode __attribute__((unused)))
{
return MY_AES_CTX_SIZE;
}

int my_random_bytes(uchar* buf, int num);

uint my_aes_get_size(uint source_length);

#ifdef __cplusplus
}
#endif
Expand Down
Loading

0 comments on commit d6c5e7e

Please sign in to comment.