Commit graph

1532 commits

Author SHA1 Message Date
Sergei Golubchik
663068c6ee Merge remote-tracking branch 'mysql/5.5' into 5.5 2017-04-11 10:18:04 -04:00
Bharathy Satish
6fa5e08146 Bug #25717383: MYSQLDUMP MAY EXECUTE ANY ARBITRARY QUERY
While writing comments if database object names has a new
line character, then next line is considered a command, rather
than a comment.
This patch fixes the way comments are constructed in mysqldump.

(cherry picked from commit 1099f9d17b1c697c2760f86556f5bae7d202b444)
2017-03-18 10:12:04 +05:30
Ramil Kalimullin
060b1eadf4 BUG#25575605: SETTING --SSL-MODE=REQUIRED SENDS CREDENTIALS BEFORE VERIFYING SSL CONNECTION
MYSQL_OPT_SSL_MODE option introduced.
It is set in case of --ssl-mode=REQUIRED and permits only SSL connection.

(cherry picked from commit 3b2d28578c526f347f5cfe763681eff365731f99)
2017-03-10 14:11:26 +05:30
Sergei Golubchik
44534487d4 MDEV-11505 wrong databasename in mysqldump comment
fix_for_comment() uses a static buffer. cannot have two
fix_for_comment() calls as arguments to one printf().
2017-02-27 12:35:10 +01:00
Sergei Golubchik
5a43a31ee8 mysqldump: comments and identifiers with new lines
don't let identifiers with new lines to break a comment
2016-10-14 01:12:04 +02:00
Sergei Golubchik
ae29ea2d86 Merge branch 'mysql/5.5' into 5.5 2016-06-14 13:55:28 +02:00
Shishir Jaiswal
9d72fb4af0 Bug#21977380 - POSSIBLE BUFFER OVERFLOW ISSUES
DESCRIPTION
===========
Buffer overflow is reported in a lot of code sections
spanning across server, client programs, Regex libraries
etc. If not handled appropriately, they can cause abnormal
behaviour.

ANALYSIS
========
The reported casea are the ones which are likely to result
in SEGFAULT, MEMORY LEAK etc.

FIX
===
- sprintf() has been replaced by my_snprintf() to avoid
buffer overflow.
- my_free() is done after checking if the pointer isn't
  NULL already and setting it to NULL thereafter at few
  places.
- Buffer is ensured to be large enough to hold the data.
- 'unsigned int' (aka 'uint') is replaced with 'size_t'
to avoid wraparound.
- Memory is freed (if not done so) after its alloced and
used.
- Inserted assert() for size check in InnoDb memcached
code (from 5.6 onwards)
- Other minor changes

(cherry picked from commit 3487e20959c940cbd24429afa795ebfc8a01e94f)
2016-05-16 11:33:57 +02:00
Shishir Jaiswal
cb29741568 Bug#21977380 - POSSIBLE BUFFER OVERFLOW ISSUES
DESCRIPTION
===========
Buffer overflow is reported in a lot of code sections
spanning across server, client programs, Regex libraries
etc. If not handled appropriately, they can cause abnormal
behaviour.

ANALYSIS
========
The reported casea are the ones which are likely to result
in SEGFAULT, MEMORY LEAK etc.

FIX
===
- sprintf() has been replaced by my_snprintf() to avoid
buffer overflow.
- my_free() is done after checking if the pointer isn't
  NULL already and setting it to NULL thereafter at few
  places.
