Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Barkov committed Feb 27, 2017
2 parents 3f83801 + 78153cf commit 47b7ffb
Show file tree
Hide file tree
Showing 1,208 changed files with 38,883 additions and 22,590 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -51,6 +51,7 @@ extra/jemalloc/build/
extra/jemalloc/tmp/
extra/my_print_defaults
extra/mysql_waitpid
extra/mysqld_safe_helper
extra/perror
extra/replace
extra/resolve_stack_dump
Expand Down Expand Up @@ -224,6 +225,7 @@ support-files/mysql.spec
support-files/mysqld_multi.server
support-files/wsrep.cnf
support-files/wsrep_notify
support-files/policy/selinux/mysqld-safe.pp
tags
tests/async_queries
tests/bug25714
Expand Down
2 changes: 1 addition & 1 deletion VERSION
@@ -1,3 +1,3 @@
MYSQL_VERSION_MAJOR=10
MYSQL_VERSION_MINOR=2
MYSQL_VERSION_PATCH=4
MYSQL_VERSION_PATCH=5
6 changes: 4 additions & 2 deletions client/mysqladmin.cc
Expand Up @@ -1571,8 +1571,10 @@ static my_bool get_pidfile(MYSQL *mysql, char *pidfile)

if (mysql_query(mysql, "SHOW VARIABLES LIKE 'pid_file'"))
{
my_printf_error(0, "query failed; error: '%s'", error_flags,
mysql_error(mysql));
my_printf_error(mysql_errno(mysql),
"The query to get the server's pid file failed,"
" error: '%s'. Continuing.", error_flags,
mysql_error(mysql));
}
result = mysql_store_result(mysql);
if (result)
Expand Down
4 changes: 2 additions & 2 deletions cmake/for_clients.cmake
Expand Up @@ -45,10 +45,10 @@ MACRO(EXTRACT_LINK_LIBRARIES target var)
ENDIF()
ENDMACRO()

EXTRACT_LINK_LIBRARIES(mysqlclient LIBS)
EXTRACT_LINK_LIBRARIES(mariadb LIBS)
EXTRACT_LINK_LIBRARIES(mysqlserver EMB_LIBS)

SET(LIBS "-lmysqlclient ${ZLIB_DEPS} ${LIBS} ${openssl_libs}")
SET(LIBS "-lmariadb ${ZLIB_DEPS} ${LIBS} ${openssl_libs}")
SET(EMB_LIBS "-lmysqld ${ZLIB_DEPS} ${EMB_LIBS} ${openssl_libs}")

