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

76 Commits

Author SHA1 Message Date
Georg Richter
189c2318b5 Add diagnostic output for ci test 2025-06-24 10:53:01 +02:00
rusher
1bf3571146 [TODO-5373] add github action 2025-06-16 19:43:16 +02:00
Georg Richter
b38e872003 Text fixes:
Fixed windows test (missing parameter)
Check if we need to connect via SSL port (Travis)
2025-03-05 13:39:22 +01: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
5eea40fecf Merge branch '3.3' into 3.4 2024-12-16 15:25:50 +01:00
Georg Richter
dc8bc987d4 Test fix for character test conc223:
Show the missing collation IDs instead
of the total number of missing collations.

Patch submitted by Michael "Monty" Widenius.
2024-12-16 13:50:00 +01:00
Georg Richter
e7b6adfbf9 Simplify tls_verification_callback 2024-09-10 07:19:12 +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
bf0d299ae4 Text fix: Avoid crash in non TLS connections 2024-04-30 12:04:15 +02:00
Georg Richter
c6fa37300a Fix SKIP_TLS macro (unittest)
Since in 3.4 we use TLS connections by default, so checking force_tls
is not enough. We also need to check if fingerprint was set.
2024-04-30 11:33:04 +02:00
Georg Richter
a63b826195 test fix: Always specify fingerprint for TLS connections 2024-04-30 11:06:09 +02:00
Georg Richter
86e2e87fa2 Follow up of fix for CONC-680:
mysql_old_password is disabled by default (setting DISABLED YES),
but can be used if the plugin was added to the list of restricted
authentication plugins (via mysql_optionsv using option
MARIADB_OPT_RESTRICTED_AUTH).
2024-03-10 14:04:27 +01:00
rusher
dd927bd171 Update server test suite 2023-08-30 09:52:22 +02:00
Georg Richter
1acb81e11c Build fixes:
- Fixed build error, which was previously introduced by commit
c8ca89112e

- Treat warnings as errors
2023-08-16 14:09:34 +02:00
Georg Richter
780c330f38 Since we can't determine if load data local is
suppoerted by Xpand, we skip it for now.
2023-02-17 11:23:22 +01:00
Georg Richter
abea2dfa6b Merge branch '3.1' into 3.3 2023-01-15 14:27:41 +01:00
Georg Richter
bf82b2d8cb Fix for CONC-624:
- ER() macro now checks if the error code is known, if not it will return
  "Unknown or undefined error code" (instead of crashing)
- SET_CLIENT_STMT_ERROR now maps to stmt_set_error and accepts variadic
  arguments
2023-01-15 14:11:54 +01:00
Georg Richter
e8e356e355 Merge branch '3.1' into 3.3 2022-07-18 11:48:33 +02:00
Georg Richter
9a572bc548 Fix for CONC-604 and CONC-605:
This patch fixes a crash when reconnectiong via TLS.
2022-07-18 11:41:46 +02:00
Georg Richter
0d20e47fe5 unittests: print server tls information 2022-04-28 13:10:44 +02:00
Georg Richter
f60a31b5a8 Debug information for tests:
Print tls releated server variables
2022-04-21 11:59:14 +02:00
diego Dupin
fb85d99d13 Adding xpand to test suite 2022-03-23 11:46:40 +01:00
Georg Richter
bc9458893f Merge branch '3.1' into 3.2 2022-03-01 11:28:33 +01:00
Georg Richter
abc1cf89f1 Test fix:
For detecting if we test against MaxScale check also if
mysql_get_server_info contains "maxScale".
2022-03-01 10:23:34 +01:00
Georg Richter
16a031945a Merge branch '3.1' into 3.2 2021-06-24 16:49:15 +02:00
Georg Richter
d111980380 Fix for MDEV-25820:
Tests will be skipped unless the following environment variables
were specified:

- MYSQLTEST_VARDIR (will be automatically set when running inside
  mtr)
- MARIADB_CC_TEST
2021-06-24 16:44:21 +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
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
Rucha Deodhar
2f7230c62b MDEV-8334: Rename utf8 to utf8mb3
This patch is made as a part of MDEV-8334 to fix failing test in unit and
main test suite so that utf8mb3 characterset is recognized. Failing tests:
main.mysql_client_test
main.mysql_client_test_comp
unit.conc_basic-t
unit.conc_charset
unit.conc_connection
2021-04-17 02:10:25 +05:30
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
b24d337027 More test fixes:
Always provide a message to the FAIL_ macros
2020-10-20 16:17:25 +02:00
Georg Richter
9637689e5e Test and travis modification for testing against SkySQL 2020-09-02 14:08:19 +02:00
Vicențiu Ciorbaru
ee5c10b919 MDEV-14811 unit.conc_misc fails in buildbot on bld-starfs-release in test_conc49
Make sure sql_mode is cleared when starting a new connection.

The problem:
When a test is skipped and there was an error in the last sql statement
sent on the default connection, the mysql_default connection is
recreated, but without sql_mode set to ''.

This leads to sql_mode having NO_ENGINE_SUBSTITUTION set.
test_conc49 tries to create an InnoDB table, but if the previous test
(in this particular case test_connect_attrs) is skipped and it errored
(in this case because it tried selecting from a performance schema
table that did not exist), it will recreate the mysql_default
connection via test_connect before running test_conc49.

Fix by making sure test_connect clears the sql_mode, just like
reset_connection, which is normally called between successful test
runs.
2020-06-18 21:53:00 +03:00
Oleksandr Byelkin
895dcb61e3 C preprocessor defines fix 2020-06-04 16:49:21 +02:00
Georg Richter
6552b294e4 Fix for previous commit 2020-03-16 14:27:11 +01: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
b5bd0e5818 Merge commit '77d051e89d0b342333d951e66e53f2aea43f6e36' into 3.1 2019-07-16 17:33:00 +02:00
Georg Richter
77d051e89d Windows build fixes for OpenSSL 2019-07-16 08:52:24 +02:00
Georg Richter
8473246541 Fix authentication tests:
- specify correct plugin type for checks
- allow access to test schema for ed25519 user
2019-03-04 17:06:00 +01:00
Sergei Golubchik
a4effc462d fix connection unit test to work in mtr 2019-02-04 16:05:41 +01: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
83eef02ec8 Test fixes:
for api functions which require string with length parameter (e.g.
  mysql_real_connect() or mysql_stmt_prepare() we now use the macro
  SL(string) which substitutes string and string length.
2018-02-16 13:05:35 +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
99d054ebad Fix for MDEV-12578: Connector/C doesn't read .my.cnf file in home directory.
After lookup in standard directories C/C now also checks in home directory for
configuration file .my.cnf
2017-05-07 07:46:43 +02:00
Georg Richter
4ab155cf39 Unit test fixes for server integration
- SSL tests require CERT_PATH. Subdirectory certs was removed. If Connector/C is build outside of the server tree, certification path has to be specified manually (-DCERT_PATH=/path/to/certs).
- All tables and users will removed, if the test passed (otherwise mtr will complain).
2017-03-04 17:37:39 +01:00
Georg Richter
fd005f9bc1 Fixed exit code in case the test can't connect 2017-01-04 12:44:08 +01:00
Georg Richter
967b2830d8 renamed ma_errmsg.h back to errmsg.h 2016-11-16 18:13:59 +01:00