1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-09-11 08:30:59 +03:00

1089 Commits

Author SHA1 Message Date
Georg Richter
acb73df26c Check result of COM_REGISTER_SLAVE and set error message
if it fails.
2023-02-22 15:08:24 +01:00
Georg Richter
49ecb8bd2c Fix for semisync replication:
clear network buffer before sending the
reply packet to the server.
2023-02-22 13:55:41 +01:00
Georg Richter
dbb4d8d93b Fixed segfault:
Use rpl->host and port instead of mysql->options.
2023-02-22 11:32:21 +01:00
Georg Richter
9890d34612 Remove ma_global.h (which is not included in package)
from mariadb_rpl include file.
2023-02-22 09:14:43 +01:00
Georg Richter
ece593f571 Merge branch '3.3-rpl' into 3.3 2023-02-21 17:11:56 +01:00
Georg Richter
87bd5bfc34 Removed decryption stuff from rpl api 2023-02-12 14:26:02 +01:00
Georg Richter
e4417e725e Merge branch '3.1' into 3.3 2023-02-09 08:57:48 +01:00
Georg Richter
669726a1d9 Fix for CONC-633:
If prepare step failed in mariadb_stmt_execute_direct now both
mysql_stmt_error and mysql_error return the error message from
prepare step instead of error message of execute.
2023-02-08 12:21:22 +01:00
Georg Richter
75439c0f39 CONC-632
When resetting the connection with mysql reset_connection(), the
server_status must be checked and any other resultsets that mayi
exist must be removed.
2023-02-08 11:46:39 +01:00
Georg Richter
d204e83104 Return correct client library version number instead of
server number in mysql_get_client_versio
2023-01-16 14:14:59 +01:00
Georg Richter
d712484dab Set MARIADB_PACKAGE_VERSION instead of
MARIADB_CLIENT_VERSION_STR for obtaining client_info.
2023-01-16 13:56:22 +01:00
Georg Richter
12bd1d5511 Merge branch '3.1' into 3.3 2023-01-16 12:12:46 +01:00
Georg Richter
895235815c Fix for CONC-627:
Don't substitute parameters in server error messages in
prepeated statement error handler function.
2023-01-16 11:13:00 +01:00
Georg Richter
bb5abd096d Merge branch '3.1' into 3.3 2023-01-16 08:16:13 +01:00
Georg Richter
173112ceaf Fix for CONC-626:
Fixed possible memory leak in mariadb_stmt_execute if realloc of
data buffer failed.
2023-01-16 08:11:02 +01:00
Georg Richter
5f6133653d Fix for CONC-623:
If callback function returns a non zero return code, execute
will now abort with error CR_ERR_STMT_PARAM_CALLBACK.
2023-01-15 15:12:38 +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
b9e9758e93 Fix for CONC-625
Fixed error numbers in comments.
2023-01-13 16:32:03 +01:00
Georg Richter
da9bb98c0c CONC-622: Fix double free() if asnyc connect failed
If mysql_real_connect_start/cont failed, we need to
set async->pvio to zero after calling ma_pvio_close
to avoid double free() in mysql_close.
2022-12-27 14:36:44 +01:00
Julius Goryavsky
57852875f1 MDEV-29817: Issues with handling options for SSL CRLs (and some others)
This commit fixes a bug related to reading the value of the ssl_cipher
instead of ssl_crl, and also adds handling of the forgotten tls_version
option.
2022-11-22 15:52:55 +01:00
Georg Richter
d9af4fcbc6 Merge branch '3.1' into 3.3 2022-11-07 09:09:29 +01:00
Georg Richter
4dca917b7e Added support for all (?) events
- All (MariaDB and MySQL) events are now supported
- Added new api functions:
  - mariadb_rpl_error: returns error message
  - mariadb_rpl_errno: returns error number
  - mariadb_rpl_extract_rows: extract values of
    ROW_EVENTS
- Added decryption support
- Added uncompression
  -
2022-09-26 09:20:07 +02:00
Sergei Golubchik
ad43ed2965 better error on aborted connection
according to `man SSL_get_error`

  The SSL_ERROR_SYSCALL with errno value of 0 indicates unexpected EOF
  from the peer. This will be properly reported as SSL_ERROR_SSL with
  reason code SSL_R_UNEXPECTED_EOF_WHILE_READING in the OpenSSL 3.0
  release because it is truly a TLS protocol error to terminate the
  connection without a SSL_shutdown().

let's use a conventional CR_SERVER_LOST in this case instead of
"TLS/SSL error: Success(0)"
2022-09-13 16:07:25 +02:00
Haidong Ji
020ed982b6 More robust call to X509_check_host using strlen not 0
Based on its interpretation of RFC 6125 section 6.4.2[^1], OpenSSL's
implementation[^2] of `X509_check_host` treats the `namelen` parameter
in a peculiar way:

- If `namelen` is non-zero, use it;
- Otherwise, use `strlen(name)` instead

There are now many forks of OpenSSL. Implementer of the forks may
interpret RFC 6125 section 6.4.2 a little differently. They may always
expect `strlen(name)` and NOT `0`. We have come across that with
AWS-LC[^3].  AWS-LC has agreed to make an adjustment so it is consistent
with OpenSSL in this matter. But other forks may not.

To make MariaDB connector C more robust, I think it's better that we
always pass `strlen(name)` instead of `0`. Unless there are compelling
reasons not doing so.

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer Amazon Web
Services, Inc.

