Skip to content

Commit 467af40

Browse files
committed
merge from 5.5.16
2 parents eb38e88 + d10bddf commit 467af40

Some content is hidden

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

71 files changed

+900
-351
lines changed

client/mysql_plugin.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -846,12 +846,19 @@ static int process_options(int argc, char *argv[], char *operation)
846846
{
847847
i= (int)strlength(opt_basedir);
848848
if (opt_basedir[i-1] != FN_LIBCHAR || opt_basedir[i-1] != FN_LIBCHAR2)
849+
{
850+
char buff[FN_REFLEN];
851+
852+
strncpy(buff, opt_basedir, sizeof(buff) - 1);
849853
#ifdef __WIN__
850-
if (opt_basedir[i-1] != '/')
851-
strcat(opt_basedir, "//");
854+
strncat(buff, "/", sizeof(buff) - strlen(buff) - 1);
852855
#else
853-
strcat(opt_basedir, FN_DIRSEP);
856+
strncat(buff, FN_DIRSEP, sizeof(buff) - strlen(buff) - 1);
854857
#endif
858+
buff[sizeof(buff) - 1]= 0;
859+
my_delete(opt_basedir, MYF(0));
860+
opt_basedir= my_strdup(buff, MYF(MY_FAE));
861+
}
855862
}
856863

857864
/*
@@ -1157,10 +1164,13 @@ static int bootstrap_server(char *server_path, char *bootstrap_file)
11571164

11581165
#ifdef __WIN__
11591166
char *format_str= 0;
1160-
char *verbose_str= "";
1167+
const char *verbose_str= NULL;
1168+
11611169

11621170
if (opt_verbose)
1163-
strcat(verbose_str, "--console");
1171+
verbose_str= "--console";
1172+
else
1173+
verbose_str= "";
11641174
if (has_spaces(opt_datadir) || has_spaces(opt_basedir) ||
11651175
has_spaces(bootstrap_file))
11661176
format_str= "\"%s %s --bootstrap --datadir=%s --basedir=%s < %s\"";

cmake/plugin.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ MACRO(MYSQL_ADD_PLUGIN)
196196
# Install dynamic library
197197
MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_PLUGINDIR} COMPONENT Server)
198198
INSTALL_DEBUG_TARGET(${target} DESTINATION ${INSTALL_PLUGINDIR}/debug)
199+
# Add installed files to list for RPMs
200+
FILE(APPEND ${CMAKE_BINARY_DIR}/support-files/plugins.files
201+
"%attr(755, root, root) %{_prefix}/${INSTALL_PLUGINDIR}/${ARG_MODULE_OUTPUT_NAME}.so\n"
202+
"%attr(755, root, root) %{_prefix}/${INSTALL_PLUGINDIR}/debug/${ARG_MODULE_OUTPUT_NAME}.so\n")
199203
# For internal testing in PB2, append collections files
200204
IF(DEFINED ENV{PB2WORKDIR})
201205
PLUGIN_APPEND_COLLECTIONS(${plugin})

include/mysql/plugin.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ typedef struct st_mysql_xid MYSQL_XID;
7373
Plugin API. Common for all plugin types.
7474
*/
7575

76-
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0102
76+
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0103
7777

7878
/*
7979
The allowable types of plugins
@@ -122,7 +122,7 @@ __MYSQL_DECLARE_PLUGIN(NAME, \
122122
builtin_ ## NAME ## _sizeof_struct_st_plugin, \
123123
builtin_ ## NAME ## _plugin)
124124

125-
#define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0,0}}
125+
#define mysql_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0,0,0,0}}
126126

127127
/**
128128
declarations for SHOW STATUS support in plugins
@@ -148,6 +148,14 @@ struct st_mysql_show_var {
148148
typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, char *);
149149

150150

151+
/*
152+
Constants for plugin flags.
153+
*/
154+
155+
#define PLUGIN_OPT_NO_INSTALL 1UL /* Not dynamically loadable */
156+
#define PLUGIN_OPT_NO_UNINSTALL 2UL /* Not dynamically unloadable */
157+
158+
151159
/*
152160
declarations for server variables and command line options
153161
*/
@@ -420,6 +428,7 @@ struct st_mysql_plugin
420428
struct st_mysql_show_var *status_vars;
421429
struct st_mysql_sys_var **system_vars;
422430
void * __reserved1; /* reserved for dependency checking */
431+
unsigned long flags; /* flags for plugin */
423432
};
424433

