82 Commits

Author SHA1 Message Date
Markus Mäkelä
5c5c6630bf
Fix retain_last_statements
If multiple statements were stored in a single buffer only one of them
would get registered.
2019-03-08 14:45:18 +02:00
Markus Mäkelä
a469ef83b6
MXS-2217: Pick DCB owner before adding to epoll
There is a race condition between the addition of the DCB into epoll and
the execution of the event that initiates the protocol pointer for the DCB
and sends the handshake to the client. If a hangup event would occur
before the handshake would be sent, it would be possible that the DCB
would get freed before the code that sends the handshake is executed.

By picking the worker who owns the DCB before the DCB is placed into the
owner's epoll instance, we make sure no events arrive on the DCB while the
control is transferred from the accepting worker to the owning
worker.
2019-01-17 10:35:49 +02:00
Markus Mäkelä
26da72a41f
Merge branch '2.2' into 2.3 2019-01-03 09:23:16 +02:00
Markus Mäkelä
8f0e4a3034
MXS-2232: Fix version string prefix check
The prefix was always added even when the original version would've been
acceptable. For example, a version string of 5.5.40 would get converted to
5.5.5-5.5.40 which is quite confusing for older client applications.
2019-01-02 19:29:48 +02:00
Markus Mäkelä
04dd05b262
MXS-2231: Move TLS handshake code into MariaDBClient
The code is now in the correct place and TLS connections with all
authenticators should now work.
2019-01-02 19:29:41 +02:00
Markus Mäkelä
81937c635b
Fix current command tracking during LDLI
When a LOAD DATA LOCAL INFILE was executed, the client and backend
protocols would update the command byte leading to misinterpretations of
the data.
2018-11-27 12:52:44 +02:00
Markus Mäkelä
433c6708bf
Merge branch '2.2' into 2.3 2018-11-13 17:35:45 +02:00
Markus Mäkelä
fb84b2690a
MXS-2159: Combine client capability bits
If the client sends two different sets of capability bits during the
authentication phase of an SSL enabled connection, both sets need to be
combined. This prevents capabilities from degrading mid-connection which
is the case when Oracle Connector/J drops the SSL capability bit
mid-authentication.
2018-11-13 11:37:48 +02:00
Markus Mäkelä
b59eb28802
Merge branch '2.2' into 2.3 2018-11-12 12:51:18 +02:00
Markus Mäkelä
f4dd0628da
Fix COM_CHANGE_USER handling
If the service doesn't require collection of complete packets, the user
reauthentication done with COM_CHANGE_USER would be skipped. This caused
the change_user test to fail.

By temporarily switching to full packet collection mode for the duration
of the COM_CHANGE_USER, we avoid duplicating the code for the streaming
router types.
2018-11-11 17:19:52 +02:00
Markus Mäkelä
0a9d24230a
Fix cross-thread buffer usage
If the initial handshake that is sent by the accepting thread is buffered,
the subsequent flushing of it is done by the owning thread. As
cross-thread buffer usage is not allowed, the initial handshake must be
sent by the owning thread.
2018-11-09 12:13:22 +02:00
Markus Mäkelä
e5d6e5329a
Format source code
Formatted all of the source code that was not accordance with the coding
style. This was caused by merges from 2.2 into 2.3.
2018-11-01 14:05:15 +02:00
Markus Mäkelä
7deed35587
Merge branch '2.2' into 2.3 2018-10-31 09:03:09 +02:00
Markus Mäkelä
47e7595a08
MXS-2115: Fix regression
The 5.5.5 prefix in the version strings was not added.
2018-10-30 18:43:37 +02:00
Markus Mäkelä
ce35b0d541
Merge branch '2.2' into 2.3 2018-10-30 14:16:33 +02:00
Markus Mäkelä
7e21e3aedd
MXS-2115: Fix handshake version string
The intention was to send the lowest backend version string automatically
to the client instead of the default handshake version. This did not work
as the service version string was used instead of the server version.
2018-10-30 12:45:23 +02:00
Markus Mäkelä
71ffef5708
Partially revert 4ba011266843857bbd3201e5b925a47e88e1808f
Add back leading operator enforcement.
2018-09-20 15:57:30 +03:00
Markus Mäkelä
108638b0cf
Format with Uncrustify 0.67 2018-09-10 13:31:39 +03:00
Markus Mäkelä
d11c78ad80
Format all sources with Uncrustify
Formatted all sources and manually tuned some files to make the code look
neater.
2018-09-10 13:22:49 +03:00
Niclas Antti
c447e5cf15 Uncrustify maxscale
See script directory for method. The script to run in the top level
MaxScale directory is called maxscale-uncrustify.sh, which uses
another script, list-src, from the same directory (so you need to set
your PATH). The uncrustify version was 0.66.
2018-09-09 22:26:19 +03:00
Markus Mäkelä
a13e95951b
Merge branch '2.2' into develop 2018-08-30 11:37:49 +03:00
Markus Mäkelä
5f4aa46552
MXS-2027: Store LOAD DATA state inside MXS_SESSION
By storing the data gathere by readwritesplit inside the session, the
protocol will be aware of the state of the LOAD DATA LOCAL INFILE
execution. This prevents misinterpretation of the data which previously
led to closed connections, effectively rendering LOAD DATA LOCAL INFILE
unusable.

