6967 Commits

Author SHA1 Message Date
Markus Mäkelä
d19e5b376d MXS-1032: Add configurable connector plugin directory
The connector plugin directory can now be controlled with the
`connector_plugindir` argument and configuration option. This should allow
the connector to use the system plugins if the versions are binary
compatible.

Replaced calls to mysql_options to mysql_optionsv as the former is
deprecated in Connector-C 3.0 and the latter is supported in Connector-C
2.3.
2017-03-15 09:11:18 +02:00
Johan Wikman
61627e035c Correct release note link 2017-03-14 12:51:26 +02:00
Johan Wikman
2bcb57365b Update 2.1.1 release date 2017-03-14 12:51:26 +02:00
Markus Mäkelä
fbcd25342c Add 2.1.2 release notes
Created release notes for 2.1.2 and added the new features into it. Also
updated the MySQLAuth limitations in the limitations document.
2017-03-14 10:11:57 +02:00
Markus Mäkelä
4d561c5f6a Detect password usage based on token length
The client protocol module can resolve whether a password was used based
on the information the authenticators gather before authentication is
done. It uses the authentication token length as the basis on which it
makes the decision.
2017-03-13 19:42:38 +02:00
Markus Mäkelä
9c325104b7 Use correct size for snprintf
The mysql authenticator used the size of the pointer for the snprintf size
parameter instead of the actual size of the destination buffer.
2017-03-13 10:45:56 +02:00
Markus Mäkelä
086650bb4d Fix loading of users from multiple servers
The users were deleted before each individual server was queried. This
caused authentication to fail if the authentication data was loaded from
multiple servers.
2017-03-13 10:45:56 +02:00
Markus Mäkelä
e8ef701409 Combine socket creation code
The client connection and the server listener sockets used largely similar
code. Combining them allows for simpler protocol code.

Cleaned up parts of the DCB listener creation and moved the parsing of the
network binding configuration to a higher level.
2017-03-13 10:45:56 +02:00
Markus Mäkelä
7bc47fd5a4 Return the localhost_match_wildcard_host warning
When a local address is used which could match the wildcard host, a
warning is again logged.
2017-03-13 10:45:56 +02:00
Markus Mäkelä
ea55667096 Add back the missing netmask handling code
The netmask code was mistakenly removed when the authentication was moved
to the SQLite based system.
2017-03-13 10:45:56 +02:00
Markus Mäkelä
d88d02ee95 Fix namedserverfilter source parameter
The `source` parameter was broken by the IPv6 change. Now the filter no
longer uses functions from the core to resolve the network addresses.
2017-03-13 10:45:55 +02:00
Markus Mäkelä
894679d611 Fix hostname resolution in MySQLAuth
The hostname resolution was broken by the move to IPv6.
2017-03-13 10:45:55 +02:00
Markus Mäkelä
66ba7f3c80 Simplify network socket creation code
The socket creation code in mysql_backend.c wasn't MySQL specific and it
could be used for all non-blocking network connections. Thus, it makes
sense to move it to a common file where other protocol modules can use
it.

The address resolution code now uses `getaddrinfo` to resolve all
addresses instead of manually handling wildcard hosts. This allows the
same code to be used for all addresses.
2017-03-13 10:45:55 +02:00
Markus Mäkelä
37dd561470 Add support for IPv6
Both the listeners and servers now support IPv6 addresses.

The namedserverfilter does not yet use the new structures and needs to be
fixed in a following commit.
2017-03-13 10:45:55 +02:00
Johan Wikman
82247f9143 Add mxs_strerror
Thread-safe version of strerror; thread local buffer used for storing
the message. The performance penalty of a thread local buffer is not
likely to be significant, since this is only called in an error
situation that anyway is likely to interrupt the normal processing.
2017-03-13 10:45:55 +02:00
Markus Mäkelä
405b944abb Use on-disk database for MySQLAuth users
The SQLite database is now always created on disk. This will remove the
need to dump the database users from the in-memory database to the
persisted on-disk database.