MACRO(REPLACE_FOR_CLIENTS VAR)
Expand Down
1 change: 1 addition & 0 deletions debian/mariadb-server-10.2.install
Expand Up @@ -27,6 +27,7 @@ usr/bin/mysql_tzinfo_to_sql
usr/bin/mysqlbinlog
usr/bin/mysqld_multi
usr/bin/mysqld_safe
usr/bin/mysqld_safe_helper
usr/bin/mysqlhotcopy
usr/bin/perror
usr/bin/replace
Expand Down
2 changes: 1 addition & 1 deletion debian/mariadb-server-10.2.preinst
Expand Up @@ -50,7 +50,7 @@ stop_server() {
################################ main() ##########################

this_version=10.2
max_upgradeable_version=5.6
max_upgradeable_version=5.7

# Check if a flag file is found that indicates a previous MariaDB or MySQL
# version was installed. If multiple flags are found, check which one was
Expand Down
Expand Up @@ -8,8 +8,8 @@
## DP: http://bugs.mysql.com/bug.php?id=6901

@DPATCH@
--- old/scripts/mysql_system_tables_data.sql 2008-12-04 22:59:44.000000000 +0100
+++ new/scripts/mysql_system_tables_data.sql 2008-12-04 23:00:07.000000000 +0100
--- a/scripts/mysql_system_tables_data.sql
+++ b/scripts/mysql_system_tables_data.sql
@@ -26,16 +26,6 @@
-- a plain character
SELECT LOWER( REPLACE((SELECT REPLACE(@@hostname,'_','\_')),'%','\%') )INTO @current_hostname;
Expand All @@ -26,14 +26,14 @@
-
-- Fill "user" table with default users allowing root access
-- from local machine if "user" table didn't exist before
CREATE TEMPORARY TABLE tmp_user LIKE user;
@@ -43,8 +33,6 @@ INSERT INTO tmp_user VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','
REPLACE INTO tmp_user SELECT @current_hostname,'root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N','',0 FROM dual WHERE @current_hostname != 'localhost';
REPLACE INTO tmp_user VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N','',0);
REPLACE INTO tmp_user VALUES ('::1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N', '', 0);
-INSERT INTO tmp_user (host,user) VALUES ('localhost','');
-INSERT INTO tmp_user (host,user) SELECT @current_hostname,'' FROM dual WHERE @current_hostname != 'localhost';
INSERT INTO user SELECT * FROM tmp_user WHERE @had_user_table=0;
DROP TABLE tmp_user;
CREATE TEMPORARY TABLE tmp_user_nopasswd LIKE user;
@@ -48,9 +38,6 @@ REPLACE INTO tmp_user_nopasswd VALUES ('127.0.0.1','root','','Y','Y','Y','Y','Y'
REPLACE INTO tmp_user_nopasswd VALUES ('::1','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'','','N','N', '', 0);
-- More secure root account using unix sucket auth.
INSERT INTO tmp_user_socket VALUES ('localhost',IFNULL(@auth_root_socket, 'root'),'','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0,'unix_socket','','N', 'N','', 0);
--- Anonymous user with no privileges.
-INSERT INTO tmp_user_anonymous (host,user) VALUES ('localhost','');
-INSERT INTO tmp_user_anonymous (host,user) SELECT @current_hostname,'' FROM dual WHERE @current_hostname != 'localhost';

INSERT INTO user SELECT * FROM tmp_user_nopasswd WHERE @had_user_table=0 AND @skip_auth_root_nopasswd IS NULL;
INSERT INTO user SELECT * FROM tmp_user_socket WHERE @had_user_table=0 AND @auth_root_socket IS NOT NULL;
3 changes: 3 additions & 0 deletions extra/CMakeLists.txt
Expand Up @@ -98,4 +98,7 @@ IF(UNIX)

MYSQL_ADD_EXECUTABLE(mysql_waitpid mysql_waitpid.c COMPONENT Client)
TARGET_LINK_LIBRARIES(mysql_waitpid mysys)

MYSQL_ADD_EXECUTABLE(mysqld_safe_helper mysqld_safe_helper.c COMPONENT Server)
TARGET_LINK_LIBRARIES(mysqld_safe_helper mysys)
ENDIF()
77 changes: 77 additions & 0 deletions extra/mysqld_safe_helper.c
@@ -0,0 +1,77 @@
#include <my_global.h>
#include <m_string.h>
#include <my_sys.h>
#include <my_pthread.h>
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
#include <stdlib.h>
#include <stdio.h>

void my_exit(int c)
{
my_end(0);
exit(c);
}

void do_usage()
{
printf("Usage:\n"
" %s <user> log <filename>\n"
" %s <user> exec <command> <args>\n",
my_progname, my_progname);
my_exit(1);
}

void do_log(const char *logfile)
{
FILE *f;
uchar buf[4096];
int size;

if (!logfile)
do_usage();

f= my_fopen(logfile, O_WRONLY|O_APPEND|O_CREAT, MYF(MY_WME));
if (!f)
my_exit(1);

while ((size= my_fread(stdin, buf, sizeof(buf), MYF(MY_WME))) > 0)
if ((int)my_fwrite(f, buf, size, MYF(MY_WME)) != size)
my_exit(1);

my_fclose(f, MYF(0));
my_exit(0);
}

void do_exec(char *args[])
{
if (!args[0])
do_usage();

my_end(0);
execvp(args[0], args);
}

int main(int argc, char *argv[])
{
struct passwd *user_info;
MY_INIT(argv[0]);

if (argc < 3)
do_usage(argv[0]);

user_info= my_check_user(argv[1], MYF(0));
if (user_info ? my_set_user(argv[1], user_info, MYF(MY_WME))
: my_errno == EINVAL)
my_exit(1);

if (strcmp(argv[2], "log") == 0)
do_log(argv[3]);

if (strcmp(argv[2], "exec") == 0)
do_exec(argv+3);

my_end(0);
return 1;
}
7 changes: 6 additions & 1 deletion include/json_lib.h
Expand Up @@ -409,7 +409,12 @@ int json_get_path_start(json_engine_t *je, CHARSET_INFO *i_cs,
int json_get_path_next(json_engine_t *je, json_path_t *p);


int json_path_compare(const json_path_t *a, const json_path_t *b);
int json_path_parts_compare(
const json_path_step_t *a, const json_path_step_t *a_end,
const json_path_step_t *b, const json_path_step_t *b_end,
enum json_value_types vt);
int json_path_compare(const json_path_t *a, const json_path_t *b,
enum json_value_types vt);


#ifdef __cplusplus
Expand Down
4 changes: 4 additions & 0 deletions include/my_sys.h
Expand Up @@ -678,8 +678,12 @@ extern void *my_memmem(const void *haystack, size_t haystacklen,

#ifdef _WIN32
extern int my_access(const char *path, int amode);
#define my_check_user(A,B) (NULL)
#define my_set_user(A,B,C) (0)
#else
#define my_access access
struct passwd *my_check_user(const char *user, myf MyFlags);
int my_set_user(const char *user, struct passwd *user_info, myf MyFlags);
#endif

extern int check_if_legal_filename(const char *path);
Expand Down
2 changes: 2 additions & 0 deletions include/mysql.h.pp
Expand Up @@ -9,6 +9,8 @@
COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE,
COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE,
COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, COM_DAEMON,
COM_UNIMPLEMENTED,
COM_RESET_CONNECTION,
COM_MDB_GAP_BEG,
COM_MDB_GAP_END=250,
COM_SLAVE_WORKER=251,
Expand Down
2 changes: 2 additions & 0 deletions include/mysql_com.h
Expand Up @@ -111,6 +111,8 @@ enum enum_server_command
COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE,
COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE,
COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, COM_DAEMON,
COM_UNIMPLEMENTED, // COM_BINLOG_DUMP_GTID in MySQL
COM_RESET_CONNECTION,
/* don't forget to update const char *command_name[] in sql_parse.cc */
COM_MDB_GAP_BEG,
COM_MDB_GAP_END=250,
Expand Down
72 changes: 68 additions & 4 deletions man/mysql_secure_installation.1
@@ -1,6 +1,6 @@
'\" t
.\"
.TH "\FBMYSQL_SECURE_INST" "1" "22/3/2016" "MariaDB 10\&.2" "MariaDB Database System"
.TH "\FBMYSQL_SECURE_INST" "1" "3 January 2017" "MariaDB 10\&.2" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
Expand Down Expand Up @@ -71,9 +71,8 @@ test
database, which by default can be accessed by anonymous users\&.
.RE
.PP
Invoke
\fBmysql_secure_installation\fR
without arguments:
can be invoked without arguments:
.sp
.if n \{\
.RS 4
Expand All @@ -86,10 +85,75 @@ shell> \fBmysql_secure_installation\fR
.\}
.PP
The script will prompt you to determine which actions to perform\&.
.PP
\fBmysql_secure_installation\fR
accepts some options:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_secure_installation: basedir option
.\" basedir option: mysql_secure_installation
\fB\-\-basedir=\fR\fB\fIdir_name\fR\fR
.sp
Base directory\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_secure_installation: defaults-extra-file option
.\" defaults-extra-file option: mysql_secure_installation
\fB\-\-defaults\-extra\-file=\fR\fB\fIfile_name\fR\fR
.sp
Additional option file\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_secure_installation: defaults-file option
.\" defaults-file option: mysql_secure_installation
\fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR
.sp
Option file\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
.\" mysql_secure_installation: no-defaults option
.\" no-defaults option: mysql_secure_installation
\fB\-\-no\-defaults\fR
.sp
Don't read any defaults file\&.
.RE
.sp
Other unrecognized options will be passed on to the server\&.
.SH "COPYRIGHT"
.br
.PP
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2015 MariaDB Foundation
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc., 2010-2017 MariaDB Foundation
.PP
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
.PP
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/extra/binlog_tests/binlog.test
Expand Up @@ -272,7 +272,7 @@ create table if not exists t3 like tt1;

--disable_warnings
USE mysql;
INSERT INTO user SET host='localhost', user='@#@', password=password('Just a test');
INSERT IGNORE INTO user SET host='localhost', user='@#@', password=password('Just a test');
UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@';
DELETE FROM user WHERE host='localhost' AND user='@#@';
--enable_warnings
Expand Down
4 changes: 2 additions & 2 deletions mysql-test/extra/binlog_tests/ctype_cp932.test
Expand Up @@ -436,9 +436,9 @@ drop table t2;
#
create table t1 (col1 varchar(1)) character set cp932;
insert into t1 values ('a');
insert into t1 values ('ab');
insert ignore into t1 values ('ab');
select * from t1;
insert into t1 values ('abc');
insert ignore into t1 values ('abc');
select * from t1;
drop table t1;

Expand Down
9 changes: 5 additions & 4 deletions mysql-test/extra/rpl_tests/create_recursive_construct.inc
Expand Up @@ -346,7 +346,7 @@ if ($CRC_RET_stmt_sidef) {
SHOW BINLOG EVENTS;
--die Warnings printed
}
--let $event_type= query_get_value(SHOW BINLOG EVENTS, Event_type, 5)
--let $event_type= query_get_value(SHOW BINLOG EVENTS, Event_type, 6)
# The first event is format_description, the second is Gtid list, the
# third is Binlog_checkpoint, the fourth Gtid, and the fifth should be
# our Query for 'INSERT DELAYED' unsafe_type 3, which is safe after
Expand All @@ -357,12 +357,13 @@ if ($CRC_RET_stmt_sidef) {
SHOW BINLOG EVENTS;
--die Wrong events in binlog.
}
# The first event is format_description, the second is Binlog_checkpoint,
# the third is Query_event('BEGIN'), and the fourth should be our Table_map
# The first event is format_description, the second is Gtid list,
# the third is Binlog_checkpoint, the fourth is Query_event('BEGIN'),
# the fifth is Annotate_rows, and the sixth should be our Table_map
# for unsafe statement.
if (`SELECT $unsafe_type != 3 AND '$event_type' != 'Table_map'`) {
--enable_query_log
--echo ******** Failure! Event number 4 was a '$event_type', not a 'Table_map'. ********
--echo ******** Failure! Event number 6 was a '$event_type', not a 'Table_map'. ********
SHOW BINLOG EVENTS;
--die Wrong events in binlog.
}
Expand Down

0 comments on commit 47b7ffb

Please sign in to comment.