This change is a temporary solution to a problem that needs to be solved
at the protocol level. The changes required to implement this are too big
to add into a bug fix release.
2018-08-29 18:10:51 +03:00
Markus Mäkelä
9a6f1b2044
Merge branch '2.2' into develop 2018-08-28 16:06:23 +03:00
Markus Mäkelä
a50e8e9ce6
MXS-2024: Prevent stack overflow
If a large packet is received, the stack would overflow when the username
size was determined from the packet size. The code must not assume
anything about the size of the packet being read.
2018-08-27 20:35:09 +03:00
Markus Mäkelä
2c54f28fae
MXS-2024: Validate COM_CHANGE_USER packet before use
The use of strcpy on data that is assumed to be null terminated causes
reads and writes past buffers.
2018-08-24 20:52:52 +03:00
Johan Wikman
3f53eddbde MXS-2020 Replace ss[_info]_dassert with mxb_assert[_message] 2018-08-22 11:34:59 +03:00
Johan Wikman
b1e405442f MXS-2020 Replace ss_debug with MXB_AT_DEBUG 2018-08-22 11:34:06 +03:00
Johan Wikman
cf0aeed516 MXS-2014 Rename log_manager.h to log.h
There's nothing resembling a manager anymore.
2018-08-17 10:59:37 +03:00
Johan Wikman
ae43e4f0f2 MXS-2013 Remove all CHK_-macros 2018-08-15 09:28:04 +03:00
Markus Mäkelä
7c627144fb
Fix basic parameters
The ssl parameters were defined as strings even thought they were actually
enums. The events parameter was also a string even though it was an enum.

Also added the missing "all" value to the events enum. This fixes the
regression of scripts not being launched on all events by default.

Moved the definition of the default version string where it should be and
removed the empty value check.
2018-08-10 09:50:56 +03:00
Johan Wikman
f14380243b Rename cppdefs.hh to ccdefs.hh
For obvious reasons; the c++ suffix is .cc and not .cpp
2018-08-10 07:50:18 +03:00
Markus Mäkelä
4069072164
Do service client counts in the core
As all connections should be accepted via dcb_accept, it is the optimal
place to calculate how many open client connections per service there
are. The decrementation should be done when the session is closed instead
of when the call to dcb_close for the client DCB is done. This allows the
client count to be the absolute reference count that sessions have to a
service.

