Skip to content

Commit

Permalink
mysql-5.5.39 merge
Browse files Browse the repository at this point in the history
~40% bugfixed(*) applied
~40$ bugfixed reverted (incorrect or we're not buggy)
~20% bugfixed applied, despite us being not buggy
(*) only changes in the server code, e.g. not cmakefiles
  • Loading branch information
Sergei Golubchik committed Aug 2, 2014
2 parents 14200df + e9b2f5b commit 1c6ad62
Show file tree
Hide file tree
Showing 124 changed files with 2,723 additions and 4,338 deletions.
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ IF(POLICY CMP0022)
CMAKE_POLICY(SET CMP0022 OLD)
ENDIF()

# We use the LOCATION target property (CMP0026)
# and get_target_property() for non-existent targets (CMP0045)
IF(CMAKE_VERSION VERSION_EQUAL "3.0.0" OR
CMAKE_VERSION VERSION_GREATER "3.0.0")
CMAKE_POLICY(SET CMP0026 OLD)
CMAKE_POLICY(SET CMP0045 OLD)
ENDIF()

MESSAGE(STATUS "Running cmake version ${CMAKE_VERSION}")

SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
Expand Down Expand Up @@ -422,7 +430,6 @@ IF(NOT WITHOUT_SERVER)
IF(EXISTS ${CMAKE_SOURCE_DIR}/internal/CMakeLists.txt)
ADD_SUBDIRECTORY(internal)
ENDIF()
ADD_SUBDIRECTORY(packaging/rpm-uln)
ADD_SUBDIRECTORY(packaging/rpm-oel)
ENDIF()

Expand Down
63 changes: 58 additions & 5 deletions client/mysqladmin.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
Copyright (c) 2010, 2012, Monty Program Ab.
Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2010, 2014, Monty Program Ab.
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 @@ -70,6 +70,7 @@ extern "C" my_bool get_one_option(int optid, const struct my_option *opt,
char *argument);
static my_bool sql_connect(MYSQL *mysql, uint wait);
static int execute_commands(MYSQL *mysql,int argc, char **argv);
static char **mask_password(int argc, char ***argv);
static int drop_db(MYSQL *mysql,const char *db);
extern "C" sig_handler endprog(int signal_number);
static void nice_time(ulong sec,char *buff);
Expand Down Expand Up @@ -303,18 +304,22 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),

int main(int argc,char *argv[])
{
int error= 0;
int error= 0, temp_argc;
MYSQL mysql;
char **commands, **save_argv;
char **commands, **save_argv, **temp_argv;

MY_INIT(argv[0]);
mysql_init(&mysql);
sf_leaking_memory=1; /* don't report memory leaks on early exits */
if ((error= load_defaults("my",load_default_groups,&argc,&argv)))
goto err1;
save_argv = argv; /* Save for free_defaults */

if ((error=handle_options(&argc, &argv, my_long_options, get_one_option)))
goto err2;
temp_argv= mask_password(argc, &argv);
temp_argc= argc;

if (debug_info_flag)
my_end_arg= MY_CHECK_ERROR | MY_GIVE_INFO;
if (debug_check_flag)
Expand All @@ -325,7 +330,7 @@ int main(int argc,char *argv[])
usage();
exit(1);
}
commands = argv;
commands = temp_argv;
if (tty_password)
opt_password = get_tty_password(NullS);

Expand Down Expand Up @@ -465,6 +470,13 @@ int main(int argc,char *argv[])
} /* got connection */

mysql_close(&mysql);
temp_argc--;
while(temp_argc >= 0)
{
my_free(temp_argv[temp_argc]);
temp_argc--;
}
my_free(temp_argv);
err2:
mysql_library_end();
my_free(opt_password);
Expand Down Expand Up @@ -1165,6 +1177,47 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
return 0;
}

/**
@brief Masking the password if it is passed as command line argument.
@details It works in Linux and changes cmdline in ps and /proc/pid/cmdline,
but it won't work for history file of shell.
The command line arguments are copied to another array and the
password in the argv is masked. This function is called just after
"handle_options" because in "handle_options", the agrv pointers
are altered which makes freeing of dynamically allocated memory
difficult. The password masking is done before all other operations
in order to minimise the time frame of password visibility via cmdline.
@param argc command line options (count)
@param argv command line options (values)
@return temp_argv copy of argv
*/

static char **mask_password(int argc, char ***argv)
{
char **temp_argv;
temp_argv= (char **)(my_malloc(sizeof(char *) * argc, MYF(MY_WME)));
argc--;
while (argc > 0)
{
temp_argv[argc]= my_strdup((*argv)[argc], MYF(MY_FAE));
if (find_type((*argv)[argc - 1],&command_typelib, FIND_TYPE_BASIC) == ADMIN_PASSWORD ||
find_type((*argv)[argc - 1],&command_typelib, FIND_TYPE_BASIC) == ADMIN_OLD_PASSWORD)
{
char *start= (*argv)[argc];
while (*start)
*start++= 'x';
start= (*argv)[argc];
if (*start)
start[1]= 0; /* Cut length of argument */
}
argc--;
}
temp_argv[argc]= my_strdup((*argv)[argc], MYF(MY_FAE));
return(temp_argv);
}

