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

108 Commits

Author SHA1 Message Date
rusher
1bf3571146 [TODO-5373] add github action 2025-06-16 19:43:16 +02:00
Georg Richter
ba64123b45 Merge branch '3.3' into 3.4 2025-01-20 09:58:34 +01:00
Georg Richter
fa9f5f66be Travis and test fixes:
- Build server build with latest C/C: Instead of copying the C/C directory
  into server, we now fetch the actual commit or PR into server repository
- Fix travis environment variables (Windows)
- Skip character set tests if the server doesn't support charset/collation
- Don't use CREATE OR REPLACE SQL syntax to make MySQL happy
- Disable TLS connection test for MaxScale
- Don't set TEST environment variables if they are empty
2025-01-07 16:57:53 +01:00
Georg Richter
29c0f5d317 Merge branch '3.3' into 3.4 2024-12-10 05:50:11 +01:00
Georg Richter
16e5b88bab MYSQL_OPT_ZSTD_COMPRESSION_LEVEL fixes:
Follow up for commit e633858c9e:
- Fixed ASAN bug (int to char conversion)
- Allow to retrieve zstd compression level via mysql_get_optionv()
2024-12-10 05:18:08 +01:00
Georg Richter
fb0eea663a Merge branch '3.3' into 3.4 2024-12-08 12:01:20 +01:00
Georg Richter
6d28fe89af Merge branch '3.1' into 3.3 2024-12-08 11:50:43 +01:00
Georg Richter
fa987a3bc4 Added test case for CONC-163 2024-12-02 06:36:56 +01:00
Georg Richter
cc68f677ca Fix test case for CONC-741 2024-11-30 07:28:34 +01:00
Markus Mäkelä
8dce8dba85 CONC-741: Check that MYSQL_STMT is not null
The code now again allows null MYSQL_STMT handles to be passed to
mysql_stmt_close(). Added a sanity check test case that should guard
against this happening in the future.
2024-11-07 07:34:12 +02:00
Georg Richter
2cc31e8768 Disable TLSv1.0 test
New schannel implementation requires TLSv1.2 or TLSv1.3
2024-08-31 08:27:48 +02:00
Georg Richter
1287c901dc TLS/SSL changes (major rework)
Peer certificate validation:

Since version 3.4 peer certificate verification is enabled by default.
It can be disabled via `mysql_optionsv`, using option
MYSQL_OPT_SSL_VERIFY_SERVER_CERT:

    my_bool verify= 0;
    mysql_options(mariadb, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, &verify);

Self signed certificates

If the client obtained a self signed peer certificate from MariaDB server
the verification will fail, with the following exceptions:

* If the connection between client and server is considered to be secure:, e.g.
  * a unix_socket is used for client server communication
  * hostname is localhost (Windows operating system), 127.0.0.1 or ::1
* a specified fingerprint matches the fingerprint of the peer certificate (see below)
* a client can verify the certificate using account password, it's possible if
  * account has a password
  * authentication plugin is "secure without TLS", that is, one of
    mysql_native_password, ed25519 or parsec.

Fingerprint verification of the peer certificate

A fingerprint is a cryptographic hash (SHA-256, SHA-384 or SHA-512) of the peer
certificate's binary data. Even if the fingerprint matches, an expired or
revoked certificate will not be accepted.

For security reasons support for MD5 and SHA1 has been removed.

Technical details:
==================

- Peer certificate verification call was removed from ma_tls_connect, instead it
  will be called directly after the handshake succeeded (my_auth.c)

- mysql->net.tls_self_signed_error was replaced by mysql->net.tls_verify_status which
  contains the result of the peer certfificate verification:

  The verification status can be obtained with mariadb_get_infov using new parameter
  MARIADB_TLS_VERIFY_STATUS.

  unsigned int tls_verify_status;
  mariadb_get_infov(mysql, MARIADB_TLS_VERIFY_STATUS, &tls_verify_status);

  The result is a combination of the following flags:

  MARIADB_TLS_VERIFY_OK                  0
  MARIADB_TLS_VERIFY_TRUST               1
  MARIADB_TLS_VERIFY_HOST                2
  MARIADB_TLS_VERIFY_PERIOD              4
  MARIADB_TLS_VERIFY_FINGERPRINT         8
  MARIADB_TLS_VERIFY_REVOKED            16
  MARIADB_TLS_VERIFY_UNKNOWN            32

- GnuTLS peer certificate verification callback was removed and replaced by
  gnutls_verify_peers2() api function, so the peer certificate validation
  will happen after handshake.

- OpenSSL implementation will no longer use SSL_verify_result to check the
  validity of the peer certificate. Instead a callback function will be called
  during the handshake, which collects all certificate validation errors.

- If the peer certificate is not trusted, hostname verification will be
  skipped.

- Testing
  Added new test tls, which implements a python based dummy server, which allows
  to set different certificates and TLS options. Please note. that tests are
  expected to fail, since the server doesn't support further steps like user
  authentication etc. after the handshake. Prerequisite for running the tls test
  is Python3.
