1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00

258 Commits

Author SHA1 Message Date
Marko Mäkelä
375bab0d51 Merge 3.1 into 3.2 2021-02-16 18:44:15 +02:00
Georg Richter
2ff01c121c Fix for CONC-518:
Check if mysql->options.extension was allocated before checking
async_context: this is handled by IS_MYSQL_ASYNC() macro now.
2020-11-27 18:33:06 +01:00
Georg Richter
820faff627 codespell fixes, removed MSDOS preprocessor macros 2020-11-26 09:07:17 +01:00
Vladislav Vaintroub
6a763b9000 MDEV-19237 - do not resend prepared statement metadata unnecessarily
fix warnings
2020-10-20 14:58:37 +02:00
Georg Richter
b2966c05e4 Revert "MDEV-19237 - do not resend prepared statement metadata unnecessarily":
This reverts commit ed4d747510.
2020-10-20 14:57:22 +02:00
Vladislav Vaintroub
ed4d747510 MDEV-19237 - do not resend prepared statement metadata unnecessarily
fix warnings
2020-10-15 22:25:09 +02:00
Vladislav Vaintroub
c0837c3b8d MDEV-21612 Remove COM_MULTI.
The server command code 254 is now reserved,
as well as corresponding protocol flag.

Do not reuse them.
2020-09-22 17:26:04 +02:00
xantares
9d7c233e8d Fix include on case-sensitive fs
shlwapi is lowercase on case-sensitive file-systems
2020-09-12 14:29:56 +02:00
Georg Richter
29a3396456 CONC-302: Added support for SESSION_TRACK_GTIDS (MySQL server) 2020-09-12 10:58:33 +02:00
Georg Richter
3e699a1738 CONC-496: Added support for SESSION_TRACK_TRANSACTION_STATE in ok packet 2020-09-10 14:03:00 +02:00
Dianne Skoll
73dfd1ee48 Clear out free'd pointers for safety. 2020-08-13 14:16:29 -04:00
Sergei Golubchik
2759b87d72 sanity checks for client-supplied OK packet content
reported by Matthias Kaiser, Apple Information Security
2020-05-07 15:06:32 +02:00
Sergei Golubchik
ca8f94f727 BUG#29597896 - NULL POINTER DEREFERENCE IN LIBMYSQL
CONC version of server commit e8e67bd4a4c
2020-05-04 09:14:45 +02:00
Marko Mäkelä
7a2c052ffc MemorySanitizer: Avoid calling uninstrumented getservbyname() 2020-03-28 20:12:43 +02:00
Georg Richter
8c773db1fb Fix for CONC-441:
Instead of getlogin() we first try to determine the current user of the process
by calling getpwuid(). If for some reaon getpwuid() will fail, we will use getlogin() instead.
2020-03-12 18:09:40 +01:00
Georg Richter
f9a50468cd Merge pull request #129 from ottok/3.1-fix-spelling
Fix typo in output string: inital -> initial
2020-03-11 08:25:59 +01:00
Alexander Barkov
6632cb69d7 MDEV-17832 Protocol: extensions for Pluggable types and JSON, GEOMETRY 2020-03-10 17:02:59 +04:00
Georg Richter
d4f75481f6 Fix for CONC-458:
Fixed crash in mysql_get_timeout and mysql_get_timeout_ms functions,
which happened when no asynchronous context was set before.
2020-03-05 09:50:12 +01:00
Otto Kekäläinen
c0d5d7d15b Fix typo in output string: inital -> initial 2020-03-04 20:05:56 +02:00
Georg Richter
6a0c8ff2e5 Fix for CONC-457:
mysql_list_processlists was marked as deprecated in MySQL 4.0 and not
updated anymore. It exists still in latest MySQL and MariaDB connectors.
It now supports the 4.1 protocol, using 7 instead of 5 fields.

