1584 Commits

Author SHA1 Message Date
Markus Makela
1fc27b39af MXS-662: Service protocol check no longer ignores bind
The address of a listener was ignored when service protocols were compared.
2016-04-14 19:04:54 +03:00
Markus Makela
e445bb981e Added missing check for SELECT privilege on mysql.tables_priv
The service permission checks did not check for SELECT privileges on
mysql.tables_priv which caused confusing error messages. The database
grant erros also did not log the MySQL error message which is often very
helpful when resolving permission errors.
2016-03-22 08:08:46 +02:00
Markus Makela
6d6cc80793 Added flushing of all logs to disk when MaxScale exits
It is possible that messages logged immediately before exiting are not flushed
to disk. Flushing all logs before exiting from the main function guarantees
that any relevant log messages are flushed to disk.
2016-03-16 17:16:50 +02:00
Markus Makela
bc35730c73 Fixed a crash when a monitor has no servers
If a monitor is configured with a server which does not exist, MaxScale will
crash.
2016-03-15 16:39:41 +02:00
counterpoint
faa6e72ca0 FIX BUG IN CLIENT DCB SHUTDOWN THAT CAN CAUSE CRASHES 2016-03-09 14:32:24 +00:00
Markus Makela
f18e5460c4 Removed unused service SSL functions
These have been made obsolete by the introduction of listener.c
2016-03-08 15:41:25 +02:00
Markus Makela
60724172a4 Removed support for SSLv3
SSLv3 can't be considered safe anymore so removing the support for it improves
MaxScale's security as a whole.
2016-03-08 15:22:35 +02:00
Markus Makela
18a3aa5e33 Added missing newlines to all files
This caused build errors some systems, namely RHEL 5.
2016-03-08 14:48:17 +02:00
Johan Wikman
7aab966573 Remove mysql prefix.
Now monitor.c includes <mysqld_error.h> and not <mysql/mysqld_error.h>.
The latter can not be found from connector-c.
2016-03-07 16:00:27 +02:00
Markus Makela
60714135c4 Merge branch 'develop-MXS-544-merge' into develop 2016-03-07 10:17:17 +02:00
Markus Makela
3cbfb6821b Cleaned up SIGTERM and SIGINT handlers
Changed fprintf to write since it is signal safe.
2016-03-07 10:11:50 +02:00
counterpoint
768ff24428 Ensure SSL_LISTENER structure is intialised to binary zero when allocated in configuration processing by using calloc instead of malloc. 2016-03-04 11:53:54 +00:00
Johan Wikman
b7904bffb0 Expose maxscale starttime.
Maxinfo needs access to the time MaxScale was started.
Now exposed in a way similar to the uptime.
2016-03-04 11:55:47 +02:00
Johan Wikman
51755aae0c Expose maxscale starttime.
Maxinfo needs access to the time MaxScale was started.
Now exposed in a way similar to the uptime.
2016-03-04 11:45:12 +02:00
Markus Makela
9dc55735e7 Missing listeners are treated as warnings instead of errors
Missing listeners are no longer a cause for shutdown.
2016-03-04 10:58:12 +02:00
Markus Makela
ab33515282 Fixed undefined servers being ignored
The missing server was logged but it was not considered an error.
2016-03-04 07:06:53 +02:00
Markus Makela
d3da98b58f Merge branch 'MXS-544' into develop-MXS-544-merge 2016-03-03 21:39:39 +02:00
Markus Makela
cb8ea84853 No errors were logged when a service has no listeners
The starting of a service without listeners would fail but there wouldn't be
any log messages about the reason of the failure. In addition to this, MaxScale
would try to restart the service periodically which would lead to unnecessary
error messages.

With this change, missing listeners for services are considered configuration
errors.
2016-03-03 15:57:08 +02:00
Markus Makela
0ddb81ea16 Fixed threads=auto not working
The name of the parameter was compared to `auto` instead of the value.
2016-03-03 15:29:05 +02:00
Markus Makela
76f06572ed Fix to multi-statement processing
Renamed is_mysql_comment_start to is_mysql_statement_end because it checks
whether a statement truly ends instead of just checking comment block starts.

The calculations for buffer length in readwritesplit now use the payload size
instead of the buffer size.
2016-03-03 10:44:11 +02:00
Markus Makela
8b6595aa68 Improvements and fixes to strchr_esc_mysql
The C style comments were not ignored and the -- style comments
did not check for the trailing whitespace and made return values char*.

The creation of a stored procedure would prevent sessions from using
any of the slave servers because readwritesplit would interpret
the creation statement as a multi-statement query.

