1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-11 15:22:09 +03:00
Commit Graph

2967 Commits

Author SHA1 Message Date
929c2e06aa MDEV-31531 Remove my_casedn_str() and my_caseup_str()
Under terms of MDEV 27490 we'll add support for non-BMP identifiers
and upgrade casefolding information to Unicode version 14.0.0.
In Unicode-14.0.0 conversion to lower and upper cases can increase octet length
of the string, so conversion won't be possible in-place any more.

This patch removes virtual functions performing in-place casefolding:
  - my_charset_handler_st::casedn_str()
  - my_charset_handler_st::caseup_str()
and fixes the code to use the non-inplace functions instead:
  - my_charset_handler_st::casedn()
  - my_charset_handler_st::caseup()
2024-02-28 22:20:29 +04:00
1b37cb71f4 MDEV-32975 Default charset doesn't work with PHP MySQLi extension
When sending the server default collation ID to the client
in the handshake packet, translate a 2-byte collation ID
to the ID of the default collation for the character set.
2024-02-26 15:39:13 +04:00
a5998145ba Record correct mutex (LOCK_STATUS and acl_cache) order for debugging. 2024-02-20 14:18:51 +01:00
fa69b085b1 Merge branch '11.3' into 11.4 2024-02-15 13:53:21 +01:00
85517f609a MDEV-33393 audit plugin do not report user did the action..
The '<replication_slave>' user is assigned to the slave replication
thread so this name appears in the auditing logs.
2024-02-14 00:02:29 +04:00
85f9df29c0 sql_show: reduce ifdefs around grants checks
Embedded server has an option to opt out grant checks.
sql_show.cc: reduce ifdefs by using embedded acl stub calls
sql_acl.cc: add stub for embedded get_column_grant
2024-02-12 22:26:06 +01:00
1ef1bab99e MDEV-31855 validate ssl certificates using client password
if the client enabled --ssl-verify-server-cert, then
the server certificate is verified as follows:

* if --ssl-ca or --ssl-capath were specified, the cert must have
  a proper signature by the specified CA (or CA in the path)
  and the cert's hostname must match the server's hostname.
  If the cert isn't signed or a hostname is wrong - the
  connection is aborted.

* if MARIADB_OPT_TLS_PEER_FP was used and the fingerprint matches,
  the connection is allowed, if it doesn't match - aborted.