425434
/*************************************************************************

include/mysql/plugin_audit.h.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
struct st_mysql_show_var *status_vars;
119119
struct st_mysql_sys_var **system_vars;
120120
void * __reserved1;
121+
unsigned long flags;
121122
};
122123
#include "plugin_ftparser.h"
123124
#include "plugin.h"

include/mysql/plugin_auth.h.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
struct st_mysql_show_var *status_vars;
119119
struct st_mysql_sys_var **system_vars;
120120
void * __reserved1;
121+
unsigned long flags;
121122
};
122123
#include "plugin_ftparser.h"
123124
#include "plugin.h"

include/mysql/plugin_ftparser.h.pp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
THD_WAIT_BINLOG= 8,
4545
THD_WAIT_GROUP_COMMIT= 9,
4646
THD_WAIT_SYNC= 10,
47-
THD_WAIT_LAST= 11
47+
THD_WAIT_LAST= 11
4848
} thd_wait_type;
4949
extern struct thd_wait_service_st {
5050
void (*thd_wait_begin_func)(void*, int);
@@ -118,6 +118,7 @@
118118
struct st_mysql_show_var *status_vars;
119119
struct st_mysql_sys_var **system_vars;
120120
void * __reserved1;
121+
unsigned long flags;
121122
};
122123
#include "plugin_ftparser.h"
123124
struct st_mysql_daemon

libmysql/authentication_win/common.cc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,24 @@ template <> void error_log_print<error_log_level::INFO>(const char *fmt, ...);
2222
template <> void error_log_print<error_log_level::WARNING>(const char *fmt, ...);
2323
template <> void error_log_print<error_log_level::ERROR>(const char *fmt, ...);
2424

25+
/**
26+
Option indicating desired level of logging. Values:
27+
28+
0 - no logging
29+
1 - log only error messages
30+
2 - additionally log warnings
31+
3 - additionally log info notes
32+
4 - also log debug messages
33+
34+
Value of this option should be taken into account in the
35+
implementation of error_log_vprint() function (see
36+
log_client.cc).
37+
38+
Note: No error or debug messages are logged in production code
39+
(see logging macros in common.h).
40+
*/
41+
int opt_auth_win_log_level= 2;
42+
2543

2644
/** Connection class **************************************************/
2745

libmysql/authentication_win/common.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,15 @@ struct error_log_level
4141
typedef enum {INFO, WARNING, ERROR} type;
4242
};
4343

44+
extern "C" int opt_auth_win_log_level;
45+
unsigned int get_log_level(void);
46+
void set_log_level(unsigned int);
47+
4448

4549
/*
4650
If DEBUG_ERROR_LOG is defined then error logging happens only
4751
in debug-copiled code. Otherwise ERROR_LOG() expands to
48-
error_log_print() even in production code. Note that in client
49-
plugin, error_log_print() will print nothing if opt_auth_win_clinet_log
50-
is 0.
52+
error_log_print() even in production code.
5153
5254
Note: Macro ERROR_LOG() can use printf-like format string like this:
5355
@@ -57,8 +59,6 @@ struct error_log_level
5759
to fprintf() (see error_log_vprint() function).
5860
*/
5961

60-
extern "C" int opt_auth_win_client_log;
61-
6262
#if defined(DEBUG_ERROR_LOG) && defined(DBUG_OFF)
6363
#define ERROR_LOG(Level, Msg) do {} while (0)
6464
#else
@@ -67,7 +67,7 @@ extern "C" int opt_auth_win_client_log;
6767

6868

6969
void error_log_vprint(error_log_level::type level,
70-
const char *fmt, va_list args);
70+
const char *fmt, va_list args);
7171

7272
template <error_log_level::type Level>
7373
void error_log_print(const char *fmt, ...)
@@ -96,7 +96,7 @@ const char* get_last_error_message(Error_message_buf);
9696