2024-07-16 13:12:26 +02:00
Georg Richter
f97bb2e92e Fix failing tests when server runs on a different machine 2024-06-10 13:19:49 +02:00
Georg Richter
4a74f8784d Fix compiler warning in unittest/misc.c 2024-02-23 06:54:22 +01:00
Georg Richter
fe411bf336 CONC-403:
Remove support of TLSv1.0 protocol
2024-02-20 09:52:07 +01:00
Georg Richter
29a8156193 Skip test_bug49694 when testing with Xpand.
local_infile variable is not supported by XPand (XPT-600).
2023-02-18 08:49:25 +01:00
Georg Richter
2105a2bc7f Skip tests when testing with Xpand. 2023-02-18 08:39:10 +01:00
Georg Richter
80f18e417f SKIP debug test if testing with Xpand. 2023-02-18 08:33:49 +01:00
diego Dupin
fb85d99d13 Adding xpand to test suite 2022-03-23 11:46:40 +01:00
Georg Richter
3fe2f50545 Merge branch '3.1' into 3.2 2022-01-25 03:51:45 +01:00
Georg Richter
49a22c269a Merge pull request #153 from Antchel/3.1
test fixes
2022-01-23 21:08:32 +01:00
Marko Mäkelä
8574d0b840 Merge 3.1 into 3.2 2021-10-05 16:59:15 +03:00
Marko Mäkelä
33853036dd fixup 9c02505474: build failure outside clang 2021-10-05 16:48:31 +03:00
Georg Richter
2933a1ca75 Merge branch '3.1' into 3.2 2021-10-05 15:19:59 +02:00
Georg Richter
9c02505474 Fixed for MDEV-26761:
If mariadb_stmt_execute_direct fails, we need to set the number
of parameters (obtained by response packet of mysql_stmt_prepare)
back to the number of prebinded parameters to avoid memory
overrun.

This fix also includes several adress-sanitizer bugs in unit tests
of Connector/C.
2021-10-05 14:50:32 +02:00
Georg Richter
547fc4987b Post-merge fix:
Prevent double freeing of result set
2021-07-26 18:10:34 +02:00
Georg Richter
61a2ae2705 Merge branch '3.1' into 3.2 2021-07-26 18:05:17 +02:00
Marko Mäkelä
490100ccac CONC-49 fixup
test_conc49(): Do not leak memory.
2021-07-22 15:55:45 +03:00
Vladislav Vaintroub
7d3d7c5ff4 Fix GCC's "ISO C90 forbids mixed declarations and code" 2021-07-20 10:55:07 +02:00
Georg Richter
4853464ed2 Test case fixes:
- remove table af end of test
- fixed memory leak (missing mysql_free_result)
2021-07-09 06:38:28 +02:00
Sergei Golubchik
fffa8167d8 ISO C90 forbids mixed declarations and code 2021-07-05 12:43:06 +02:00
Georg Richter
353e99fba1 More test fixes 2021-06-24 12:48:16 +02:00
kolzeq
25e38080cb Merge branch '3.1' into 3.2-diego
# Conflicts:
#	.travis.yml
#	unittest/libmariadb/charset.c
#	unittest/libmariadb/connection.c
2021-06-17 10:54:30 +02:00
Georg Richter
85c3742252 Follow up of dec061fa95
Use EVP_PKEY_set1_RSA() instead of EVP_PKEY_assign_RSA, since
the public key will be freed when releasing pkey-
2021-06-16 16:13:14 +02:00
kolzeq
94e85cdd4b testing various correction
travis: use connector-test-machine test script that permit to run the following tests :

* MariaDB all supported version
* Maxscale
* MySQL
* SkySQL

If CONNECTOR_TEST_SECRET_KEY is not provided (PR) only MariaDB and MySQL community will be test
Pull request testing correction

appveyor correction using archive if not latest server release
2021-06-15 17:09:10 +02:00
Georg Richter
e4e5b28452 CONC-533: Support for asynchronous statements (binary protocol)
Added a new option MARIADB_OPT_SKIP_READ_RESPONSE which skips automatic
reading of server response after sending a command to the server.

Server packets have to be retrieved by calling the corresponding methods,
e.g:

Send command                         Read method
mysql_real_query/mysql_send_query    db_read_query_result
mysql_stmt_prepare                   db_read_prepare_response
mysql_stmt_execute,
mariadb_stmt_execute_direct          db_read_execute_response
2021-05-13 21:21:43 +02:00
Oleksandr Byelkin
b503e52288 fix problems found by 10.0 2021-01-27 13:13:31 +01:00
Anton Golovenko
a7e888b518 Test bugs fixes 2021-01-20 18:54:55 +05:00
kolzeq
29fc3bc7bd [misc] test improvement
* adding SkySQL HA to test suite
* test server build 10.6
* test maxscale 2.5.3
2021-01-19 10:23:14 +01:00
Georg Richter
8a4fac7f22 unittest fix:
Added macro SKIP_NOTLS for skipping tests if MariaDB Connector/C
was build without TLS support.
2020-10-23 06:39:15 +02:00
Georg Richter
9637689e5e Test and travis modification for testing against SkySQL 2020-09-02 14:08:19 +02:00
Georg Richter
960dca55ae Travis fixes:
server verification still fails due to wrong hostname - these tests are now disabled for Travis only
Disable test when testing against a MySQL server.
2020-03-16 14:02:12 +01: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
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
Marko Mäkelä
68e6c5bd67 CONC-394: The unit test does not compile on Windows 2019-05-05 22:40:45 +03: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
Sergei Golubchik
4aad20db15 Merge tag 'v3.0.9' into 3.1 2019-02-18 20:16:23 +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
Georg Richter
3ab17c0310 Fix compiler warning (gcc-8.1) 2019-02-03 17:26:24 +01:00