summaryrefslogtreecommitdiff
path: root/client
Commit message (Collapse)AuthorAgeFilesLines
* Minimize unsafe C functions usage - replace strcat() and strcpy() (and ↵Mikhail Chalov2023-01-203-51/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | strncat() and strncpy()) with custom safe_strcat() and safe_strcpy() functions The MariaDB code base uses strcat() and strcpy() in several places. These are known to have memory safety issues and their usage is discouraged. Common security scanners like Flawfinder flags them. In MariaDB we should start using modern and safer variants on these functions. This is similar to memory issues fixes in 19af1890b56c6c147c296479bb6a4ad00fa59dbb and 9de9f105b5cb88249acc39af73d32af337d6fd5f but now replace use of strcat() and strcpy() with safer options strncat() and strncpy(). However, add '\0' forcefully to make sure the result string is correct since for these two functions it is not guaranteed what new string will be null-terminated. Example: size_t dest_len = sizeof(g->Message); strncpy(g->Message, "Null json tree", dest_len); strncat(g->Message, ":", sizeof(g->Message) - strlen(g->Message)); size_t wrote_sz = strlen(g->Message); size_t cur_len = wrote_sz >= dest_len ? dest_len - 1 : wrote_sz; g->Message[cur_len] = '\0'; All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services -- Reviewer and co-author Vicențiu Ciorbaru <vicentiu@mariadb.org> -- Reviewer additions: * The initial function implementation was flawed. Replaced with a simpler and also correct version. * Simplified code by making use of snprintf instead of chaining strcat. * Simplified code by removing dynamic string construction in the first place and using static strings if possible. See connect storage engine changes.
* Add my_afree after my_alloca in early return caseEric Herman2023-01-201-0/+3
| | | | | The code already had a call to `my_afree` in the normal return case, but failed to do so in the early return case.
* MDEV-29817: Issues with handling options for SSL CRLs (and some others)Julius Goryavsky2022-11-222-0/+4
| | | | | | | | | | This patch adds the correct setting of the "--ssl-verify-server-cert" option in the client-side utilities such as mysqlcheck and mysqlslap, as well as the correct setting of the "--ssl-crl" option when executing queries on the slave side, and also add the correct option codes in the "sslopts-logopts.h" file (in the latter case, incorrect values are not a problem right now, but may cause subtle test failures in the future, if the option handling code changes).
* MDEV-28720 add log message if flush log failurekurt2022-10-191-0/+5
|
* Merge branch 'bb-10.3-vp-MDEV-27691' into 10.3Oleksandr Byelkin2022-10-141-15/+37
|\
| * MDEV-27691: prequisite enable/disable service connectionOleksandr Byelkin2022-09-231-15/+37
| |
* | MDEV-29183: Clarify mysqlbinlog command description (#2245)Zhibo Zhang2022-10-111-1/+1
| | | | | | The statement 'Verify checksum binlog events.' is confusing. Fix word order to make it clear.
* | Use memory safe snprintf() in Connect Engine and elsewhere (#2210)Mikhail Chalov2022-09-281-7/+7
|/ | | | | | | | | Continue with similar changes as done in 19af1890 to replace sprintf(buf, ...) with snprintf(buf, sizeof(buf), ...), specifically in the "easy" cases where buf is allocated with a size known at compile time. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.
* Fix typos in the codebase.fluesvamp2022-08-0911-34/+35
|
* MDEV-23097 heap-use-after-free in mysqlimportSergei Golubchik2022-08-021-6/+8
| | | | | | | | | | | | | | | | mysqlimport starts many worker threads. when one of the worker encounters an error, it frees global memory and calls exit(). it suppresses memory leak detector, because, as the comment says "dirty exit, some threads are still running", indeed, it cannot free the memory from other threads. but precisely because some threads are still running, they might use this global memory, so it cannot be freed. fix: if we know that some threads are still running and accept that we cannot free all memory anyway, let's not free global allocations either
* MDEV-26447: mysqldump to use temporary view instead of tables.Daniel Black2022-08-031-40/+11
| | | | | | | | | | | This is particularly important for Azure where there is no MyISAM support in their MariaDB cloud product. Like mysqldumper does, a view can satisfy the requirement like a table, without constraints. The views in frm files are text form and don't have column limits. Thanks Thomas Casteleyn for the suggestion.
* MDEV-18702 mysqldump: add variable 'max-statement-time'Mike Griffin2022-08-021-0/+14
| | | | | | | | | | | | | | With a global non-default max-statement-time of a time interval that exceed the query time mysqldump queries when doing a backup. To solve both, add a max-statement-time option, defaulting to 0 (unlimited time). Also like mariabackup, set the session wait_timeout=DEFAULT (28800). The time/processing between mysqldump times isn't expected to get that close ever, but let's adopt the standard of mariabackup as no-one has challenged it has having a detrimental effect. Reviewer and test case author Daniel Black
* MDEV-28197 Linux mariadb-client build does not accept Unicode charactersSergei Golubchik2022-07-101-4/+4
| | | | | | | | | | Apparently newer libedit is readline-compatible enough to be detected as a readline, with USE_NEW_READLINE_INTERFACE defined and USE_LIBEDIT_INTERFACE not defined. Let's set the locale unconditionally, independently from the readline/libedit variant. It's already happening anyway now, unless one specifies --default-character-set explicitly.
* Fix most clang-15 -Wunused-but-set-variableMarko Mäkelä2022-07-013-15/+11
| | | | | | Also, refactor trx_i_s_common_fill_table() to remove dead code. Warnings about yynerrs in Bison-generated yyparse() will remain for now.
* Add option --enable-cleartext-plugin to the MariaDB clientTing Nian2022-05-262-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For compatibility reasons, add the option to the MariaDB client without any functional changes besides simply accepting the option and emitting a warning that it is obsolete. In MySQL this security related option is compulsory in certain use cases. When users switch to MariaDB, this client command that used to work starts failing without a sensible error message. In worst case users resort to re-installing the mysql client from MySQL. In MariaDB the option is obsolete and should simply be ignored. Users however don't have any opportunity to learn that unless the client program tells them so. Before: mysql --enable-cleartext-plugin ... mysql: unknown option '--enable-cleartext-plugin' (program terminates) After: mysql --enable-cleartext-plugin ... WARNING: option '--enable-cleartext-plugin' is obsolete. (program executes) All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc.
* MDEV-4875 Can't restore a mysqldump if --add-drop-database meets general_logDaniel Black2022-05-061-35/+65
| | | | | | | | | | | | or slow query log when the log_output=TABLE. When this happens, we temporary disable by changing log_output until we've created the general_log and slow_log tables again. Move </database> in xml mode until after the transaction_registry. General_log and slow_log tables where moved to be first to be dumped so that the disabling of the general/slow queries is minimal.
* MDEV-27816 Set sql_mode before DROP IF EXISTS alreadyHartmut Holzgraefe2022-05-061-3/+3
| | | | | | | | | | | Previously the correct SQL mode for a stored routine or package was only set before doing the CREATE part, this worked out for PROCEDUREs and FUNCTIONs, but with ORACLE mode specific PACKAGEs the DROP also only works in ORACLE mode. Moving the setting of the sql_mode a few lines up to happen right before the DROP statement is writen fixes this.
* Merge 10.2 into 10.3Marko Mäkelä2022-03-291-0/+1
|\
| * MDEV-14608: mysqlbinlog lastest backupfile size is 0Brandon Nesterenko2022-03-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: ======== When using mariadb-binlog with --raw and --stop-never, events from the master's currently active log file should be written to their respective log file specified by --result-file, and shown on-disk. There is a bug where mariadb-binlog does not flush the result file to disk when new events are received Solution: ======== Add a function call to flush mariadb-binlog’s result file after receiving an event in --raw mode. Reviewed By: ============ Andrei Elkin <andrei.elkin@mariadb.com>
* | MDEV-27691: make working view-protocolLena Startseva2022-02-161-0/+23
| | | | | | | | | | | | Added ability to disable/enable (--disable_view_protocol/--enable_view_protocol) view-protocol in tests. When the option "--disable_view_protocol" is used util connections are closed. Added new test for checking view-protocol
* | Merge branch '10.2' into 10.3mariadb-10.3.34Sergei Golubchik2022-02-101-15/+11
|\ \ | |/
| * MDEV-27789 mysql_upgrade / mariadb-upgrade in 10.6.6 is putting password in ↵Monty2022-02-101-15/+11
| | | | | | | | | | | | | | | | | | | | host argument Removed all dependencies of command line arguments based on positions in an array (this kind of code should never have been written). Instead use option names, which are stable. Reviewer: Sergei Golubchik
* | Merge branch '10.2' into 10.3mariadb-10.3.33Oleksandr Byelkin2022-01-292-98/+225
|\ \ | |/
| * MDEV-27068 running mariadb-upgrade in parallel make it hangs foreverMonty2022-01-202-90/+224
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MDEV-27107 prevent two mariadb-upgrade running in parallel MDEV-27279 mariadb_upgrade add --check-if-upgrade-is-needed / restrict tests to major version Code is based of pull request from Daniel Black, but with a several extensions. - mysql_upgrade now locks the mysql_upgrade file with my_lock() (Advisory record locking). This ensures that two mysql_upgrades cannot be run in parallel. - Added --check-if-upgrade-is-needed to mysql_upgrade. This will return 0 if one has to run mysql_upgrade. Other changes: - mysql_upgrade will now immediately exit if the major version and minor version (two first numbers in the version string) is same as last run. Before this change mysql_upgrade was run if the version string was different from last run. - Better messages when there is no need to run mysql_upgrade. - mysql_upgrade --verbose now prints out a lot more information about the version checking. - mysql_upgrade --debug now uses default debug arguments if there is no option to --debug - "MySQL" is renamed to MariaDB in the messages - mysql_upgrade version increased to 2.0 Notes Verifying "prevent two mariadb-upgrade running in parallel" was done in a debugger as it would be a bit complex to do that in mtr. Reviewer: Danial Black <daniel@mariadb.org>
* | Merge branch 10.2 into 10.3Julius Goryavsky2021-12-231-8/+3
|\ \ | |/
| * MDEV-27191 MariaDB client - "system" command does not work on WindowsVladislav Vaintroub2021-12-071-8/+3
| | | | | | | | | | - define USE_POPEN, like it is done elsewhere. - use Notepad as default editor on Windows for the "edit" command.
* | Merge 10.2 into 10.3Marko Mäkelä2021-11-091-5/+9
|\ \ | |/
| * MDEV-19129: Xcode compatibility update: #include <editline/readline.h> pathSergei Krivonos2021-10-311-1/+5
| |
* | Merge 10.2 into 10.3Marko Mäkelä2021-10-131-5/+8
|\ \ | |/
| * MDEV-25444: mysql --binary-mode is not able to replay some mysqlbinlog outputsbb-10.2-MDEV-25444-docsBrandon Nesterenko2021-10-071-5/+8
| | | | | | | | | | | | | | | | | | This is a documentation-only patch to refine the description of binary mode for the mariadb client. Reviewed By: ============ Andrei Elkin <andrei.elkin@mariadb.com>
| * MDEV-25444: mysql --binary-mode is not able to replay some mysqlbinlog outputsbb-10.2-MDEV-25444Brandon Nesterenko2021-10-061-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note: This patch backports commits 10cd281 and 1755ea4 from 10.3. 10cd281: Problem:- Some binary data is inserted into the table using Jconnector. When binlog dump of the data is applied using mysql client it gives syntax error. Reason:- After investigating it turns out to be a issue of mysql client not able to properly handle \\0 <0 in binary>. In all binary files where mysql client fails to insert these 2 bytes are common (0x5c00) Solution:- I have changed mysql.cc to include for the possibility that binary string can have \\0 in it 1755ea4: Changes on top of Sachin’s patch. Specifically: 1) Refined the parsing break condition to only change the parser’s behavior for parsing strings in binary mode (behavior of \0 outside of strings is unchanged). 2) Prefixed binary_zero_insert.test with ‘mysql_’ to more clearly associate the purpose of the test. 3) As the input of the test contains binary zeros (0x5c00), different text editors can visualize this sequence differently, and Github would not display it at all. Therefore, the input itself was consolidated into the test and created out of hex sequences to make it easier to understand what is happening. 4) Extended test to validate that the rows which correspond to the INSERTS with 0x5c00 have the correct binary zero data. Reviewed By: ============ Andrei Elkin <andrei.elkin@mariadb.com>
* | MDEV-25444: mysql --binary-mode is not able to replay some mysqlbinlog outputsbb-10.3-25444Brandon Nesterenko2021-10-051-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes on top of Sachin’s patch. Specifically: 1) Refined the parsing break condition to only change the parser’s behavior for parsing strings in binary mode (behavior of \0 outside of strings is unchanged). 2) Prefixed binary_zero_insert.test with ‘mysql_’ to more clearly associate the purpose of the test. 3) As the input of the test contains binary zeros (0x5c00), different text editors can visualize this sequence differently, and Github would not display it at all. Therefore, the input itself was consolidated into the test and created out of hex sequences to make it easier to understand what is happening. 4) Extended test to validate that the rows which correspond to the INSERTS with 0x5c00 have the correct binary zero data. Reviewed By: =========== Andrei Elkin <andrei.elkin@mariadb.com>
* | MDEV-25444 mysql --binary-mode is not able to replay some mysqlbinlog outputsSachin Kumar2021-10-051-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem:- Some binary data is inserted into the table using Jconnector. When binlog dump of the data is applied using mysql cleint it gives syntax error. Reason:- After investigating it turns out to be a issue of mysql client not able to properly handle \\\0 <0 in binary>. In all binary files where mysql client fails to insert these 2 bytes are commom (0x5c00) Solution:- I have changed mysql.cc to include for the possibility that binary string can have \\\0 in it
* | Fixup "Windows, mysqltest : cleanup, remove dead code USE_CYGWIN"Vladislav Vaintroub2021-09-241-0/+8
| | | | | | | | | | last commit 8221708e389728aef799046eef3c49b1eec2e400 removed too much, mtr is failing
* | Windows, mysqltest : cleanup, remove dead code USE_CYGWINVladislav Vaintroub2021-09-241-54/+0
| |
* | MDEV-11499 mysqltest, Windows : improve diagnostics if server fails to shutdownVladislav Vaintroub2021-09-241-7/+47
| | | | | | | | | | | | | | | | | | | | | | Create minidump when server fails to shutdown. If process is being debugged, cause a debug break. Moves some code which is part of safe_kill into mysys, as both safe_kill, and mysqltest produce minidumps on different timeouts. Small cleanup in wait_until_dead() - replace inefficient loop with a single wait.
* | Merge branch '10.2' into 10.3Sergei Golubchik2021-09-071-11/+52
|\ \ | |/
| * MDEV-19227: mysql_plugin doesn't run bootstrap from sourceAnel Husakovic2021-09-071-11/+52
| | | | | | | | | | Reviewed by: serg@mariadb.com daniel@mariadb.org
* | Merge branch '10.2' into 10.3Vicențiu Ciorbaru2021-09-071-2/+1
|\ \ | |/
| * Cleanup - remove confusing comment.Vladislav Vaintroub2021-09-011-1/+0
| |
| * MDEV-26514 Option to build a separate test zip package on WindowsElena Stepanova2021-09-011-1/+1
| | | | | | | | echo is needed for the tests
* | Merge 10.2 into 10.3Marko Mäkelä2021-06-211-6/+9
|\ \ | |/
| * fix mysqlest crash on ./mtr --sp innodb_fts.innodb-fts-stopwordSergei Golubchik2021-06-121-2/+2
| |
| * fix mysqltest crash report outputSergei Golubchik2021-06-121-4/+7
| | | | | | | | | | | | | | | | | | * read_command_buf is a pointer now, sizeof() no longer reflects its length, read_command_buflen is. * my_safe_print_str() prints multiple screens of '\0' bytes after the query end and up to read_command_buflen. Use fprintf() instead. * when setting connection->name to "-closed_connection-" update connection->name_len to match.
* | Merge 10.2 into 10.3Marko Mäkelä2021-03-271-1/+5
|\ \ | |/
| * MDEV-24879 Client crash on undefined charsetsdirSergei Golubchik2021-03-231-1/+5
| |
* | Merge branch '10.2' into 10.3Sergei Golubchik2021-02-011-2/+22
|\ \ | |/
| * MDEV-20939: Race condition between mysqldump import and InnoDB persistentRucha Deodhar2021-01-271-0/+14
| | | | | | | | | | | | | | | | | | | | | | statistics calculation Analysis: When --replace or --insert-ignore is not given, dumping of mysql.innodb_index_stats and mysql.innodb_table_stats will result into race condition. Fix: Check if these options are present with --system=stats (because dumping under --system=stats is safe). Otherwise, dump only structure, ignoring data because innodb will recalculate data anyway.
| * MDEV-20939: Race condition between mysqldump import and InnoDB persistentDaniel Black2021-01-251-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | statistics calculation mysqldump --system=stats and --system=timezones by default used ordinary INSERT statements populate EITS, innodb stats, and timezone tables. As these all have primary keys it could result in conflict. The behavior desired with --system= is to replace the tables. As such we assume --replace for the purposes of stats and timezone tables there if --insert-ignore isn't specified.
* | MDEV-21785: sequences used as default by other table not dumped in right ↵bb-10.3-MDEV-21785Oleksandr Byelkin2021-01-261-17/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | order by mysqldump Dump sequences first. This atch made to keep it small and to keep number of queries to the server the same. Order of tables in a dump can not be changed (except sequences first) because mysql_list_tables uses SHOW TABLES and I used SHOW FULL TABLES.