9797
#define DBUG_PRINT_DO(Keyword, Msg) \
9898
do { \
99-
if (2 > opt_auth_win_client_log) break; \
99+
if (4 > get_log_level()) break; \
100100
fprintf(stderr, "winauth: %s: ", Keyword); \
101101
debug_msg Msg; \
102102
} while (0)

libmysql/authentication_win/handshake_client.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,13 +323,13 @@ int win_auth_handshake_client(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
323323
int opt_val= opt ? atoi(opt) : 0;
324324
if (opt && !opt_val)
325325
{
326-
if (!strncasecmp("on", opt, 2)) opt_val= 1;
327-
if (!strncasecmp("yes", opt, 3)) opt_val= 1;
328-
if (!strncasecmp("true", opt, 4)) opt_val= 1;
329-
if (!strncasecmp("debug", opt, 5)) opt_val= 2;
330-
if (!strncasecmp("dbug", opt, 4)) opt_val= 2;
326+
if (!strncasecmp("on", opt, 2)) opt_val= 2;
327+
if (!strncasecmp("yes", opt, 3)) opt_val= 2;
328+
if (!strncasecmp("true", opt, 4)) opt_val= 2;
329+
if (!strncasecmp("debug", opt, 5)) opt_val= 4;
330+
if (!strncasecmp("dbug", opt, 4)) opt_val= 4;
331331
}
332-
opt_auth_win_client_log= opt_val;
332+
set_log_level(opt_val);
333333
}
334334

335335
ERROR_LOG(INFO, ("Authentication handshake for account %s", mysql->user));

libmysql/authentication_win/log_client.cc

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,50 @@
1616
#include <my_global.h>
1717
#include "common.h"
1818

19-
/**
20-
This option is set in win_auth_handshake_client() function
21-
in handshake_client.cc.
22-
23-
Values:
24-
0 - no logging
25-
1 - log error/warning/info messages
26-
2 - also log debug messages
27-
28-
Note: No error or debug messages are logged in production code
29-
(see logging macros in common.h).
30-
*/
31-
int opt_auth_win_client_log= 0;
32-
3319

3420
// Client-side logging function
3521

3622
void error_log_vprint(error_log_level::type level,
3723
const char *fmt, va_list args)
3824
{
39-
if (0 == opt_auth_win_client_log)
40-
return;
41-
4225
const char *level_string= "";
26+
int log_level= get_log_level();
4327

4428
switch (level)
4529
{
46-
case error_log_level::INFO: level_string= "Note"; break;
47-
case error_log_level::WARNING: level_string= "Warning"; break;
48-
case error_log_level::ERROR: level_string= "ERROR"; break;
30+
case error_log_level::INFO:
31+
if (3 > log_level)
32+
return;
33+
level_string= "Note";
34+
break;
35+
case error_log_level::WARNING:
36+
if (2 > log_level)
37+
return;
38+
level_string= "Warning";
39+
break;
40+
case error_log_level::ERROR:
41+
if (1 > log_level)
42+
return;
43+
level_string= "ERROR";
44+
break;
4945
}
5046

5147
fprintf(stderr, "Windows Authentication Plugin %s: ", level_string);
5248
vfprintf(stderr, fmt, args);
5349
fputc('\n', stderr);
5450
fflush(stderr);
5551
}
52+
53+
54+
// Trivial implementation of log-level setting storage.
55+
56+
void set_log_level(unsigned int level)
57+
{
58+
opt_auth_win_log_level= level;
59+
}
60+
61+
62+
unsigned int get_log_level(void)
63+
{
64+
return opt_auth_win_log_level;
65+
}

mysql-test/include/order_by.inc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,6 +1706,13 @@ SELECT DISTINCT a,1 FROM t1 WHERE a <> 1 ORDER BY a DESC;
17061706

17071707
DROP TABLE t1;
17081708

1709+
--echo #
1710+
--echo # Bug#11765255 58201:
1711+
--echo # VALGRIND/CRASH WHEN ORDERING BY MULTIPLE AGGREGATE FUNCTIONS
1712+
--echo #
1713+
1714+
select 1 order by max(1) + min(1);
1715+
17091716
--echo End of 5.1 tests
17101717