The current client count is a duplicate counter that should match the
n_current value in SERVICE_STATS. The former does differ from the latter
in that it does the incrementation when the client DCB is accepted instead
of when the session is created.
2018-07-31 09:41:06 +03:00
Markus Mäkelä
6c59da77fb
Merge branch '2.2' into develop 2018-07-26 11:27:09 +03:00
Markus Mäkelä
896c7deb03
Use gwbuf_make_contiguous only with non-NULL buffers
A NULL buffer should never be made contiguous as that points to a flaw in
program logic.
2018-07-24 09:51:47 +03:00
Markus Mäkelä
bbe4f42935
Add more packet splitting debug assertions
Having more debug assertions in functions that split packets guarantees
that they work as expected.
2018-07-24 09:51:47 +03:00
Markus Mäkelä
609a6723a8
MXS-1950: Log error on failed COM_CHANGE_USER
If a client is executing a COM_CHANGE_USER command and the
reauthentication of the client fails, no error message would be logged
about the failure of the reauthentication process and only a routing
failure message would be logged.
2018-07-24 09:51:33 +03:00
Markus Mäkelä
d91710c640
Remove unused DCB state
The state was never assigned.
2018-07-18 15:47:25 +03:00
Johan Wikman
cc0299aee6 Update change date of 2.3 2018-06-25 10:07:52 +03:00
Markus Mäkelä
6278f27ab6
Merge branch '2.2' into develop 2018-06-20 10:26:29 +03:00
Markus Mäkelä
8eaa265168
MXS-1931: Remove use of gw_MySQL_get_next_packet
The function implemented redundant functionality and replacement with
modutil_get_next_MySQL_packet was planned.

When faced with a packet header spread over multiple buffers, the packet
length calculation would read past the buffer end. This is fixed by taking
modutil_get_next_MySQL_packet into use.

Identical behavior to the old function is achieved by calling
gwbuf_make_contiguous for each packet to store them in a contiguous area
of memory. This should be either removed and only done when
RCAP_TYPE_CONTIGUOUS_INPUT is requested or be made an innate feature of
statement based routing.
2018-06-18 20:42:23 +03:00
Markus Mäkelä
df24f09ce5
Merge branch '2.2' into develop 2018-06-18 11:39:10 +03:00
Markus Mäkelä
2ad8b77f11
Fix current command tracking in MariaDBClient
The debug assertion introduced by commit 3d1c2b421a fails when a
COM_CHANGE_USER was executed. This was caused by the fact that the
authentication data was being interpreted as a command when it should've
been ignored.

Added a debug assertion into the reauthentication code to make sure the
current command remains the same.
2018-06-18 11:32:28 +03:00
Markus Mäkelä
ca155fbfe9
Merge branch '2.1' into 2.2 2018-06-18 11:32:13 +03:00
Markus Mäkelä
a812e02ba4
Merge branch '2.2' into develop 2018-06-15 10:48:07 +03:00
Markus Mäkelä
3d1c2b421a
MXS-1921: Explain why session was closed
When a client connection is closed by MaxScale before the client initiates
a controlled closing of the connection, an error message is sent. This
error message now also explains why the connection was closed to make
problem resolution easier.
2018-06-14 13:48:07 +03:00
Markus Mäkelä
8094c67ac2
Merge branch '2.2' into develop 2018-06-13 00:25:56 +03:00
Markus Mäkelä
e99d9826ad
Fix route_by_statement return value
The return value of route_by_statement was not initialized and not set if
a COM_CHANGE_USER was processed.
2018-06-12 23:55:30 +03:00
Markus Mäkelä
3f4d6391b5
MXS-553: Add diagnostics_json to protocol API
The protocol now allows protocol modules to return JSON formatted
information about the protocol module internals. Currently this is only
implemented by the mariadbbackend module and it returns the current
connection ID on the backend server.
2018-05-22 17:46:25 +03:00
Markus Mäkelä
cdb43335a2
MXS-553: Update and document the protocol API
Removed unused and properly documented all entry points in the protocol
module API. As the removal of the `session` entry point is an backwards
incompatible change, the protocol API version was updated.
2018-05-22 17:46:25 +03:00
Johan Wikman
7e9062f20f Merge branch '2.2' into develop 2018-05-16 09:31:13 +03:00