Skip to content

Commit c2484a4

Browse files
author
Ramil Kalimullin
committed
Manual merge from mysql-trunk.
Note: failing i_rpl.rpl_row_max_allowed_packet test.
2 parents 5f658ee + 27fede5 commit c2484a4

105 files changed

Lines changed: 1604 additions & 891 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

client/mysql.cc

100755100644
File mode changed.

client/mysql_config_editor.cc

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@
3131
#include "my_aes.h"
3232
#include "client_priv.h"
3333
#include "my_default.h"
34+
#include "my_default_priv.h"
3435

3536
#define MYSQL_CONFIG_EDITOR_VERSION "1.0"
3637
#define MY_LINE_MAX 4096
3738
/*
3839
Header length for the login file.
39-
4-byte (unused) + MY_LOGIN_KEY_LEN
40+
4-byte (unused) + LOGIN_KEY_LEN
4041
*/
41-
#define MY_LOGIN_HEADER_LEN (4 + MY_LOGIN_KEY_LEN)
42+
#define MY_LOGIN_HEADER_LEN (4 + LOGIN_KEY_LEN)
4243

4344
static int g_fd;
4445

@@ -50,9 +51,10 @@ static size_t file_size;
5051
static char *opt_user= NULL, *opt_password= NULL, *opt_host=NULL,
5152
*opt_login_path= NULL;
5253

53-
static char my_key[MY_LOGIN_KEY_LEN];
54+
static char my_login_file[FN_REFLEN];
55+
static char my_key[LOGIN_KEY_LEN];
5456

55-
static my_bool opt_verbose, opt_all, tty_password= 0;
57+
static my_bool opt_verbose, opt_all, tty_password= 0, opt_warn;
5658

5759
int execute_commands(int argc, char **argv);
5860
static void print_login_path(DYNAMIC_STRING *file_buf, const char *path_name);
@@ -125,6 +127,9 @@ static struct my_option my_long_options[] =
125127
&opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
126128
{"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
127129
NO_ARG, 0, 0, 0, 0, 0, 0},
130+
{"warn", 'w', "Warn and ask for confirmation if set command attempts to "
131+
"overwrite an existing login path (enabled by default).",
132+
&opt_warn, &opt_warn, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
128133
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
129134
};
130135

@@ -135,7 +140,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
135140
{
136141
switch(optid) {
137142
case '#':
138-
DBUG_PUSH(argument ? argument : "d:t:o,/tmp/mysqladmin.trace");
143+
DBUG_PUSH(argument ? argument : "d:t:o,/tmp/mysql_config_editor.trace");
139144
break;
140145
case 'p':
141146
tty_password= 1;
@@ -234,7 +239,22 @@ int execute_commands(int argc, char **argv)
234239

235240
dynstr_append(&path_buf, "\n");
236241

237-
/* Check and remove opt_login_path if it already exists. */
242+
/* Warn if login path already exists */
243+
if (opt_warn && ((locate_login_path (&file_buf, opt_login_path))
244+
!= NULL))
245+
{
246+
int choice;
247+
printf ("WARNING : \'%s\' path already exists and will be "
248+
"overwritten. \n Continue? (Press y|Y for Yes, any "
249+
"other key for No) : ",
250+
opt_login_path);
251+
choice= getchar();
252+
253+
if (choice != (int) 'y' && choice != (int) 'Y')
254+
break; /* skip */
255+
}
256+
257+
/* Remove the login path. */
238258
remove_login_path(&file_buf, opt_login_path);
239259

240260
/* Append the new login path to the file buffer. */
@@ -329,7 +349,7 @@ static my_bool check_and_create_login_file(void)
329349
const ushort create_mode_all= (S_IRWXU | S_IRWXG | S_IRWXO);
330350

331351
/* Get the login file name. */
332-
if (! set_login_file_name())
352+
if (! my_default_get_login_file(my_login_file, sizeof(my_login_file)))
333353
{
334354
verbose_msg("Error! Failed to set login file name.\n");
335355
goto error;
@@ -808,7 +828,7 @@ static int encrypt_buffer(const char *plain, int plain_len, char cipher[])
808828

809829
aes_len= my_aes_get_size(plain_len);
810830

811-
if (my_aes_encrypt(plain, plain_len, cipher, my_key, MY_LOGIN_KEY_LEN) == aes_len)
831+
if (my_aes_encrypt(plain, plain_len, cipher, my_key, LOGIN_KEY_LEN) == aes_len)
812832
{
813833
DBUG_RETURN(aes_len);
814834
}
@@ -837,7 +857,7 @@ static int decrypt_buffer(const char *cipher, int cipher_len, char plain[])
837857
int aes_length;
838858

839859
if ((aes_length= my_aes_decrypt(cipher, cipher_len, (char *) plain,
840-
my_key, MY_LOGIN_KEY_LEN)) > 0)
860+
my_key, LOGIN_KEY_LEN)) > 0)
841861
{
842862
DBUG_RETURN(aes_length);
843863
}
@@ -873,8 +893,8 @@ int add_header(void)
873893
}
874894