[^1]: https://www.rfc-editor.org/rfc/rfc6125.html#section-6.4.2
[^2]: https://www.openssl.org/docs/man3.0/man3/X509_check_host.html
[^3]: https://github.com/awslabs/aws-lc
2022-09-05 19:43:57 +00:00
Georg Richter
9c2e470825 PL fixes 2022-08-30 17:39:36 +02:00
Georg Richter
c15a973016 Fixed crash
Fixed crash which was introduced by 1bd8c8bf39
2022-08-25 16:20:48 +02:00
Georg Richter
1bd8c8bf39 Added missing status callbacks outside of ma_read_ok_packet 2022-08-11 16:56:06 +02:00
Georg Richter
a6665e65c0 Clear error before reading ok packet 2022-08-03 17:57:15 +02:00
Georg Richter
630919e1d0 MSVC Build: treat warning as errors
Added option /WX which returns warnings
as errors, except for budled zlib.
2022-08-03 11:46:35 +02:00
Georg Richter
9fe6541507 Windows build fix:
Added missing include file w2tcpip.h for
freeaddrinfo prototype
2022-08-03 11:26:57 +02:00
Georg Richter
5b4c493f78 Merge branch '3.3' of https://github.com/mariadb-corporation/mariadb-connector-c into 3.3 2022-08-03 12:00:03 +02:00
Georg Richter
0682f2284c Merge branch '3.1' into 3.3 2022-08-03 11:59:57 +02:00
Georg Richter
64ebd5818a Follow up for status/session_track callback:
- changed data type to MARIADB_CONST_STRING
- allow setting callback function and/or data ptr
2022-08-02 15:19:39 +02:00
Georg Richter
28df8a73b6 Merge branch '3.3-status' into 3.3 2022-08-02 10:20:19 +02:00
Georg Richter
a8832afa2a status and session_tracik callback function:
This feature allows client applications to register a callback function,
which is called as soon as the server status changes or session_track
information was sent by the server.

Registration is handled via mysql_optionsv() API function:

mysql_optionsv(mysql, MARIADB_OPT_STATUS_CALLBACK, function, data)

The callback function must be defined as follws:

void status_callback(void *data, enum enum_mariadb_status_info type, ..)

  Parameters:
    - data  Pointer passed with registration of callback function
            (usually a connection handle)
    - type  Information type  STATUS_TYPE or SESSION_TRACK_TYPE

  Variadic Parameters:

  if (type == STATUS_TYPE):
    - server status (unsigned int)

  if (type == SESSION_TRACK_TYPE)
    - enum enum_session_state_type track_type - session track type

    if (track_type == SESSION_TRACK_SYSTEM_VARIABLES)
      - MARIADB_CONST_STRING *key
      - MARIADB_CONST_STRING *value

    else
      - MARIADB_CONST_STRING *value

An example can be found in connection.c (test_status_callback)
2022-08-02 10:10:50 +02:00
Georg Richter
dcb14e3c5d erge branch '3.1' into 3.3 2022-08-01 12:26:27 +02:00
Georg Richter
9db7314acd Fixed typo in ma_errmsg.h 2022-07-27 15:00:46 +02:00
Georg Richter
12722e3131 Error message fix:
Since TLS errors might happen not only when connecting and SSL protocol
is not longer used, errormessage for CR_SSL_CONNECTION_ERROR was replaced
by TLS/SSL error.
2022-07-27 14:52:20 +02:00
Alexander Barkov
df6feae0df Libmariadb changes for MDEV-27009 Add UCA-14.0.0 collations 2022-07-27 12:56:56 +04:00
Georg Richter
274f2face2 Merge pull request #199 from hyung-hwan/3.3
enhanced mysql_close_slow_part() and other related parts to prevent memory leaks in the non-blocking mode
2022-07-25 09:22:04 +02:00
Georg Richter
6dbd953420 Merge branch '3.1' into 3.3 2022-07-24 10:52:52 +02:00
Georg Richter
8e8d175a64 Fix gnutls error message:
When using default error string (2026), a zero ptr
for error message needs to be specified.
2022-07-22 08:16:25 +02:00
Georg Richter
4830ed8379 Windows build fixes 2022-07-21 12:15:16 +02:00
Georg Richter
6a67ed631d Don't prefix error message 2026 (SSL connection error) with TLS
Removed prefix, since there are too many error test failing now,
which check the error string and not the error number
2022-07-21 11:26:32 +02:00
Georg Richter
6700ee4a7c Make TLS/SSL more verbose:
Added TLS/SSL prefixes for error strings
Report Error string for errno
2022-07-21 09:47:23 +02:00
Georg Richter
cdb6e90c35 Fix for CONC-608: Replace server error codes
Since Connector/C is not able to retrieve
error strings for server error codes, the following
error codes were replaced:

- ER_NET_PACKET_TOO_LARFE by CR_NET_PACKET_TOO_LARGE
- ER_OUT_OF_RESOURCES by CR_OUT_OF_MEMORY
- ER_NET_WRITE_ERROR by CR_ERR_NET_WRITE (new constant)
- ER_NET_UNCOMPRESS_ERROR by CR_ERR_NET_UNCOMPRESS (new constant)
2022-07-21 09:11:29 +02: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
dac298de61 CONC-605: Disable sigpipe
Added option GNUTLS_NO_SIGNAL in gnutls_init options to disable
SIGPIPE errors on platforms which support MSG_NOSIGNAL.
2022-07-11 07:53:31 +02:00