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

286 Commits

Author SHA1 Message Date
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
Georg Richter
072fa008b8 Fix for CONC-351:
If an ok packet doesn't contain session state tracking information, we need to
clear session state information from previous ok packet.
2018-08-06 18:45:30 +02:00
Georg Richter
f1fd014a15 Fixed leak in ma_tls_read/write 2018-07-31 09:39:03 +02:00
Georg Richter
d2ee129f8c CONC-297: Fixed regression bug (which happend due to a bad merge) 2018-07-27 07:32:08 +02:00
Georg Richter
1788e000d2 Fix for CONC-332:
mysql_change_user doesn't reset server status

Fixed my_auth.c, after successful connect the server status package information (including session change information) must be updated.
2018-07-27 07:17:27 +02:00
Georg Richter
b0f2e4e72f Coverity fixes and travis integration 2018-07-06 09:28:24 +02:00
Georg Richter
5b01cd608a Fix crash in mysql_select_db if db is null 2018-06-13 17:28:50 +02:00
Georg Richter
e8aea63d9f Windows build fix 2018-05-30 16:31:17 +02:00
Georg Richter
6b16eb778f Fix for CONC-336:
Allow multiple initialization of the client library (mysql_server_init(
mysql_server_end).
Note: This was already fixed by commit for CONC-277, unfortunately the fix
was overwritten by a bad merge.
2018-05-29 17:46:47 +02:00
Georg Richter
8455b6e1c9 Changed default character set from utf8 (see fix for CONC-315) to
latin1, which is also default behavior in MariaDB 10.1
To use another default character set, MariaDB Connector/C has to be build
with CMake parameter -DDEFAUT_CHARSET=name.
2018-05-24 12:10:02 +02:00
Vladislav Vaintroub
a12a0b8362 Merge branch '10.2-server'
# Conflicts:
#	CMakeLists.txt
#	unittest/libmariadb/connection.c
#	unittest/libmariadb/ps_bugs.c
2018-05-21 09:48:21 +00:00
Vladislav Vaintroub
184a16d2f1 Post-fix after ba9f5f4af1 (adding _server_host
attribute).

mysql->host is not always set (apparently not when reconnecting),
This made MariaDB C/C produce invalid handshake reply packet
with incorrecly encoded connection attributes. there cannot be connection
attributes with empty values in MySQL protocol.

Fix connector to only send _server_host is host is valid non-empty string.
Also prevent adding connection attributes with empty values.
2018-05-19 12:34:07 +00:00
Georg Richter
638f2aa8dd Revert "Fix for CONC-332:"
This reverts commit 0c29fdbbb3.
The fix breaks kill test in mtr (Windows).
2018-05-18 12:24:56 +02:00
Georg Richter
0c29fdbbb3 Fix for CONC-332:
After calling mysql_real_connect or mysql_change_user the server_status was
not updated, since run_plugin_auth didn't read the entire OK packet.
2018-05-17 07:10:15 +02:00
Sergei Golubchik
27b2f3d1f1 various checks for corrupted packets in the protocol
also: check the return value of unpack_fields()
2018-05-14 20:09:27 +02:00
Sergei Golubchik
d70c883422 minor style changes 2018-05-14 20:09:27 +02:00
Georg Richter
df07debedd Support for -Wlogical-op flag and warning fixes (Patch provided by Monty) 2018-05-12 10:48:26 +02:00
Georg Richter
f39db18ec3 Fix for CONC-315:
If no default client character set was specified, the utf8 character set will be used by default (instead of setting the client character set to server character set)
2018-05-12 10:43:09 +02:00
Georg Richter
dae524d079 CONC-314: Support for expired passwords (MySQL Server)
Added option MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS for
mysql_options/mysql_optionsv.

If this option is set, client indicates that he will be able to handle expired passwords by setting the CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS capability flag.
If password expired and CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS is set, the server will not return an error when connecting, but put the connection in sandbox mode, where all commands will return error 1820 (ER_MUST_CHANGE_PASSWORD) unless a new password was set.

Since we frequently update mysqld_error.h error codes from 10.2-server, the ma_error_server.h include file now includes mysqld_error.h (and is just a stub)
2018-05-12 10:43:02 +02:00
twocode
fe2d3230dd Use _server_host per discussion. 2018-05-11 10:09:04 +08:00
Xiangyu Hu
ba9f5f4af1 Add host name to session attributes 2018-05-10 10:09:32 +00:00
Georg Richter
ec985d92c0 CONC-327:
Add support for !include an !includedir in configuration files
2018-05-02 11:40:42 +02:00
Georg Richter
1c194bd78f Support for -Wlogical-op flag and warning fixes (Patch provided by Monty) 2018-04-24 17:18:31 +02:00