This change will also make the authentication compatible with older SQLite
implementations which lack the URI-based database strings found in newer
versions.
2017-03-13 10:45:55 +02:00
Markus Mäkelä
71b3ee70a4 Fix empty password detection
If a user was defined without a password, the authentication would fail.
2017-03-13 10:45:54 +02:00
Markus Mäkelä
adb9b5049b Fix user cache directory permissions
The user cache directory is only used by the maxscale user so only the
maxscale user should have access to it.
2017-03-13 10:45:54 +02:00
Markus Mäkelä
b796967df8 Add diagnostic entry point to authenticators
The authenticators should have a similar way to print diagnostic
information as filter and routers do. This allows the authenticators to
print the users in their own format.

In the future, all the diagnostic entry points should be changed so that
they return a structure that contains the information in a standard
form. This information can then be formatted in different ways by other
modules.
2017-03-13 10:45:54 +02:00
Markus Mäkelä
f225b29756 Fix injection of service user
The parameters that were given to the user creation function were in the
wrong order.
2017-03-13 10:45:54 +02:00
Markus Mäkelä
2dd79e2e0c Make sure user cache directory exists
The cache directory needs to be created by the authenticator itself.
2017-03-13 10:45:54 +02:00
Markus Mäkelä
a3a2a24c97 Return correct value for failed db authentication
The unknown database error was never triggered as all authentication
errors returned MXS_AUTH_FAILED.
2017-03-13 10:45:54 +02:00
Markus Mäkelä
b2c018a986 Don't users with a pre-4.1 password
The old error message and behavior was lost with the new implementation.
2017-03-13 10:45:53 +02:00
Markus Mäkelä
5494b262d3 Reorder SQL statements when persisting users
The statements are now executed in a more controlled order and a failure
of one will skip the others. The transaction is also rolled back if it
fails.
2017-03-13 10:45:53 +02:00
Markus Mäkelä
0488f8a052 Fix enable_root_user
The option was inverted.
2017-03-13 10:45:53 +02:00
Markus Mäkelä
04899f3a3e Remove unused code from MySQLAuth
Removed the old implementation of MySQL authentication. The user printing
functionality still expects a hashtable which should be fixed.
2017-03-13 10:45:53 +02:00
Markus Mäkelä
b206300975 Exact hostnames grants take precedence over wildcard grants
MariaDB and others match grants first by exact hostname/IP and then by
wildcard. If there are no exact matches, the wildcard grant should be
picked. This can be tested by having different passwords for localhost and
remote address.

The SQLite based authentication should first check for an exact match and
then only after that should it try to match the hostname to a wildcard
grant.
2017-03-13 10:45:53 +02:00
Markus Mäkelä
ba16b8ca1c Fix memory leak in dbusers.c
The MySQL connection was created twice.
2017-03-13 10:45:52 +02:00
Markus Mäkelä
b376d9043a Use new authentication for reauthentication
This fixes the reauthentication of users that was missing from the new
implementation. Now COM_CHANGE_USER should work properly.
2017-03-13 10:45:52 +02:00
Markus Mäkelä
48d70fa4a8 Replace get_users implementation with new version
The get_users function now combines the functionality of the old get_users
and get_all_users. This removes large parts of similar code.

Removed the listener resources as MySQLAuth was the only one that used it.
2017-03-13 10:45:52 +02:00
Markus Mäkelä
62763e2505 Store SQLite tables on disk
The SQLite database users are cached on disk. This allows the binlogrouter
to authenticate users without a connection to the master server.
2017-03-13 10:45:52 +02:00
Markus Mäkelä
2f4df0c21e Store databases in the SQLite database
The databases are now also stored in the sqlite database. This allows the
`resource` member of the USERS struct to be removed in the future.
2017-03-13 10:45:51 +02:00
Markus Mäkelä
041c0f1f2d Use SQLite3 based authentication
The user data is now stored inside a SQLite3 database. By storing the data
inside a database, we remove the restriction that the previous hashtable
based implementation had.
2017-03-13 10:45:51 +02:00
Markus Mäkelä
d4a06c61de Move reauthentication to authenticators
Currently the only situation where a user needs to be authenticated after
the initial authentication is when a COM_CHANGE_USER is being
executed. This was previously handled by directly calling a function in
the MySQLAuth authenticator.