875895
/* Write the login key. */
876-
if ((my_write(g_fd, (const uchar *)my_key, MY_LOGIN_KEY_LEN, MYF(MY_WME)))
877-
!= MY_LOGIN_KEY_LEN)
896+
if ((my_write(g_fd, (const uchar *)my_key, LOGIN_KEY_LEN, MYF(MY_WME)))
897+
!= LOGIN_KEY_LEN)
878898
{
879899
verbose_msg("Error! couldn't write to the file.\n");
880900
goto error;
@@ -899,7 +919,7 @@ void generate_login_key()
899919

900920
verbose_msg("Generating a new key.\n");
901921
/* Get a sequence of random non-printable ASCII */
902-
for (uint i= 0; i < MY_LOGIN_KEY_LEN; i++)
922+
for (uint i= 0; i < LOGIN_KEY_LEN; i++)
903923
my_key[i]= (char)((int)(my_rnd_ssl(&rnd) * 100000) % 32);
904924

905925
DBUG_VOID_RETURN;
@@ -921,8 +941,8 @@ int read_login_key(void)
921941
if (my_seek(g_fd, 4, SEEK_SET, MYF(MY_WME)) != 4)
922942
DBUG_RETURN(-1); /* Error while seeking. */
923943

924-
if (my_read(g_fd, (uchar *)my_key, MY_LOGIN_KEY_LEN, MYF(MY_WME))
925-
!= MY_LOGIN_KEY_LEN)
944+
if (my_read(g_fd, (uchar *)my_key, LOGIN_KEY_LEN, MYF(MY_WME))
945+
!= LOGIN_KEY_LEN)
926946
{
927947
verbose_msg("Failed to read login key.\n");
928948
DBUG_RETURN(-1);

extra/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
INCLUDE_DIRECTORIES(
1717
${CMAKE_SOURCE_DIR}/include
18-
${CMAKE_SOURCE_DIR}/mysys_ssl
1918
${ZLIB_INCLUDE_DIR}
2019
# Following is for perror, in case NDB is compiled in.
2120
${CMAKE_SOURCE_DIR}/storage/ndb/include

extra/my_print_defaults.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232

3333
const char *config_file="my"; /* Default config file */
34+
static char *my_login_path;
3435
uint verbose= 0, opt_defaults_file_used= 0;
3536
const char *default_dbug_option="d:t:o,/tmp/my_print_defaults.trace";
3637

include/my_default.h

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
2+
3+
This program is free software; you can redistribute it and/or modify
4+
it under the terms of the GNU General Public License as published by
5+
the Free Software Foundation; version 2 of the License.
6+
7+
This program is distributed in the hope that it will be useful,
8+
but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
GNU General Public License for more details.
11+
12+
You should have received a copy of the GNU General Public License
13+
along with this program; if not, write to the Free Software
14+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1307 USA */
15+
16+
#ifndef MY_DEFAULT_INCLUDED
17+
#define MY_DEFAULT_INCLUDED
18+
19+
20+
#include "my_global.h"
21+
22+
C_MODE_START
23+
24+
extern const char *my_defaults_extra_file;
25+
extern const char *my_defaults_group_suffix;
26+
extern const char *my_defaults_file;
27+
extern my_bool my_getopt_use_args_separator;
28+
29+
/* Define the type of function to be passed to process_default_option_files */
30+
typedef int (*Process_option_func)(void *ctx, const char *group_name,
31+
const char *option);
32+
33+
my_bool my_getopt_is_args_separator(const char* arg);
34+
int get_defaults_options(int argc, char **argv,
35+
char **defaults, char **extra_defaults,
36+
char **group_suffix, char **login_path);
37+
int my_load_defaults(const char *conf_file, const char **groups,
38+
int *argc, char ***argv, const char ***);
39+
int load_defaults(const char *conf_file, const char **groups,
40+
int *argc, char ***argv);
41+
int my_search_option_files(const char *conf_file, int *argc,
42+
char ***argv, uint *args_used,
43+
Process_option_func func, void *func_ctx,
44+
const char **default_directories);
45+
void free_defaults(char **argv);
46+
void my_print_default_files(const char *conf_file);
47+
void print_defaults(const char *conf_file, const char **groups);
48+
49+
C_MODE_END
50+
51+
#endif // MY_DEFAULT_INCLUDED

include/my_md5.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
along with this program; if not, write to the Free Software
1717
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
1818

19+
#include "m_string.h"
20+
21+
#define MD5_HASH_SIZE 16 /* Hash size in bytes */
22+
1923
/*
2024
Wrapper function for MD5 implementation.
2125
*/
@@ -25,6 +29,21 @@ extern "C" {
2529

2630
void compute_md5_hash(char *digest, const char *buf, int len);
2731

32+
/*
33+
Convert an array of bytes to a hexadecimal representation.
34+
35+
Used to generate a hexadecimal representation of a message digest.
36+
*/
37+
static inline void array_to_hex(char *to, const unsigned char *str, uint len)
38+
{
39+
const unsigned char *str_end= str + len;
40+
for (; str != str_end; ++str)
41+
{
42+
*to++= _dig_vec_lower[((uchar) *str) >> 4];
43+
*to++= _dig_vec_lower[((uchar) *str) & 0x0F];
44+
}
45+
}
46+
2847
#ifdef __cplusplus
2948
}
3049
#endif

libmysql/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ INCLUDE_DIRECTORIES(
1919
${CMAKE_SOURCE_DIR}/regex
2020
${CMAKE_SOURCE_DIR}/sql
2121
${CMAKE_SOURCE_DIR}/strings
22-
${CMAKE_SOURCE_DIR}/mysys_ssl
2322
${SSL_INCLUDE_DIRS}
2423
${SSL_INTERNAL_INCLUDE_DIRS}
2524
${ZLIB_INCLUDE_DIR})
@@ -162,6 +161,8 @@ IF(HAVE_VISIBILITY_HIDDEN)
162161
PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
163162
SET_SOURCE_FILES_PROPERTIES(../sql/sha1.cc
164163
PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
164+
SET_SOURCE_FILES_PROPERTIES(../sql-common/crypt_genhash_impl.cc
165+
PROPERTIES COMPILE_FLAGS "-fvisibility=hidden")
165166
ENDIF()
166167

167168
ADD_CONVENIENCE_LIBRARY(clientlib ${CLIENT_SOURCES})

libmysqld/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ INCLUDE_DIRECTORIES(
2323
${CMAKE_SOURCE_DIR}/sql
2424
${CMAKE_BINARY_DIR}/sql
2525
${CMAKE_SOURCE_DIR}/regex
26-
${CMAKE_SOURCE_DIR}/mysys_ssl
2726
${ZLIB_INCLUDE_DIR}
2827
${SSL_INCLUDE_DIRS}
2928
${SSL_INTERNAL_INCLUDE_DIRS}

libmysqld/examples/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
1717
${CMAKE_SOURCE_DIR}/libmysqld/include
1818
${CMAKE_SOURCE_DIR}/regex
19-
${CMAKE_SOURCE_DIR}/mysys_ssl
2019
${READLINE_INCLUDE_DIR}
2120
)
2221

mysql-test/collections/default.experimental

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ main.sp-lock @solaris # Bug#11753919 2012-05-22 Hemant Several test cases fai
2222
main.sp-prelocking @solaris # Bug#11753919 2012-05-22 Hemant Several test cases fail on Solaris with error Thread stack overrun
2323
main.sp-fib @solaris # Bug#11753919 2012-05-22 Hemant Several test cases fail on Solaris with error Thread stack overrun
2424

25+
main.innodb_explain_json_non_select_all # Bug#14185642 2012-06-12 Hemant Failing after Olav push for WL#6082
26+
main.innodb_explain_non_select_none # Bug#14185642 2012-06-12 Hemant Failing after Olav push for WL#6082
27+
main.innodb_explain_json_non_select_none # Bug#14185642 2012-06-12 Hemant Failing after Olav push for WL#6082
28+
main.innodb_explain_non_select_all # Bug#14185642 2012-06-12 Hemant Failing after Olav push for WL#6082
29+
opt_trace.bugs_no_prot_all # Bug#14185642 2012-06-12 Hemant Failing after Olav push for WL#6082
30+
2531
innodb.innodb_monitor # Bug#12320827 2011-08-04 Occasional failure in PB2
2632

2733
rpl.rpl_delayed_slave # BUG#11764654 rpl_delayed_slave fails sporadically in pb

0 commit comments

Comments
 (0)