Commit Graph

522 Commits

Author SHA1 Message Date
312c825b4e Added client IP address to authentication error messages
Client authentication problems are easier to solve when the client IP is logged
in case a failed authentication attempt is made. This will also make it easier
to detect possible security problems.
2016-04-14 20:55:08 +03:00
4ee1f304ca MXS-585 regression: Authentication packets are now processed in contiguous memory
The client side authentication assumed that it was processing contiguous memory.
This caused the authentication to fail when packets were received in multiple
parts. Transforming the buffer chain into one contiguous buffer fixes this problem.
2016-03-18 11:22:13 +02:00
d3da98b58f Merge branch 'MXS-544' into develop-MXS-544-merge 2016-03-03 21:39:39 +02:00
cb3213af63 server/include/poll.h renamed to server/include/maxscale/poll.h
Due to an include conflict between /usr/include/poll.h and
maxscale/server/include/poll.h the latter was moved to
maxscale/server/include/maxscale/poll.h.

Once 1.4 is out, all maxscale header files will be moved to that
same sub-directory. That will prevent include conflicts and also
make it easy to see which include files belong to maxscale and
which do not.
2016-03-01 12:56:39 +02:00
1ebb998056 Fixed wrong DCB being used in gw_get_shared_session_auth_info
The caller DCB was used instead of the session client DCB. This caused
a crash when a backend DCB was getting the shared data since those DCBs
have a NULL data pointer.
2016-02-29 16:53:39 +02:00
bf24f18805 Merge branch 'develop' into MXS-544 2016-02-29 10:40:33 +02:00
c26b5a3dd0 Tidy earlier fix and apply another - both follow the principle of not removing the link from session to client DCB when dcb_close is called for client DCB. The close will not fully complete, but will be finalised when the session is freed. At this time, no DCBs will be referring to the session. These measures protect the dcb->data in the client DCB from being lost until the session is no longer needed. 2016-02-24 15:34:02 +00:00
5122777829 Try to fix problem if balancing free client DCB and free session so that auth data is always available and client DCB is not freed until session is ready to be freed. Also fix problem in auth logic. 2016-02-24 10:00:45 +00:00
395cbdc103 Simplify handling of "client data" by having a pointer to it only in DCB and not in session structure. Change name of session->client to session->client_dcb for greater clarity. Temporary free of client data in DCB, to be moved to authenticator when it becomes a module. Fix incorrect name of listener_alloc. 2016-02-23 11:13:21 +00:00
ef8a20cceb Fix silly mistakes. 2016-02-22 11:16:51 +00:00
5077933e41 Fix bug in mysql_client.c (over optimisation of protocol setting); various clarifications and improvements re code review. 2016-02-22 11:05:02 +00:00
a947b33769 MXS-585: Fixed buffer length instead of packet length being used in a calculation
The usage of the buffer length in the authentication success checks causes
the authentication to fail with routers that don't require statement input.
2016-02-18 18:03:21 +02:00
866e91c088 Changes to improve robustness of SSL processing, separate it so far as possible from protocols. Separate the detailed mechanism of authentication from the MySQL protocol with a view to making it into a module later. 2016-02-15 09:29:07 +00:00
cfefc046e9 Merge branch 'release-1.3.0' into develop 2016-02-11 10:23:00 +02:00
971d1d5de2 Redesign logic of SSL connections to work with status in client DCB instead of in the protocol. This eases the way to moving SSL logic out of a specific protocol (currently MySQL) so as to be available across any protocol. Also, some simplification. 2016-02-03 08:54:55 +00:00
8367d93746 Migrate SSL functionality out of service and into listener. Develop config handling accordingly, including making provision for SSL parameters in servers for future use in implementing SSL to backend servers. Some elements still to be tidied mainly in mysql_client.c - but that will be part of detaching the SSL authentication from the MySQL protocol. 2016-01-27 15:46:19 +00:00
e58148356d Split off listener functionality and move SSL initiation from service to listener. Put GWPROTOCOL in its own header file. 2016-01-26 16:08:02 +00:00
1f241a5ed1 Rearrange libraries and build files.
This is the first change in an attempt to arrange the linking so that
more errors are detected at link-time.

- All files in server/core but for gateway.c are linked to one shared
  library called maxscale-common.
- The files log_manager/log_manager.cc and utils/skygw_utils.cc are
  built into maxscale-common as well.
- MaxScale itself consists now only of gateway.c and is linked with
  maxscale-common.
- All plugins link with maxscale-common.
- All executables link in addition with {EMBEDDED_LIB}.

After this change, the change (MXS-517) where query_classifier is the
only component that uses ${EMBEDDED_LIB} and the rest mysqlclient can
be made much cleaner.

After a few additional steps, all shared libraries can be linked with
the linker flags "-Wl,-z,defs", which directs the linker to resolve
all symbols. That will require that all shared libraries list all the
libraries they need, but will at the same time ensure that any
missing symbols are detected at link-time and not at run-time.
2016-01-22 23:26:17 +02:00
99f39cb213 MXS-548: Added missing locks to shared session data
The shared session data was accessed and modified without a lock.
2016-01-21 10:25:41 +02:00
5515c71988 Reapply MXS-504 changes subsequent to optimisation changes. Merge SSL processing into non-SSL processing so far as possible, correct usage of OpenSSL, simplify where possible. 2016-01-13 10:08:37 +00:00
d13bec0647 Reformat testprotocol.c 2016-01-12 15:52:29 +02:00
183202466d Reformat telnetd.c 2016-01-12 15:49:09 +02:00
fd9698e705 Reformat mysql_common.c 2016-01-12 15:43:33 +02:00
da29ee0f4a Reformat mysql_client.c 2016-01-12 15:21:33 +02:00
244d7ee86c Reformat mysql_backend.c 2016-01-12 14:57:26 +02:00
1b94c5b519 Reformat mascaled.c 2016-01-12 14:20:11 +02:00
018b87d304 Reformat httpd.c 2016-01-12 14:14:40 +02:00
3c69e641b9 Fixed false backend authentication failures
It was possible that a backend server was doing authentication while the client
closed the session. The more connections the router created the more likely it
was. This caused unnecessary reloading of the database users and confusing error
messages.