17111718

mysql-test/mysql-test-run.pl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,9 @@ sub main {
452452
#
453453
read_plugin_defs("include/plugin.defs");
454454

455-
# Also read from any plugin local plugin.defs
456-
for (glob "$basedir/plugin/*/tests/mtr/plugin.defs") {
455+
# Also read from any plugin local or suite specific plugin.defs
456+
for (glob "$basedir/plugin/*/tests/mtr/plugin.defs".
457+
" suite/*/plugin.defs") {
457458
read_plugin_defs($_);
458459
}
459460

mysql-test/r/ctype_errors.result

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,14 @@ SET lc_messages=cs_CZ;
2929
SET NAMES UTF8;
3030
USE nonexistant;
3131
ERROR 42000: Nezn-Bámá databáze 'nonexistant'
32-
End of 5.4 tests
32+
#
33+
# Bug#12736295: Buffer overflow for variable converted_err
34+
# with non-latin1 server error message
35+
#
36+
# Connection con1
37+
SET lc_messages=ru_RU;
38+
SET NAMES latin1;
39+
SELECT '01234567890123456789012345678901234\';
40+
ERROR 42000: \0423 \0432\0430\0441 \043E\0448\0438\0431\043A\0430 \0432 \0437\0430\043F\0440\043E\0441\0435. \0418\0437\0443\0447\0438\0442\0435 \0434\043E\043A\0443\043C\0435\043D\0442\0430\0446\0438\044E \043F\043E \0438\0441\043F\043E\043B\044C\0437\0443\0435\043C\043E\0439 \0432\0435\0440\0441\0438\0438 MySQL \043D\0430 \043F\0440\0435\0434\043C\0435\0442 \043A\043E\0440\0440\0435\043A\0442\043D\043E\0433\043E \0441\0438\043D\0442\0430\043A\0441\0438\0441\0430 \043E\043A\043E\043B\043E ''012345678901234567890123456
41+
# Connection default
42+
End of 5.5 tests

mysql-test/r/ctype_utf32_uca.result

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2887,6 +2887,26 @@ HEX(s1)
28872887
00000061
28882888
DROP TABLE t1;
28892889
#
2890+
# Bug #12319710 : INVALID MEMORY READ AND/OR CRASH IN
2891+
# MY_UCA_CHARCMP WITH UTF32
2892+
#
2893+
SET collation_connection=utf32_unicode_ci;
2894+
CREATE TABLE t1 (a TEXT CHARACTER SET utf32 COLLATE utf32_turkish_ci NOT NULL);
2895+
INSERT INTO t1 VALUES ('a'), ('b');
2896+
CREATE TABLE t2 (b VARBINARY(5) NOT NULL);
2897+
#insert chars outside of BMP
2898+
INSERT INTO t2 VALUEs (0x082837),(0x082837);
2899+
#test for read-out-of-bounds with non-BMP chars as a LIKE pattern
2900+
SELECT * FROM t1,t2 WHERE a LIKE b;
2901+
a b
2902+
#test the original statement
2903+
SELECT 1 FROM t1 AS t1_0 NATURAL LEFT OUTER JOIN t2 AS t2_0
2904+
RIGHT JOIN t1 AS t1_1 ON t1_0.a LIKE t2_0.b;
2905+
1
2906+
1
2907+
1
2908+
DROP TABLE t1,t2;
2909+
#
28902910
# End of 5.5 tests
28912911
#
28922912
#

mysql-test/r/order_by_all.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2550,6 +2550,13 @@ a 1
25502550
3 1
25512551
2 1
25522552
DROP TABLE t1;
2553+
#
2554+
# Bug#11765255 58201:
2555+
# VALGRIND/CRASH WHEN ORDERING BY MULTIPLE AGGREGATE FUNCTIONS
2556+
#
2557+
select 1 order by max(1) + min(1);
2558+
1
2559+
1
25532560
End of 5.1 tests
25542561
#
25552562
# Bug #38745: MySQL 5.1 optimizer uses filesort for ORDER BY

0 commit comments

Comments
 (0)