- Buffer is ensured to be large enough to hold the data.
- 'unsigned int' (aka 'uint') is replaced with 'size_t'
to avoid wraparound.
- Memory is freed (if not done so) after its alloced and
used.
- Inserted assert() for size check in InnoDb memcached
code (from 5.6 onwards)
- Other minor changes
2016-05-16 13:46:49 +05:30
Sergei Golubchik
b069d19284 Merge branch 'mysql/5.5' into 5.5 2016-04-20 15:25:55 +02:00
Ramil Kalimullin
b3e9211e48 WL#9072: Backport WL#8785 to 5.5 2016-02-19 23:31:10 +04:00
Sergei Golubchik
1a72c6fefd Merge branch 'bb-5.5-serg' into 5.5 2015-12-09 11:51:59 +01:00
Sergei Golubchik
abf9d35213 Merge branch 'mysql/5.5' into 5.5 2015-12-09 10:00:49 +01:00
Sergey Vojtovich
dac3149f3f MDEV-9001 - [PATCH] Fix DB name quoting in mysqldump --routine
Removed unused variable.
2015-12-08 17:21:07 +04:00
Sergey Vojtovich
9f07c6b383 MDEV-9001 - [PATCH] Fix DB name quoting in mysqldump --routine
mysqldump --routine fails to dump databases containing backslash ("\")
character. This happened because escaped database name was being used as an
identifier while changing current database. Such identifers are not supposed
to be escaped, they must be properly quoted instead.
2015-12-03 16:33:50 +04:00
Arun Kuruvila
a86191c69c Bug #21235226 : THE --ENABLE-CLEARTEXT-PLUGIN IS NOT
IMPLEMENTED IN ALL CLIENT PROGRAMS

Description: Option "enable-cleartext-plugin" is not
available for the following client utilities:-
mysqldump
mysqlimport
mysqlshow
mysqlcheck

Analysis: The unavailability of this option limits the
features like PAM authentication from using the above
mentioned utilities.

Fix: Option "enable-cleartext-plugin" is implemented in the
above mentioned client utilities.
2015-10-14 12:00:39 +05:30
Sergei Golubchik
1c6ad62a26 mysql-5.5.39 merge
~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
2014-08-02 21:26:16 +02:00
Murthy Narkedimilli
a7163ce964 Applying patch for bug 18779944 2014-07-08 11:13:37 +02:00
Marcin Babij
43268d20e7 BUG#18779944: MYSQLDUMP BUFFER OVERFLOW
Mysqldump overflows stack buffer when copying table name from commandline arguments resulting in stack corruption and ability to execute arbitrary code.

Fix: Check length of all positional arguments passed to mysqldump is smaller than NAME_LEN.
Note: Mysqldump heavily depends on that database objects (databases, tablespaces, tables, etc) are limited to small size (now it is 64).
2014-07-02 10:45:22 +02:00
Marcin Babij
cbe72dba5f BUG#18779944: MYSQLDUMP BUFFER OVERFLOW
Reverted change due to mtr test failure.
2014-06-30 12:31:44 +02:00
Marcin Babij
1edfef74a8 BUG#18779944: MYSQLDUMP BUFFER OVERFLOW
Reverted change due to mtr test failure.
2014-06-30 12:31:44 +02:00
Marcin Babij
220c9332bf BUG#18779944: MYSQLDUMP BUFFER OVERFLOW
Mysqldump overflows stack buffer when copying table name from commandline arguments resulting in stack corruption and ability to execute arbitrary code.

Fix: Check length of all positional arguments passed to mysqldump is smaller than NAME_LEN.
Note: Mysqldump heavily depends on that database objects (databases, tablespaces, tables, etc) are limited to small size (now it is 64).
2014-06-27 11:27:27 +02:00
Marcin Babij
3b7f990b13 BUG#18779944: MYSQLDUMP BUFFER OVERFLOW
Mysqldump overflows stack buffer when copying table name from commandline arguments resulting in stack corruption and ability to execute arbitrary code.

Fix: Check length of all positional arguments passed to mysqldump is smaller than NAME_LEN.
Note: Mysqldump heavily depends on that database objects (databases, tablespaces, tables, etc) are limited to small size (now it is 64).
2014-06-27 11:27:27 +02:00
unknown
5f7c296912 MDEV-6343: Incorrect error handling in mysqldump
Fix an error case where success was returned instead of error.
2014-06-17 09:44:19 +02:00
Sergei Golubchik
a313864814 MDEV-6056 [PATCH] mysqldump writes usage to stdout even when not explicitly requested 2014-05-05 14:24:25 +02:00
Sergei Golubchik
ddc960db4b MDEV-6091 mysqldump goes in a loop and segfaults if --dump-slave is specified and it cannot connect to the server
do_start_slave_sql() is called from maybe_exit().
We should not recurse when maybe_exit() is called for an error during do_start_slave_sql().
Also remove a meaningless (but safe) "goto err".
2014-05-01 15:43:51 +02:00
Sergey Petrunya
bc96ce5509 MDEV-5723: mysqldump -uroot unusable for multi-database operations, checks all databases
- MariaDB-5.5 part of the fix: since we can't easily fix query optimization for I_S tables, 
  run the affected-tablespaces query with semijoin=off. It happens to have a good query plan
  with that setting.
2014-03-04 16:15:58 +04:00
Sergei Golubchik
ff2e82f4a1 5.3 merge 2014-02-22 22:51:20 +01:00
Sergei Golubchik
74feebcd43 MDEV-5624 mysqldump --dump-slave option does not restart the replication if the dump has failed 2014-02-21 00:53:02 +01:00
Alexey Botchkov
84580f950c MDEV-5481 mysqldump fails to dump geometry types properly.
Fixed so the MYSQL_TYPE_GEOMETRY is treated as BLOB.
2014-02-18 17:45:08 +04:00
Michael Widenius
04bee0af2e Fix for MDEV-5547: Bad error message when moving very old .frm files to MariaDB 5.5.
mysql_upgrade --help now also prints out --default options and variable values.
mysql_upgrade now prints permission errors.
mysql_upgrade doesn't print some non essential info if --silent is used.
Added handler error message about incompatible versions
Fixed that mysqlbug and mysql_install_db have the executable flag set.
Removed executable flag for some non executable files.
Changed in mysql_install_db askmonty.org to mariadb.com.
Ensured that all client executables prints --default options the same way.
Allow REPAIR ... USE_FRM for old .frm files if the are still compatible.
Extended shown error for storage engine messages.


client/mysql.cc:
  print_defaults() should be first (as in all other programs)
client/mysql_upgrade.c:
  --help now also prints out --default options and variable values
  Print out error if wrong permissions
  Don't print info if --silent
client/mysqladmin.cc:
  print_defaults() should be first (as in all other programs)
client/mysqlbinlog.cc:
  Added print_defaults() to --help
client/mysqlcheck.c:
  Added empty line in --help
client/mysqlimport.c:
  Added empty line in --help
client/mysqlshow.c:
  Made --help compatible
client/mysqlslap.c:
  Made --help compatible
client/mysqltest.cc:
  Added print_defaults() to --help
include/handler_ername.h:
  Added handler error message
include/my_base.h:
  Added handler error message
mysql-test/r/mysql_upgrade.result:
  Updated results
mysql-test/r/repair.result:
  Added test case for better error messages
mysql-test/std_data/host_old.MYD:
  Added test case for better error messages
mysql-test/std_data/host_old.MYI:
  Added test case for better error messages
mysql-test/std_data/host_old.frm:
  Added test case for better error messages
mysql-test/t/repair.test:
  Added test case for better error messages
mysys/my_handler_errors.h:
  Added handler error message
scripts/CMakeLists.txt:
  Fixed that mysqlbug and mysql_install_db have the executable flag set
scripts/mysql_install_db.sh:
  askmonty.org -> mariadb.com
sql/ha_partition.cc:
  Sometimes table_type() can be called for errors even if partition didn't manage to open any files
sql/handler.cc:
  Write clear text for not handled, but defined error messages.
sql/share/errmsg-utf8.txt:
  Extended shown error for storage engine messages
sql/sql_admin.cc:
  Allow REPAIR ... USE_FRM for old .frm files if the are still compatible
storage/myisam/ha_myisam.cc:
  Use new error message
2014-01-22 15:16:57 +02:00
Sergei Golubchik
fa3f8a18b2 mysql-5.5.34 merge
(some patches reverted, test case added)
2013-11-19 13:16:25 +01:00
Sergei Golubchik
b838d081ad mysql-5.5.33 merge 2013-09-06 22:31:30 +02:00
Nisha Gopalakrishnan
09db23ae1c BUG#15844882: MYSQLDUMP FROM 5.5 FAILS WITH AN ERROR WHEN TRYING
TO DUMP DATA FROM MYSQL-5.6 

Merge from mysql-5.1 to mysql-5.5.
2013-07-18 11:44:00 +05:30
Nisha Gopalakrishnan
70cb66b96f BUG#15844882: MYSQLDUMP FROM 5.5 FAILS WITH AN ERROR WHEN TRYING
TO DUMP DATA FROM MYSQL-5.6 

Merge from mysql-5.1 to mysql-5.5.
2013-07-18 11:44:00 +05:30
Nisha Gopalakrishnan
30a37ca99b BUG#15844882: MYSQLDUMP FROM 5.5 FAILS WITH AN ERROR WHEN TRYING
TO DUMP DATA FROM MYSQL-5.6

Analysis
--------
Dumping mysql-5.6 data using mysql-5.1/mysql-5.5 'myqldump'
utility fails with a syntax error.

Server system variable 'sql_quote_show_create' which quotes the
identifiers is set in the mysqldump utility. The mysldump utility
of mysql-5.1/mysql-5.5 uses deprecated syntax 'SET OPTION' to set
the 'sql_quote_show_create' option. The support for the syntax is
removed in mysql-5.6. Hence syntax error is reported while taking
the dump.

Fix:
---
Changed the 'mysqldump' code to use the syntax
'SET SQL_QUOTE_SHOW_CREATE' to set the 'sql_quote_show_create'
option. That syntax is supported on mysql-5.1, mysql-5.5 and
mysql-5.6.

NOTE: I have not added an mtr test case since it is difficult
to simulate the condition. Also the syntax may not be further
simplified in the future.
2013-07-18 11:40:08 +05:30
Nisha Gopalakrishnan
5d74d07b44 BUG#15844882: MYSQLDUMP FROM 5.5 FAILS WITH AN ERROR WHEN TRYING
TO DUMP DATA FROM MYSQL-5.6

Analysis
--------
Dumping mysql-5.6 data using mysql-5.1/mysql-5.5 'myqldump'
utility fails with a syntax error.

Server system variable 'sql_quote_show_create' which quotes the
identifiers is set in the mysqldump utility. The mysldump utility
of mysql-5.1/mysql-5.5 uses deprecated syntax 'SET OPTION' to set
the 'sql_quote_show_create' option. The support for the syntax is
removed in mysql-5.6. Hence syntax error is reported while taking
the dump.

Fix:
---
Changed the 'mysqldump' code to use the syntax
'SET SQL_QUOTE_SHOW_CREATE' to set the 'sql_quote_show_create'
option. That syntax is supported on mysql-5.1, mysql-5.5 and
mysql-5.6.

NOTE: I have not added an mtr test case since it is difficult
to simulate the condition. Also the syntax may not be further
simplified in the future.
2013-07-18 11:40:08 +05:30
Sergei Golubchik
005c7e5421 mysql-5.5.32 merge 2013-07-16 19:09:54 +02:00
Sergei Golubchik
d7a6c801ac 5.3 merge.
change maria.distinct to use a function that doesn't require ssl-enabled  builds
2013-05-20 12:36:30 +02:00
Sergei Golubchik
639a766096 5.2 merge 2013-05-20 11:13:07 +02:00
Sergei Golubchik
4ee5ae3e7f 5.1 merge 2013-05-20 10:53:04 +02:00
Venkatesh Duggirala
7397aa913d Bug#14236170 MYSQLDUMP 5.5.25 CLIENT FAILS TO DUMP
MYSQL DB FROM REMOTE 5.0.96 SERVER

Problem: mysqldump tool assumes the existence of
general_log and slow_log tables in the server.
If mysqldump tool executes on a old server where
there are no log tables like these, mysqldump tool
fails.

Analysis: general_log and slow_log tables are added
in the ignore-table list as part of bug-26121 fix
causes bug-45740 (MYSQLDUMP DOESN'T DUMP GENERAL_LOG
AND SLOW_QUERY CAUSES RESTORE PROBLEM). As part of
the bug-45740 fix, mysqldump tool adds create table
queries for these two tables. But the fix assumes
that on all the servers, general_log and slow_log
will be there. If the new mysqldump tool is executed
against a old server where there are no general_log
and slow_log, the mysqldump tool fails with an error
that 'there is no general_log table'.

Fix: When mysqldump tool is trying to retrieve general_log
and slow_log table structures, first the tool should
check their existence of these tables in the server
instead of trying to dump it blindly.
2013-05-17 18:54:36 +05:30
Venkatesh Duggirala
0dd7348f72 Bug#14236170 MYSQLDUMP 5.5.25 CLIENT FAILS TO DUMP
MYSQL DB FROM REMOTE 5.0.96 SERVER

Problem: mysqldump tool assumes the existence of
general_log and slow_log tables in the server.
If mysqldump tool executes on a old server where
there are no log tables like these, mysqldump tool
fails.

Analysis: general_log and slow_log tables are added
in the ignore-table list as part of bug-26121 fix
causes bug-45740 (MYSQLDUMP DOESN'T DUMP GENERAL_LOG
AND SLOW_QUERY CAUSES RESTORE PROBLEM). As part of
the bug-45740 fix, mysqldump tool adds create table
queries for these two tables. But the fix assumes
that on all the servers, general_log and slow_log
will be there. If the new mysqldump tool is executed
against a old server where there are no general_log
and slow_log, the mysqldump tool fails with an error
that 'there is no general_log table'.

Fix: When mysqldump tool is trying to retrieve general_log
and slow_log table structures, first the tool should
check their existence of these tables in the server
instead of trying to dump it blindly.
2013-05-17 18:54:36 +05:30
Michael Widenius
4b9a6c03fa Fixed compiler warning 2013-05-11 18:57:06 +03:00
Sergei Golubchik
b381cf843c mysql-5.5.31 merge 2013-05-07 13:05:09 +02:00
Venkatesh Duggirala
0fe3128c94 BUG#16615117 MYSQLDUMP PRODUCES A CHANGE MASTER STATEMENT
WITH A PORT NUMBER ENCLOSED IN QUOTES

Problem: mysqldump --dump-slave --include-master-host-port
prints the CHANGE MASTER command in the generated logical
backup. The PORT number that is generated with this command
is a string and should be an integer.

Fix: Remove the Enclosed quotes for port number.
2013-04-12 14:18:21 +05:30
Venkatesh Duggirala
40360f0259 BUG#16615117 MYSQLDUMP PRODUCES A CHANGE MASTER STATEMENT
WITH A PORT NUMBER ENCLOSED IN QUOTES

Problem: mysqldump --dump-slave --include-master-host-port
prints the CHANGE MASTER command in the generated logical
backup. The PORT number that is generated with this command
is a string and should be an integer.

Fix: Remove the Enclosed quotes for port number.
2013-04-12 14:18:21 +05:30
Murthy Narkedimilli
8afe262ae5 Fix for Bug 16395495 - OLD FSF ADDRESS IN GPL HEADER 2013-03-19 15:53:48 +01:00
Murthy Narkedimilli
d978016d93 Fix for Bug 16395495 - OLD FSF ADDRESS IN GPL HEADER 2013-03-19 15:53:48 +01:00
Sergei Golubchik
8161c6772d merge with mysql-5.5.30 minus few incorrect or not applicable changesets 2013-02-28 18:42:49 +01:00
Murthy Narkedimilli
053d7e775c Updated/added copyright headers. 2013-02-25 15:26:00 +01:00