static void print_version(void)
{
Expand Down
39 changes: 28 additions & 11 deletions client/mysqldump.c
Original file line number Diff line number Diff line change
Expand Up @@ -5645,19 +5645,36 @@ int main(int argc, char **argv)
dump_all_tablespaces();
dump_all_databases();
}
else if (argc > 1 && !opt_databases)
{
/* Only one database and selected table(s) */
if (!opt_alltspcs && !opt_notspcs)
dump_tablespaces_for_tables(*argv, (argv + 1), (argc -1));
dump_selected_tables(*argv, (argv + 1), (argc - 1));
}
else
{
/* One or more databases, all tables */
if (!opt_alltspcs && !opt_notspcs)
dump_tablespaces_for_databases(argv);
dump_databases(argv);
// Check all arguments meet length condition. Currently database and table
// names are limited to NAME_LEN bytes and stack-based buffers assumes
// that escaped name will be not longer than NAME_LEN*2 + 2 bytes long.
int argument;
for (argument= 0; argument < argc; argument++)
{
size_t argument_length= strlen(argv[argument]);
if (argument_length > NAME_LEN)
{
die(EX_CONSCHECK, "[ERROR] Argument '%s' is too long, it cannot be "
"name for any table or database.\n", argv[argument]);
}
}

if (argc > 1 && !opt_databases)
{
/* Only one database and selected table(s) */
if (!opt_alltspcs && !opt_notspcs)
dump_tablespaces_for_tables(*argv, (argv + 1), (argc - 1));
dump_selected_tables(*argv, (argv + 1), (argc - 1));
}
else
{
/* One or more databases, all tables */
if (!opt_alltspcs && !opt_notspcs)
dump_tablespaces_for_databases(argv);
dump_databases(argv);
}
}

/* add 'START SLAVE' to end of dump */
Expand Down
43 changes: 23 additions & 20 deletions cmake/dtrace.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2009, 2014, 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 @@ -80,13 +80,6 @@ IF(ENABLE_DTRACE)
${CMAKE_BINARY_DIR}/include/probes_mysql_dtrace.h
${CMAKE_BINARY_DIR}/include/probes_mysql_nodtrace.h
)
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
# Systemtap object
EXECUTE_PROCESS(
COMMAND ${DTRACE} -G -s ${CMAKE_SOURCE_DIR}/include/probes_mysql.d.base
-o ${CMAKE_BINARY_DIR}/probes_mysql.o
)
ENDIF()
ADD_CUSTOM_TARGET(gen_dtrace_header
DEPENDS
${CMAKE_BINARY_DIR}/include/probes_mysql.d
Expand All @@ -105,12 +98,7 @@ FUNCTION(DTRACE_INSTRUMENT target)
IF(ENABLE_DTRACE)
ADD_DEPENDENCIES(${target} gen_dtrace_header)

IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
TARGET_LINK_LIBRARIES(${target} ${CMAKE_BINARY_DIR}/probes_mysql.o)
ENDIF()

# On Solaris, invoke dtrace -G to generate object file and
# link it together with target.
# Invoke dtrace to generate object file and link it together with target.
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
SET(objdir ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${target}.dir)
SET(outfile ${objdir}/${target}_dtrace.o)
Expand All @@ -127,6 +115,21 @@ FUNCTION(DTRACE_INSTRUMENT target)
-P ${CMAKE_SOURCE_DIR}/cmake/dtrace_prelink.cmake
WORKING_DIRECTORY ${objdir}
)
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
# dtrace on Linux runs gcc and uses flags from environment
SET(CFLAGS_SAVED $ENV{CFLAGS})
SET(ENV{CFLAGS} ${CMAKE_C_FLAGS})
SET(outfile "${CMAKE_BINARY_DIR}/probes_mysql.o")
# Systemtap object
EXECUTE_PROCESS(
COMMAND ${DTRACE} -G -s ${CMAKE_SOURCE_DIR}/include/probes_mysql.d.base
-o ${outfile}
)
SET(ENV{CFLAGS} ${CFLAGS_SAVED})
ENDIF()

# Do not try to extend the library if we have not built the .o file
IF(outfile)
# Add full object path to linker flags
GET_TARGET_PROPERTY(target_type ${target} TYPE)
IF(NOT target_type MATCHES "STATIC")
Expand All @@ -138,12 +141,12 @@ FUNCTION(DTRACE_INSTRUMENT target)
# but maybe one day this will be fixed.
GET_TARGET_PROPERTY(target_location ${target} LOCATION)
ADD_CUSTOM_COMMAND(
TARGET ${target} POST_BUILD
COMMAND ${CMAKE_AR} r ${target_location} ${outfile}
COMMAND ${CMAKE_RANLIB} ${target_location}
)
# Used in DTRACE_INSTRUMENT_WITH_STATIC_LIBS
SET(TARGET_OBJECT_DIRECTORY_${target} ${objdir} CACHE INTERNAL "")
TARGET ${target} POST_BUILD
COMMAND ${CMAKE_AR} r ${target_location} ${outfile}
COMMAND ${CMAKE_RANLIB} ${target_location}
)
# Used in DTRACE_INSTRUMENT_WITH_STATIC_LIBS
SET(TARGET_OBJECT_DIRECTORY_${target} ${objdir} CACHE INTERNAL "")
ENDIF()
ENDIF()
ENDIF()
Expand Down
4 changes: 3 additions & 1 deletion cmake/install_macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ FUNCTION (INSTALL_DEBUG_SYMBOLS)
STRING(REPLACE ".dll" ".pdb" pdb_location ${pdb_location})
STRING(REPLACE ".lib" ".pdb" pdb_location ${pdb_location})
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" pdb_location ${pdb_location})
STRING(REPLACE
"${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}"
pdb_location ${pdb_location})
ENDIF()

