1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-05 15:55:58 +03:00
Commit Graph

255 Commits

Author SHA1 Message Date
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
Georg Richter
971fae75a8 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-04-11 13:21:05 +02:00
Georg Richter
d3644be080 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-04-07 07:42:59 +02:00
Georg Richter
50d48e91fa Reworked plugin interface
Plugin configuration happens now in CMakeLists.txt files in corresponding plugin directories.

plugins.cmake now contains REGISTER_PLUGIN_FUNCTION which accepts the following parameters:
  - TARGET: the name of the plugin (dynamic plugins will be named ${TARGET}.so (or .dll)
  - SOURCES: source files
  - LIBRARIES: additional libraries for linking
  - INCLUDES: include directories
  - CONFIGURATIONS: possible plugin configurations: valid arguments are DYNAMIC, STATIC, OFF
  - DEFAULT: default configuration (see CONFIGURATIONS)
  - COMPILE_OPTIONS: compiler flags

The default plugin configuration can be specified via cmake parameter -DCLIENT_PLUGIN_${TARGET}=[DYNAMIC|STATIC|OFF]
2018-04-07 07:14:43 +02:00
Georg Richter
80b2ae25bd If COM_PING failed, check if reconnect option was set before calling
mysql_ping again.
2018-02-17 12:22:18 +01:00
Georg Richter
929614903e Travis and Appveyor integration:
- added travis support
  - fixed appveyor settings
  - fixed some warnings (gcc 4.8)
  - removed sleep commands
  - disabled failing tests when running against MySQL server,
    mostly related to stored procedures and binary protocol
  - reverted fix for MDEV_10361

Still open: TLS/SSL appveyor tests, since .msi installation on appveyor doesn't provide certificates.
2018-02-16 12:14:01 +01:00
Georg Richter
eefaadfe21 Removed automatic detection of program name 2018-02-16 11:43:32 +01:00
Vladislav Vaintroub
db1a1a1d31 more clang fixes 2018-02-12 09:29:27 +00:00
Vladislav Vaintroub
aed8005e2e Fix clang on Windows warnings
- STDCALL is ignored for variable argument functions.
- __attribute__ does work for Clang (also if that pretends to be MSVC)
- remove unused function
- simplify ma_getopt, fixes some strange compile error in clang (about
SSE intrinsics)

- fix some clang warnings
2018-02-09 19:10:50 +01:00
Georg Richter
9ee186141e Fix for CONC-294:
Since we already called plugin->close function we need to prevent that
mysql_close_slow_part (which sends COM_QUIT to the server) will be handled
by plugin (which might end up in crashing the application)
2018-01-21 17:30:02 +01:00
Georg Richter
adf7b569e3 Fix for MDEV-10361: Don't try to reconnect twice: if mysql->options.reconnect is set,
ma_simple_command already tries to reconnect, so there is no need to reconnect in mysql_ping again
2018-01-19 10:20:42 +01:00
Vladislav Vaintroub
935c33b690 Fix Windows size_t warnings. 2018-01-12 18:19:19 +00:00
Vladislav Vaintroub
63f841f78f Fix finding current program name with clang > 4.0
Use CRT _splitpath() to get program name on Windows, rather than
nonstandard functions from shell32
2017-11-24 14:37:24 +01:00
Georg Richter
b241f8995f MDEV-14101: tls-version
Client part of MDEV-14101: Add support for tls-version, via
mysql_options(mysql, MARIADB_OPT_TLS_VERSION, value)
Accepted values are "TLSv1.1", "TLSv1.2" and "TLSv1.3".

Fixed testcase openssl_1 for schannel
2017-10-23 11:09:54 +02:00
Georg Richter
abf4bf8024 Provide details about TLS/SSL library in use
When calling mariadb_get_infov with option MARIADB_TLS_LIBRARY
the functioni now returns the correct version number and name
of the tls/ssl library in use.
2017-10-17 15:57:42 +02:00
Georg Richter
3b297e08c9 Revert "MDEV-14027: Determine TLS/SSL library version"
This reverts commit 7b02cbb721.
2017-10-15 09:30:24 +02:00
Georg Richter
7b02cbb721 MDEV-14027: Determine TLS/SSL library version 2017-10-15 06:07:54 +02:00
Georg Richter
7bcd78f93b CONC-286:
- Force TLS/SSL connection if finger print options were specified
- Allow hex finger prints with colon separated 2 digit numbers
2017-10-10 12:25:27 +02:00
Georg Richter
453a88c7d4 Added missing break in mysql_get_infov 2017-09-08 12:22:14 +02:00
Sergei Golubchik
67277fb1d1 followup for e2df6d2: default directories, files, and groups
* do not read ini_exts array beyond the end
* do not use local variable (val) address outside of the variable's scope
* do not read $HOME/my.cnf
* do not create files in the user's $HOME, use $MYSQL_TMP_DIR
* test reading of the executable name group
* fail the test if .my.cnf cannot be opened
2017-07-04 19:34:28 +02:00
Georg Richter
ea8a31e63a Fixed compiler warnings 2017-07-04 13:56:38 +02:00
Georg Richter
8b3e6b5dcf Fix for CONC-252:
All functions which are supported by libmysql use now unsigned long as length parameter instead of size_t
2017-07-01 15:42:52 +02:00
Georg Richter
e2df6d2552 Fix for MDEV-12965 and MDEV-13100:
If no configuration file and no configuration group was specified, Connector/C ddoesn't read any configurationm files.
By default the follwing groups will be read:
- client
- client-server
- client-mariadb

If no configuration file was specified, Connector/C looks up for configuration files in following locations:
- Windows:
  - System directory
  - Windows directory
  - C:\
  - Directoy from which the application was started
  - MYSQL_HOME environment variable
- Unix platforms
  - DEFAULT_SYSCONFIR (if specified)
  or
  - /etc and /etc/mysql
  - MYSQL_HOME environment variable
  - .my.cnf in home directory

Special case: If NULL or empty string will be passed for MYSQL_READ_DEFAULT_GROUP option Connector/C will read the default groups and the group which matches the application name.
2017-06-25 14:14:55 +02:00
Georg Richter
1ea7be32f5 Merge remote-tracking branch 'origin/MDEV-12471' 2017-06-14 11:12:59 +02:00
Vladislav Vaintroub
06d2490371 MDEV-11159 Add support for sending proxy protocol header 2017-06-13 18:19:07 +00:00
Georg Richter
d2aec415d7 Minor fixes:
fixed compiler warnings in openssl.c and dialog.c
  fixed timeout setting (was wrong in a previous commit)
  disabled session tracking test
2017-05-09 16:40:09 +02:00
Georg Richter
a86b36d08f CONC-250: SSL hostname verification for SubjectAltNames
Add hostname verification for SAN (OpenSSL)
2017-05-08 13:55:21 +02:00
Georg Richter
08450df078 initial implementation for MDEV-12471 2017-04-24 15:45:58 +02:00
Georg Richter
bde93e828d Merge branch 'master' of https://github.com/MariaDB/mariadb-connector-c 2017-04-03 18:12:13 +02:00
Sergei Golubchik
be34e12ba0 remove ctx hooks after the successful reconnect
this fixes main.mysql_client_test_nonblock failures
in optimized builds
2017-03-31 14:30:04 +02:00
Sergei Golubchik
c042c1d8d0 add forgotten async ctxt initialization on reconnects 2017-03-25 22:41:03 +01:00
Georg Richter
9a865bc88c Fix for CONC-243:
ABI breakage: Revert parameter length from size_t to unsigned long.
  (affects mysql_stmt_prepare, mysql_real_query, mysql_send_query)
2017-03-14 16:11:04 +01:00