* If the connection uses unix socket or named pipes - it's allowed.
  (consistent with server's --require-secure-transport behavior)

otherwise the cert is still in doubt, we don't know if we can trust
it or there's an active MitM in progress.

* If the user has provided no password or the server requested an
  authentication plugin that sends the password in cleartext -
  the connection is aborted.

* Perform the authentication. If the server accepts the password,
  it'll send SHA2(scramble || password hash || cert fingerprint)
  with the OK packet.

* Verify the SHA2 digest, if it matches - the connection is allowed,
  otherwise it's aborted.
2024-02-04 22:18:55 +01:00
d21cb43db1 Merge branch '11.2' into 11.3 2024-02-04 16:42:31 +01:00
ec5403ffb3 clarify CR_OK_HANDSHAKE_COMPLETE
it's for client auth plugins only, server auth plugin should never
return it, because they cannot send a correct OK packet.
(OK packet is quite complex and carries a lot of information that
only the server knows)
2024-02-03 11:22:20 +01:00
79580f4f96 Merge branch '11.1' into 11.2 2024-02-02 17:43:57 +01:00
9374772ecd Merge 10.11 into 11.0 2024-01-19 09:07:48 +02:00
ad13fb36bf Merge 10.6 into 10.11 2024-01-17 17:37:15 +02:00
d06b6de305 Merge branch '10.5' into 10.6 2024-01-11 12:59:22 +11:00
c9902a20b3 Merge branch '10.4' into 10.5 2024-01-10 18:01:46 +11:00
613d019497 MDEV-33160 show_status_array() calls various functions via incompatible pointer
In commit b4ff64568c the
signature of mysql_show_var_func was changed, but not all functions
of that type were adjusted.

When the server is configured with `cmake -DWITH_ASAN=ON` and
compiled with clang, runtime errors would be flagged for invoking
functions through an incompatible function pointer.

Reviewed by: Michael 'Monty' Widenius
2024-01-04 12:50:05 +02:00
54ed3939f7 MDEV-31657 Crash on query using CTE with the same name as a base table
If a query contained a CTE whose name coincided with the name of one of
the base tables used in the specification of the CTE and the query had at
least two references to this CTE in the specifications of other CTEs then
processing of the query led to unlimited recursion that ultimately caused
a crash of the server.

Any secondary non-recursive reference to a CTE requires creation of a copy
of the CTE specification. All the references to CTEs in this copy must be
resolved. If the specification contains a reference to a base table whose
name coincides with the name of then CTE then it should be ensured that
this reference in no way can be resolved against the name of the CTE.
2024-01-03 09:57:39 -08:00
7f0094aac8 Merge branch '11.2' into 11.3 2023-12-21 02:14:59 +01:00
fef31a26f3 Merge branch '11.1' into 11.2 2023-12-20 23:43:05 +01:00
8c8bce05d2 Merge branch '10.11' into 11.0 2023-12-19 15:53:18 +01:00
fd0b47f9d6 Merge branch '10.6' into 10.11 2023-12-18 11:19:04 +01:00
e95bba9c58 Merge branch '10.5' into 10.6 2023-12-17 11:20:43 +01:00
98a39b0c91 Merge branch '10.4' into 10.5 2023-12-02 01:02:50 +01:00
96250c8269 Merge 11.1 into 11.2
Fix old_mode flags conflict between OLD_MODE_NO_NULL_COLLATION_IDS
and OLD_MODE_LOCK_ALTER_TABLE_COPY.

Both flags used to be 1 << 6, now OLD_MODE_LOCK_ALTER_TABLE_COPY changed
to be 1 << 7
2023-11-30 22:12:31 +01:00
b42f318996 Merge 10.11 into 11.0 2023-11-30 19:12:01 +01:00
9d07b0520c MDEV-31608 - Connector/NET fails to connect since 10.10
Connector/NET does not expect collation IDs returned by "show collations"
to be NULL, runs into an exception.

The fix is to determine connector/net using its connection attributes,
then make sure "show collations" does not output NULL IDs.

The patch introduces new old_mode NO_NULL_COLLATION_IDs, that is
automatically set, once MySQL Connector/NET connection is determined.

A test was added, that uses MySql.Data from powershell - only works
if MySql.Data is installed into GAC (i.e with C/NET MSI package)
2023-11-30 13:53:45 +01:00
02701a8430 Merge 11.2 into 11.3 2023-11-28 11:19:50 +02:00
0d29f3759c Merge 11.1 into 11.2 2023-11-28 11:19:06 +02:00
9e424b6290 MENT-1707 Crash at reload_acl_and_cache
The stack function trace for this bug is:

libc
my_free
free_root
acl_reload

The crash happens because acl_memroot gets corrupted.

The issue was that during FLUSH PRIVILEGES we discard the old
privileges and create new ones. We have protection in place that no
one can accesses the privileges during this time.

However one short piece of code called during login of a new user, or
change password, was not properly protected, which could in some very
rare circumstances case a memory overwrite of a MEMROOT object if
at the same time another thread calls FLUSH PRIVILEGES.

This it issue is fixed by adding protection around set_user_salt().
I also added asserts to other code that is using the acl_memroot to
ensure that it is properly proteced everywhere.
2023-11-27 19:08:14 +02:00
5b6134b040 Merge 10.11 into 11.0 2023-11-24 11:20:56 +02:00
90d968dab9 Merge 10.6 into 10.11 2023-11-20 10:08:19 +02:00
52ca2e65af Merge 10.5 into 10.6 2023-11-15 14:10:21 +02:00
34272bd6a5 Merge branch '11.2' into 11.3 2023-11-14 18:33:03 +01:00
0427c4739e Merge tag '11.1' into 11.2
MariaDB 11.1.3 release
2023-11-14 18:28:37 +01:00
9f83a8822f Merge branch '10.5' into mariadb-10.5.23 2023-11-14 08:41:23 +01:00
48af85db21 Merge branch '10.11' into 11.0 2023-11-08 17:09:44 +01:00
fecd78b837 Merge branch '10.10' into 10.11 2023-11-08 16:46:47 +01:00
04d9a46c41 Merge branch '10.6' into 10.10 2023-11-08 16:23:30 +01:00
b83c379420 Merge branch '10.5' into 10.6 2023-11-08 15:57:05 +01:00
6cfd2ba397 Merge branch '10.4' into 10.5 2023-11-08 12:59:00 +01:00
ee77375377 MDEV-26875: Wrong user in SET DEFAULT ROLE error
- Regression introduced in 957cb7b7ba
- Patch 4abb8216a0 change `mysql.user` to `mysql.global_priv` for
`add_anonymous.inc`, update `delete_anonymous.inc`.
- Added test case with `--skip-name-resolve`
- Add test case with anonymous user
  - Disable this test for windows, assignes current user to anonymous
  user.

Reviewed by: <serg@mariadb.com>
2023-10-30 18:39:56 +01:00
7b842f1536 Merge 11.2 into 11.3 2023-10-27 10:48:29 +03:00
2eee0e9b89 cleanup: mainly formatting, plus one helper 2023-10-23 17:40:03 +02:00
53cdfbd1da MDEV-29167 new db-level SHOW CREATE ROUTINE privilege 2023-10-17 21:52:39 +02:00
a05b5dd505 MDEV-32123: require_secure_transport doesn't allow TCP connections
In case the option require_secure_transport is on the user can't
establish a secure ssl connection over TCP protocol. Inability to set up
a ssl session over TCP was caused by the fact that a type of client's
connection was checked before ssl handshake performed (ssl handshake
happens at the function acl_authenticate()). At that moment vio type has
the value VIO_TYPE_TCPIP for client connection that uses TCP transport.
In result, checking for allowable vio type for fails despite the fact
that SSL session being established. To fix the issue move checking of
vio type for allowable values inside the function
  parse_client_handshake_packet()
right after client's capabilities discovered that SSL is not requested
by the client.
2023-10-11 14:47:05 +07:00
28b4037242 Merge branch '11.2' into 11.3 2023-09-21 14:15:04 +04:00
cb37c99dd8 MDEV-32019 Replace my_casedn_str(local_buffer) to CharBuffer::copy_casedn()
Replacing my_casedn_str() called on local char[] buffer variables
to CharBuffer::copy_casedn() calls.

This is a sub-task for MDEV-31531 Remove my_casedn_str()

Details:
- Adding a helper template class IdentBuffer (a CharBuffer descendant),
  which assumes utf8 data. Like CharBuffer, it's initialized to an empty
  string in the constructor, but can be populated with lower-cased data
  later.

- Adding a helper template class IdentBufferCasedn, which initializes
  to lower case right in the constructor.

- Removing char[] buffers, replacing them to IdentBuffer and IdentBufferCasedn.

- Changing the data type of "db" and "table" parameters from
  "const char*" to LEX_CSTRING in the following functions:

    find_field_in_table_ref()
    insert_fields()
    set_thd_db()
    mysql_grant()

  to reuse IdentBuffer easeir.
2023-08-26 17:46:14 +04:00
18ddde4826 Merge branch '11.1' into 11.2 2023-08-18 00:59:16 +02:00
51f9d62005 Merge branch '10.11' into 11.0 2023-08-09 07:53:48 +02:00
036df5f970 Merge branch '10.10' into 10.11 2023-08-08 14:57:31 +02:00
34a8e78581 Merge branch '10.6' into 10.9 2023-08-04 08:01:06 +02:00