Parts of modutil and readwritesplit now compare pointers to pointers instead of
converting pointers to integers.
2016-03-02 21:34:22 +02:00
Markus Makela
2a35312022 Cleaned up the usage of the connector library
The monitor permission checks didn't use the standard connection timeouts but
used hard-coded values. The config.c tried to connect to the embedded library
but since it is not used by it anymore, it always fails.
2016-03-02 21:27:34 +02:00
Markus Makela
9bfef5c7c1 Improved multi-statement detection in readwritesplit
Now comment blocks and identifiers quoted with backticks are taken into
consideration when multi-statements are processed.
2016-03-02 21:27:34 +02:00
Markus Makela
9b2748f50c Removed false warnings about readwritesplit parameter types
The warning was expecting the wrong return value and mistakenly interpreted that
the setting of the parameter failed.
2016-03-02 21:27:34 +02:00
Markus Makela
8cf1479f79 Removed logging from SIGTERM and SIGINT handlers
The logging of messages in a signal handler is not safe and sometimes caused
MaxScale to hang.
2016-03-02 21:27:34 +02:00
Johan Wikman
52e1b24975 Rename and export MaxScaleUptime()
MaxScaleUptime() renamed to maxscale_uptime() and moved from
gateway.c (MaxScale main) to misc.c, which is included in the
maxscale_common library. That way the symbol will be available
at link-time and will thus not prevent the use of the linker
flags -Wl,-z,defs (resolve all symbols at link-time) when
linking a module that uses maxscale_uptime().
2016-03-01 21:23:03 +02:00
Johan Wikman
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
Markus Makela
955187d9fa Improvements on pathname handling of maxkeys and maxpasswd
The default pathname for maxkeys was a hardcoded value and it didn't use
the default directory location functions. If encrypted passwords were used
nothing was written into the log.
2016-03-01 10:57:13 +02:00
Markus Makela
bf24f18805 Merge branch 'develop' into MXS-544 2016-02-29 10:40:33 +02:00
Markus Makela
f03865f32a Cloned DCB authentication data was freed twice
This caused all Tee filter sessions to crash when the branch DCB was closed.
2016-02-27 13:05:44 +02:00
Markus Makela
f77afc6374 Fixed possible crash when draining writequeue
The write queue spinlock was released in dcb_write_tidy_up without first
acquiring it. This caused a crash when two threads try to interact with
the write queue at the same time.
2016-02-26 20:45:41 +02:00
Markus Makela
b5b27740e3 Fixed wrong comparison being made when setting readwritesplit parameters
The comparison was done with strcmp but it was expected to return true on
success when in reality it returns 0 on success.
2016-02-26 18:06:46 +02:00
Markus Makela
f8d74dd7e2 Cleaned up error logging for session creation failures
The old message logged the function name and thread ID which are not useful
to the end user. The thread ID should only be printed for debugging purposes,
not general error messages.
2016-02-25 18:52:22 +02:00
Markus Makela
18526c28f6 MXS-589: Separated persistent and temporary data directories
Both the passwords and temporary files of the embedded library were stored
in the same directory. Now the directories are separated and the embedded
library uses the temporary directory. The datadir cleanup also now only
cleans up the temporary data directory.
2016-02-25 11:24:20 +02:00
Markus Makela
13387485f6 Added 'auth_all_servers' to service parameters if it is defined
The schemarouter checks if the service has this parameter and if it
is not there, it is automatically enabled. The parameter was not
added as a qualified service parameter so the router couldn't see
the parameter as defined even if it was.
2016-02-25 09:32:04 +02:00
counterpoint
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
counterpoint
a61b70a810 Quick fix to see if we can overcome crash. 2016-02-24 15:18:44 +00:00
counterpoint
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
Markus Makela
417380ab83 Added missing use_priority to list of valid parameters
This caused Galera node priority usage to always fail.
2016-02-23 14:48:55 +02:00
counterpoint
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
counterpoint
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
Markus Makela
8e010d2367 Fixed wrong comparison being made when setting readwritesplit parameters
The comparison was done with strcmp but it was expected to return true on
success when in reality it returns 0 on success.
2016-02-22 11:05:34 +02:00
Markus Makela
fec1ebe925 Removed restrictions on monitor timeouts
The monitor timeouts can now be larger than the monitor interval. This will
allow the combination of low monitoring intervals and large network timeouts.
If a network experiences some periodic lag, it is desirable to allow large
timeout values.
2016-02-19 09:57:15 +02:00
Johan Wikman
5cfe352a8a Remove inline from function definition. 2016-02-18 11:44:59 +02:00
Markus Makela
47281d1c55 MXS-582: Moved to crypt_r
Replaced all calls to crypt with crypt_r.
2016-02-16 16:04:50 +02:00
Markus Makela
6da0446df0 Made function parameters constant and added debug checks
The number of written characters is now checked and should be lower than
compared bytes. The parameters to the dbusers.c query functions are now const
where possible.
2016-02-16 11:16:41 +02:00
Markus Makela
c4bcc4ce88 Table-level access to databases is now detected
Previously the users needed at least SELECT permission on the database level to
be able to connect with a default database through MaxScale. With this change,
the query that retrieves the database users has been changed to also include
table-level grants for users. This will allow users with grants to only some of
the tables in a database to be able to connect through MaxScale with a default
database.
2016-02-16 11:16:41 +02:00
Markus Makela
e468132b8b Cleaned up user data queries
The queries are now created at runtime to allow for a more varied syntax. This
removes the need to have separate query strings for the standard mysql.user
table and for the MySQL 5.7 version of it. In addition to this, the exclusion
of the root user is now done at the same time which removes the need to manually
form the query string.
2016-02-16 11:16:41 +02:00
counterpoint
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
Markus Makela
a628fdcb17 Added configurable executable file directory
This allows MaxScale to launch processes from the directory where
the `maxscale` executable is located.
2016-02-15 11:12:54 +02:00