set(comp "")
Expand Down
29 changes: 18 additions & 11 deletions cmake/os/Windows.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2010, 2014, 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 @@ -62,22 +62,30 @@ IF(MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4)
ENDIF()

IF(MSVC)
# Enable debug info also in Release build, and create PDB to be able to analyze
# crashes
FOREACH(lang C CXX)
SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Zi")
ENDFOREACH()
# Enable debug info also in Release build,
# and create PDB to be able to analyze crashes.
FOREACH(type EXE SHARED MODULE)
SET(CMAKE_{type}_LINKER_FLAGS_RELEASE "${CMAKE_${type}_LINKER_FLAGS_RELEASE} /debug")
SET(CMAKE_{type}_LINKER_FLAGS_RELEASE
"${CMAKE_${type}_LINKER_FLAGS_RELEASE} /debug")
ENDFOREACH()

# Force static runtime libraries
# - Choose debugging information:
# /Z7
# Produces an .obj file containing full symbolic debugging
# information for use with the debugger. The symbolic debugging
# information includes the names and types of variables, as well as
# functions and line numbers. No .pdb file is produced by the compiler.
FOREACH(lang C CXX)
SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Z7")
ENDFOREACH()
FOREACH(flag
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT)
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT)
STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}")
STRING(REPLACE "/Zi" "/Z7" "${flag}" "${${flag}}")
ENDFOREACH()

# Remove support for exceptions
Expand Down Expand Up @@ -109,7 +117,6 @@ IF(MSVC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /we4099")


IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
# _WIN64 is defined by the compiler itself.
# Yet, we define it here again to work around a bug with Intellisense
Expand Down
3 changes: 1 addition & 2 deletions extra/yassl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2006, 2014, 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 @@ -37,7 +37,6 @@ ENDIF()
ADD_CONVENIENCE_LIBRARY(yassl ${YASSL_SOURCES})
RESTRICT_SYMBOL_EXPORTS(yassl)

INSTALL_DEBUG_SYMBOLS(yassl)
IF(MSVC)
INSTALL_DEBUG_TARGET(yassl DESTINATION ${INSTALL_LIBDIR}/debug)
ENDIF()
Expand Down
7 changes: 5 additions & 2 deletions extra/yassl/src/ssl.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2005, 2014, 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 @@ -790,7 +790,10 @@ int SSL_CTX_load_verify_locations(SSL_CTX* ctx, const char* file,
strncpy(name, path, MAX_PATH - 1 - HALF_PATH);
strncat(name, "/", 1);
strncat(name, entry->d_name, HALF_PATH);
if (stat(name, &buf) < 0) return SSL_BAD_STAT;
if (stat(name, &buf) < 0) {
closedir(dir);
return SSL_BAD_STAT;
}

if (S_ISREG(buf.st_mode))
ret = read_file(ctx, name, SSL_FILETYPE_PEM, CA);
Expand Down
3 changes: 1 addition & 2 deletions extra/yassl/taocrypt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2006, 2014, 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 @@ -36,7 +36,6 @@ ENDIF()
ADD_CONVENIENCE_LIBRARY(taocrypt ${TAOCRYPT_SOURCES})
RESTRICT_SYMBOL_EXPORTS(taocrypt)

INSTALL_DEBUG_SYMBOLS(taocrypt)
IF(MSVC)
INSTALL_DEBUG_TARGET(taocrypt DESTINATION ${INSTALL_LIBDIR}/debug)
ENDIF()
Expand Down
8 changes: 4 additions & 4 deletions extra/yassl/taocrypt/include/asn.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2005, 2014, 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 @@ -294,9 +294,9 @@ class CertDecoder : public BER_Decoder {
byte* signature_;
char issuer_[ASN_NAME_MAX]; // Names
char subject_[ASN_NAME_MAX]; // Names
char beforeDate_[MAX_DATE_SZ]; // valid before date
char afterDate_[MAX_DATE_SZ]; // valid after date
bool verify_; // Default to yes, but could be off
char beforeDate_[MAX_DATE_SZ+1]; // valid before date, +null term
char afterDate_[MAX_DATE_SZ+1]; // valid after date, +null term
bool verify_; // Default to yes, but could be off

void ReadHeader();
void Decode(SignerList*, CertType);
Expand Down

0 comments on commit 1c6ad62

Please sign in to comment.