With the implemented fix, there are additional checks for the session state
before the users are reloaded or error messages are logged.
2015-12-30 05:13:27 +02:00
78b5777d6e Fixes to Coverity defects
Few fixes to possible use of freed memory and resource leaks.
2015-12-15 13:13:53 +02:00
3cd648fa09 Fixed telnetd soname
The telnetd was missing the VERSION target property which activates the
soname generation for CMake.
2015-11-30 10:46:08 +02:00
a829b38873 Fix to MXS-363: Added soname versions to libraries
The soname version numbers were missing from all the library targets
properties which caused ldconfig to warn about non-symlink libraries
being installed.
2015-11-30 10:46:08 +02:00
a8535f42af Remove all traces of logfile_t
The earlier log file based approach for enabling and disabling
messages has now been completely replaced with the syslog priority
based approach.

Similarly as with log files before it is now possible to enable
and disable a log priority for a particular session, even though
it apparently has not been used much.

The local test-programs of the logging has got minimal attention
only to make them compile. They should get an overhaul as they did
not work before either.
2015-11-23 19:10:53 +02:00
6164b7f301 Fixed unsafe use of localtime
Since localtime is not thread-safe it should not be used in multithreaded
contexts. For this reason all calls to localtime were changed to localtime_r
in code where concurrency issues were possible.

Internal tests were left unchanged because they aren't multithreaded.
2015-11-19 17:17:16 +02:00
453055a6c0 server/modules/protocol: All LOGIFs and skygw_log_writes replaced.
LOGIFs and skygw_log_writes replaced with the equivalent
MXS_[ERROR|WARNING|NOTICE|INFO|DEBUG] macros.
2015-11-17 09:21:47 +02:00
65e2b50f96 Removed client hangup error message
The error message did not provide any useful information and was most of the
time a false positive due to EPOLL_RDHUP events calling the hangup function
of the DCB.
2015-11-16 13:59:47 +02:00
a355e1beef Printf format checking added to logging function.
Printf format checking added to logging function and all
issues that were revealed by that fixed.
2015-11-16 12:40:49 +02:00
30d1fc66b7 getCapabilities no longer takes arguments and returns an int. 2015-11-11 18:14:03 +02:00
49d4a2019e Clarify and fix logic around router capabilities, with particular reference to crash relating to binlog router. 2015-11-11 15:43:23 +00:00
dee20fe077 Merge remote-tracking branch 'origin/develop' into MXS-329-develop-20151111
# Conflicts:
#	server/core/CMakeLists.txt
#	server/core/buffer.c
#	server/core/service.c
#	server/modules/filter/tee.c
#	server/modules/monitor/mysql_mon.c
#	server/modules/routing/binlog/blr.c
#	server/modules/routing/binlog/blr_slave.c
#	server/modules/routing/debugcmd.c
#	server/modules/routing/readwritesplit/readwritesplit.c
#	utils/skygw_utils.cc

- resolved.
2015-11-11 11:08:02 +00:00
834a88aeda Log variables moved to log_manager.h
The log manager variables lm_enabled_log_files_bitmask, log_ses_count
and tls_log_info that earlier were declared separately in every
c-file are now declared in the log_manager.h header.
2015-11-04 14:26:53 +02:00
d57b4cd531 Fix to MXS-54: https://mariadb.atlassian.net/browse/MXS-54
Added a new configuration parameter that allows the user to control
whether authentication warning messages are logged.
2015-11-04 09:18:20 +02:00
9cd327a783 Fix to MXS-417: https://mariadb.atlassian.net/browse/MXS-417 Added support for single-character wildcard in IP addresses.
Single character wildcard addresses are now properly handled
2015-11-03 10:15:34 +02:00
9b4e8223b4 Removed double check of database name on login.
Removed redundant check of the default database when a user with proper
credentials is being authenticated.
2015-11-02 15:54:46 +02:00
24ee9ca675 Removed redundant log messages
Moved logging from functions that perform user authentication to the code that
uses these functions. This way the messages are only logged once.
2015-11-02 15:53:02 +02:00
bad61b0740 Change binlog router to indicate it does not use router sessions via the getCapabilities interface. 2015-10-27 14:17:06 +00:00
12ceb0db02 Check for dummy session in mysql_backend protocol and ignore. 2015-10-15 14:17:49 +02:00
cc42707dc0 The read_buffer pointer must be set to null in situations where the buffer has been freed (or consumed). 2015-10-13 15:10:55 +02:00
bb53eb0f6d Put extra check in hashtable_fetch to return if zero entries (should never happen but will crash if not checked); remove dcb_close from mysql_backend where it closes backend DCBs, as these should be closed by the router. 2015-10-07 17:06:21 +01:00
4f316419c5 Merge branch 'develop' into MXS-329 2015-09-30 12:47:28 +03:00
9efad8727a All warnings removed.
Minimal changes to remove warnings when compiling.
2015-09-25 14:07:19 +03:00