The following functions are now marked deprecated in source:
* mysql_list_dbs
* mysql_list_tables
* mysql_list_processes
2020-02-28 12:56:37 +01:00
Georg Richter
1218ffac1a Fix for CONC-452 and CONC-453:
Various coverity scan fixes, including CONC-452 and CONC-453.
Special thanks to Lukas Javorsky for fixing numerous covscan
issues (This patch includes part of his pull request #126).

Coverity scan build was using the following cmake parameters:
-WITH_EXTERNAL_ZLIB=ON -DWITH_UNIT_TESTS=OFF.

CWE-416 (use after free) in dtoa.c (from netlib) is still open.
2020-02-14 09:52:21 +01:00
Georg Richter
17ba6affa9 Fix for mysql_set_character_set:
Give a more detailled error information, in case SET NAMES failed.
2020-02-06 10:08:32 +01:00
Georg Richter
a1283d0b10 cleanup (patch provided by Alexander Barkov)
move function prototypes used in mariadb_lib.c and mariadb_stmt.c
to include/ma_priv.h
2020-01-20 17:44:49 +01:00
Oleksandr Byelkin
42be9e67d8 Bug#29630767 - USE OF UNINITIALIZED VALUE IN LIBMYSQL (CLIENT.CC FUNCTION RUN_PLUGIN_AUTH) 2020-01-20 11:14:21 +01:00
Oleksandr Byelkin
980f2dbea6 Typo fixed 2019-10-31 06:06:39 +01:00
Georg Richter
a0cbee900b Schannel fix for 9ba8e32f6d
When we try to reconnect we need to set CLIENT_REMEMBER_OPTIONS otherwise
new connection will not be secure.
2019-10-11 16:39:01 +02:00
Georg Richter
0235aa6adc Fixed gcc warning (missing const qualifier) 2019-10-08 14:18:01 +02:00
Georg Richter
de04c2e01f Workaround for CONC-417, MDEV-13492
At irregular intervals older windows versions (prior Windows 10) fail to establish a secure (TLS)
connection and return errors SEC_E_INVALID_TOKEN, SEC_E_BUFFER_TOO_SMALL or SEC_E_MESSAGE_ALTERED.
This is a bug in windows schannel library and was only fixed in recent versions, also OpenSSL provided
a workaround (see https://github.com/openssl/openssl/pull/1350).
Since we are unable to fix this, we introduced a workaround for this problem. In case of an error
during TLS handshake we check the errorcode and try to reconnect up to three times if the error code
was SEC_E_INVALID_TOKEN, SEC_E_BUFFER_TOO_SMALL or SEC_E_MESSAGE_ALTERED.
2019-09-19 08:50:55 +02:00
zhangk143
9cb1322de0 fix bug CONC-400 error with sizeof("commit") in function mysql_commit 2019-06-19 10:12:00 +08:00
Georg Richter
2fdaf1d447 Fix for CONC-402: Replace underscores with dashes in conf_key values in mariadb_defaults array 2019-04-19 12:23:32 +02:00
Georg Richter
ad385b954a CONC-394: Some TLS related options are not settable in configuration file
The following options are now supported in configuration files:
* ssl_enforce (bool)
* ssl_crl (string)
* ssl_crlpath (string)
2019-04-06 11:42:24 +02:00
Georg Richter
a8bec1c68a CONC-395: Dashes and underscores are not interchangeable in options in my.cnf 2019-03-26 16:48:21 +01:00
Georg Richter
af47d1beab Merge branch '3.0' into 3.1 2019-03-03 14:03:20 +01:00
Georg Richter
68d05007bb Fix for CONC-392:
Fixed crash when server sent session tracking information with session type
SESSION_TRACK_STATE_CHANGE. In this special case the packet doesn't contain
the overall length. (see https://mariadb.com/kb/en/library/ok_packet/).
2019-03-02 07:54:06 +01:00
Georg Richter
31ae1278aa Fix for MDEV-18721 (Host option in configuration file is ignored.)
We need to check the passed host variable after the configuration file was read.
Thanks to Peter Penchev and Corey Hickey for providing patches.
2019-02-24 20:00:02 +01:00
Sergei Golubchik
4aad20db15 Merge tag 'v3.0.9' into 3.1 2019-02-18 20:16:23 +01:00
Sergei Golubchik
2c5aebb3bc auto_local_infile is not an user-settable option
it's an internal state variable, should be in st_mariadb_extension.

In particular, treating it like an option, caused mysql->options
to be allocated in mysql_init(), which caused failed reconnects
to leak memory:

Direct leak of 10824 byte(s) in 33 object(s) allocated from:
    #0 0x7f00db5ba79a in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9879a)
    #1 0x55eb1b1d545e in mysql_init /home/buildbot/mariadb-10.2-build24320/libmariadb/libmariadb/mariadb_lib.c:1021
    #2 0x55eb1b1e342e in mariadb_reconnect /home/buildbot/mariadb-10.2-build24320/libmariadb/libmariadb/mariadb_lib.c:1621
    ...
2019-02-08 16:36:35 +01:00
Georg Richter
70f2964dc4 Fix for CONC-384:
fixed length calculation for connection attributes. We now call mysql_net_store_length passing the size of the connection attribute and substract the offset of the passed buffer to determine the correct size.
2019-02-07 04:14:55 +01:00
Sergei Golubchik
1e5e21cae9 compilation on Windows
Windows doesn't have strncasecmp, it has _strnicmp
2019-02-06 18:14:57 +01:00
Sergei Golubchik
95b5dea9bd ENABLED_LOCAL_INFILE is always defined now 2019-02-06 12:25:20 +01:00
Georg Richter
3beab84b83 mtr fix: mysql_client_test still uses the deprecated mysql_list_fields function,
so we can set default value to zero (mysql_client_tedt doesn't check the value and crashes).
2019-02-06 09:02:03 +01:00
Georg Richter
438b7f452a Merge branch '3.0' of https://github.com/MariaDB/mariadb-connector-c into 3.0 2019-02-05 13:58:07 +01:00
Georg Richter
5783a8b59a Set values for field->def and field->def_length to zero - they are populated only from
deprecated api function mysql_list_fields.
2019-02-05 13:56:59 +01:00
Robert Bindar
f9e626becb Support for expired passwords
Getter should get and the setter should set CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS
2019-02-05 09:51:54 +02:00
Georg Richter
02e7d5654d Crude "auto-load-data-local-infile" mode
Disable LOAD DATA LOCAL INFILE suport by default and
auto-enable it for the duration of one query, if the query
string starts with the word "load". In all other cases the application
should enable LOAD DATA LOCAL INFILE support explicitly.

(Based on Sergei Golubchiks 5.5 server patch)
2019-02-05 07:19:36 +01:00
Sergei Golubchik
beb9d5ea89 MDEV-11340 Allow multiple alternative authentication methods for the same user
continue the authentication if the auth plugin is not found,
perhaps the next plugin in the chain will work.
2019-02-04 16:07:05 +01:00
Georg Richter
2e3c152c59 Fixed UBSan Error
Kudos to Alexey Milovidov for providing this short patch.
2019-02-03 21:27:26 +01:00
Georg Richter
cb08739aa2 - Changed return code for mysql_optionv/mysql_get_optionv to 1 (was -1) and added CR_NOT_IMPLEMENTED error message.
if a options is unknown or not supported.
  This will fix possible error when setting connection attributes.
Kudos to Coray Hickey for providing this patch!
2019-02-03 16:28:38 +01:00
Georg Richter
abce2a3ab3 CONC-377: Add IO Callback
Applied part of the patch from https://github.com/MariaDB/mariadb-connector-c/pull/71
The part for named pipes doesn't work, since wait_io was reworked by vvaintroub.
2018-12-01 16:46:46 +01:00
Georg Richter
005195f9cb CONC-312: Implementation for caching_sha2_password plugin 2018-12-01 08:56:24 +01:00