The new entry in the API of the authenticators is very specific to MySQL
and should be reviewed once other protocols are added.
2017-03-13 10:45:51 +02:00
Markus Mäkelä
6da8cfe97e Fix assignment of master status on failed servers
When the real root master server went down, it still received the master
status bit due to how the replication tree was built. The bit should only
be set for servers that are running.

Also fixed a false state change event when the master status bit was
manually cleared from the downed root master server.
2017-03-12 09:40:21 +02:00
Johan Wikman
4f03c53bdf Update 2.1.1 release notes 2017-03-09 10:10:34 +02:00
Markus Mäkelä
41ff01d16d Merge branch '2.0' into 2.1 2017-03-09 10:01:38 +02:00
Johan Wikman
d82f4ad6dc Prevent ignoring return value error
When strtol[l] is used for verifying that a string represents a
number, we are not interested in the actual value.
2017-03-09 09:46:38 +02:00
Timofey Turenko
84a6848f10 Add build information to --version-full
If the Jenkins build information is available, print it in the full
version output.
2017-03-09 09:32:37 +02:00
Markus Mäkelä
d764bb9e1f MXS-1178: Fix master_accept_reads
The order of the servers in the service definition could break the
master_accept_reads functionality.

When the first server defined in the service is a slave, it will always be
picked as the first candidate for reads. The master would only be
considered as a candidate for reads if no previous candidate was
available. For this reason, the master_accept_reads only worked when the
first server in the list was the master.
2017-03-09 07:45:29 +02:00
Markus Mäkelä
fd2df3a863 Always open files with configured block size
If the Avro file already exists, it should be opened with the configured
block size instead of the default block size of 16 kilobytes.
2017-03-08 20:03:45 +02:00
Johan Wikman
a925be4e2a Turn off error in qc_sqlite built
GCC on CentOS6 thinks there is an array-bounds error in the sqlite
code. As that code is outside our hands, it is easiest to instruct
GCC not to treat it as an error.
2017-03-08 17:18:06 +02:00
Markus Mäkelä
c18f94b31b Get socket family from struct sockaddr_storage
The struct sockaddr_storage has a member variable that tells the socket
family.
2017-03-08 17:04:14 +02:00
Johan Wikman
25350d6a08 Update change log and release notes 2017-03-08 13:28:13 +02:00
Johan Wikman
b1521e0545 Log the use of prepared statements
If cache decisions should be logged, we log the presence of
prepared statements as they currently are the primary source
for the cache not caching.
2017-03-07 15:45:29 +02:00
Johan Wikman
e1da03ff21 Update version for 2.1.1 2017-03-07 13:06:07 +02:00
Johan Wikman
07ae37f179 Update commit/rollback rules
Now that WORK is recognized as a parser token, the BEGIN and regular
COMMIT and ROLLBACK rules should use them as well.
2017-03-07 11:49:30 +02:00
Johan Wikman
a6ae60c808 Merge branch '2.0' into 2.1 2017-03-07 11:45:49 +02:00
Esa Korhonen
a7379d7ae2 MXS-1165 MaxInfo endless loop
If one queried in MySQL MaxInfo 'show sessions' or 'show clients',
MaxScale would go in an endless loop and finally crash when memory
ran out. The reason is the rather confusing callback-based dcb-
iterating code. Adding one line fixes the issue, although the iteration
is still rather awkward with calling dcb_foreach for every session/
client.
2017-03-07 10:42:48 +02:00
Johan Wikman
60c69d0f7f Update change log and release notes for 2.0.5 2017-03-07 10:33:50 +02:00