119 Commits

Author SHA1 Message Date
VilhoRaatikka
635fcf708f Fix to bugs #665, and #664. Potentially to #649.
http://bugs.skysql.com/show_bug.cgi?id=665
http://bugs.skysql.com/show_bug.cgi?id=664
http://bugs.skysql.com/show_bug.cgi?id=649

dcb.c:dcb_final_free: (665):set dcb->session->client pointer to NULL so that it won't be read anymore and other threads won't try to close it.
	dcb_final_free:(664):don't free dcb->data, it is either freed in session_alloc if session creation fails or in session_free only.
session.c:if session creation fails, free dcb->data and remove links between client DCB and session.
mysql_backend.c:(665):gw_backend_close:check that session->client isn't NULL and that client DCB's state is still polling before calling dcb_close for it.
mysql_client.c:gw_mysql_do_authentication:if anything fails, and session_alloc won't be called, free dcb->data.
mysql_common.c:gw_send_authentication_to_backend:if session is already closing then return with error.
2014-12-29 20:19:01 +02:00
VilhoRaatikka
ff5fe23ce6 dcb.b:dcb_final_free:replaced ((dcb->flags & DCBF_CLONE)==0) with macro !DCB_IS_CLONE(dcb)
readwritesplit.h:Removed invalid macros which assumed that ROUTER_CLIENT_SES->rses_backend_ref always pointed to valid and used backend reference and thus included potential risk of NULL-pointer refernce.
mysql_backend.c and mysql_client.c:avoid executing CHK_PROTOCOL(p) after original DCB has been released the memory.
readwritesplit.c:Replaced RSES_CLEINT_DCB macro with a function which returns client DCB for a given router client session.
2014-12-23 16:10:27 +02:00
VilhoRaatikka
b1eaaea961 Merge branch 'release-1.0GA' of https://github.com/mariadb-corporation/MaxScale into release-1.0GA 2014-12-05 23:57:02 +02:00
VilhoRaatikka
01b1b0a304 Fixes to Coverity issues 84388, 84386, 84385
mysql_mon.c: Added back server state logging to Debug build.
query_classifier.cc: removed some extra debug code, cleaned up a bit function documentation.
mysql_client_server_protocol.h, mysql_backend.c, mysql_common.c: changed some variables to signed ones to enable checking of calculations in the code.
skygw_utils.cc: removed erroneous debug assertion.
2014-12-05 23:39:14 +02:00
Markus Makela
1e2027f4dc Fixes to Coverity defects 83027 73421 72714 72671 72646 72642 2014-12-03 17:56:22 +02:00
MassimilianoPinto
33f77303f7 Backend failed handshake is now a detected
Backend failed handshake is now a detected and MYSQL_HANDSHAKE_FAILED s
set.

Reload users from backend is now restricted to MYSQL_AUTH_FAILED only
2014-12-03 09:11:26 +01:00
MassimilianoPinto
aa8350ef8f client's flags copied among known capabilities
Copy client's flags to backend but with the known capabilities mask
2014-12-02 18:47:25 +01:00
VilhoRaatikka
fd11e6a7f5 Session-specific logging. Added functions
void session_enable_log(SESSION* ses, logfile_id_t id)
and
void session_disable_log(SESSION* ses, logfile_id_t id)

Which switch specific log type on/off if the log type in question is not generally enabled.

Each thread carries a thread-specific struct log_info_t which includes members for current session id and bitfield for enabled log types for the current session. That information is checked before actual log write functions are called.

Each file where session-specific logging is used, must include the following exports:

/** Defined in log_manager.cc */
extern int            lm_enabled_logfiles_bitmask;
extern size_t         log_ses_count[];
extern __thread log_info_t tls_log_info;
2014-11-19 00:08:59 +02:00
VilhoRaatikka
70eef7aaa8 Fix to bug #513, http://bugs.skysql.com/show_bug.cgi?id=513 2014-11-17 15:33:13 +02:00
VilhoRaatikka
c9b679359f Made RWSplit to use slave selection criteria also during client session. Previously the criteria was use when slaves were selected for use of client session. 2014-11-17 13:40:18 +02:00
VilhoRaatikka
4f136fa4d2 Fixed backend selection logic in get_dcb. If slave is not found write a warning to error log and fall through to master selection. If master has changed or previous master's state has changed, routing fails. 2014-11-15 23:57:09 +02:00
VilhoRaatikka
175711a1bc Fix to #601, http://bugs.skysql.com/show_bug.cgi?id=601
if (func.auth ==)gw_change_user->gw_send_change_user_to_backend is called before backend has its scramble, auth packet is set to backend's delauqueue instead of writing it to backend. When backend_write_delayqueue is called COM_CHANGE_USER packets are rewritten with backend's current data.
2014-11-13 17:55:29 +02:00
VilhoRaatikka
0ea4dd63a9 Merge branch 'develop' of https://github.com/mariadb-corporation/MaxScale into develop 2014-11-11 14:25:49 +02:00
VilhoRaatikka
128d5e3f48 Addition to previous fix 2014-11-11 14:25:34 +02:00
VilhoRaatikka
061fa62d29 Fixes to Coverity issues 77197 (mysql_common.c, dcb.c, mysql_client.c, skygw_debug.h), 72654 (poll.c), 72756 (mysql_backend.c), 72744 (mysql_backend.c), 77197 (mysql_common.c), 72746 (mysql_common.c), 72676 (mysql_common.c), 72705 (readwritesplit.c), 72697 (readwritesplit.c), 72652 (skygw_debug.h) 2014-11-11 14:10:06 +02:00
MassimilianoPinto
49d28bc1f3 MySQL connect: charset flag is stored
MySQL connect: charset flag is stored and passed to backend
2014-11-10 16:09:55 +01:00
Markus Makela
e86b51865c Fixes to Coverity errors 72653, 72685, 72707, 73391, 73393, 73394, 73410 and 73414. 2014-11-10 13:51:21 +02:00
VilhoRaatikka
7615e9c0ac Merge branch 'develop' of https://github.com/mariadb-corporation/MaxScale into develop 2014-10-31 15:28:58 +02:00
VilhoRaatikka
00fded016b Fixes to Coverity tasks : 73267, 72686, 72672
Cleaned up warnings, and added checks to malloc return values and error log writes in case of failures.
2014-10-31 15:25:59 +02:00
MassimilianoPinto
09b3351427 Added mysqld_error.h in dbusers
Added mysqld_error.h in dbusers
2014-10-31 11:22:15 +01:00
VilhoRaatikka
236a72a6b6 Fix to bug #590, http://bugs.mariadb.com/show_bug.cgi?id=590
mysql_common.c:gw_send_change_user_to_backend creates new authentication message which is to be sent to backend. GWBUG type flags were not copied from original GWBUF to new one. Thus the information that this is a session command was lost and it was processed in a wrong way. Especially replies were all routed back to client which caused misbehavior.
2014-10-25 00:19:31 +03:00
MassimilianoPinto
7b5d2df7a6 mysql_send_custom_error returns write operation
mysql_send_custom_error returns write operation
2014-10-24 17:21:07 +02:00
MassimilianoPinto
970511a275 Update for message errors in DB authentication
Update for message errors in DB authentication
2014-10-24 12:20:50 +02:00
MassimilianoPinto
35996a40cb Reply messages for failed db authentication
Reply messages for failed db authentication
2014-10-23 19:36:25 +02:00
MassimilianoPinto
c54e087d3e Merge from develop
Merge from develop
2014-10-20 09:03:11 +02:00
MassimilianoPinto
319dd4b3e6 Fix for no db in change_user
Fix for no db in change_user
2014-10-20 09:01:13 +02:00
MassimilianoPinto
b8f590e67f Added database errmsg to change_user
Added database errmsg to change_user
2014-10-17 19:02:19 +02:00
MassimilianoPinto
f2362c3359 Auth error message fix for using password: YES,NO
Auth error message fix for using password: YES,NO
This applies to a “not found user” trying to authenticate with or
without password
2014-10-16 12:50:14 +02:00
MassimilianoPinto
0769deed7f MySQL Authentication with DBname
MySQL Authentication with DBname
2014-10-15 17:26:46 +02:00
MassimilianoPinto
a194c47b07 Updated test_mysql_users
Updated test_mysql_users
2014-10-14 12:33:56 +02:00
MassimilianoPinto
273a445045 Code cleanup
Code cleanup
2014-10-13 10:47:27 +02:00
MassimilianoPinto
ee54310a73 Implementation of db auth
Implementation of db auth
2014-10-13 09:50:55 +02:00
MassimilianoPinto
18ae3e35ef develop branch merged
develop branch merged
2014-10-10 15:30:56 +02:00
VilhoRaatikka
d16bb227e9 Completing fix to bug #565, http://bugs.mariadb.com/show_bug.cgi?id=565
Client's flags are also used when changing the user inside the session.
2014-10-09 16:37:26 +03:00
VilhoRaatikka
29e53e150a Fix to bug # 565, http://bugs.mariadb.com/show_bug.cgi?id=565
Client flags are now copied to each backend and used in their connections.

log_manager.cc: fixed string allocation where one byte was missing.
mysql_client.c: fixed string allocation where one byte was missing.
2014-10-08 22:27:28 +03:00
VilhoRaatikka
aca8596efa mysql_client.c:gw_client_close didn't close client session in cases where session->state == SESSION_STATE_STOPPING. That is a bug and lead to situation where session wasn't closed at all.
Also changed 'authorization failed' to 'access denied'
mysql_common.c: fixed memory leak in gw_receive_backend_auth, and replaced error code '2800' with '28000'.
readconnroute.c:handleError didn't set *succp pointer so uninitialized value was used in caller's context.
makefile.inc: added -lm to linker flags
mysql_backend.c: added a few comments
2014-10-06 11:46:12 +03:00
MassimilianoPinto
dbe078f358 MySQL Authentication with wildcards in hosts
MySQL Authentication:

Added support for wildcards in hosts:

a.b.c.%
a.b.%.%
a.%.%.%
2014-10-03 17:26:41 +02:00
MassimilianoPinto
48489234be Merge branch 'develop' into MAX-268 2014-10-03 16:28:38 +02:00
Markus Makela
c4ca1ddb13 Updated non-source files with new company name. 2014-10-01 15:21:47 +03:00
Markus Makela
b0683d9b4d Updated the licensing year from 2013 to 2013-2014 2014-10-01 14:37:12 +03:00
Markus Makela
52c0d0c768 Merge remote-tracking branch 'origin/develop' into header_rename 2014-10-01 05:24:02 +03:00
VilhoRaatikka
ca7ae0bb64 Fix to bug #557, http://bugs.mariadb.com/show_bug.cgi?id=557
query_classifier.cc: added function for printing combined query type from a bit field.
query_classifier.h: identify query types SHOW DATABASE, and SHOW TABLES to make log entries more understandable.
mysql_common.c: moved some trace log commands to debug log.
readwritesplit.c: moved some trace logs to debug log, added trace log commands to gather routing, query type and session information to one log entry.
skygw_debug.h: added string macros for several query and hint types.
2014-09-30 16:31:30 +03:00
MassimilianoPinto
c3dd8d973a Code cleanup
Code cleanup
2014-09-30 13:19:03 +02:00
Markus Makela
f4e591e382 Changed 'SkySQL Gateway' to 'MariaDB Corporation MaxScale' 2014-09-30 13:15:03 +03:00
Markus Makela
c344231f80 Renamed all occurences of SkySQL to MariaDB Corporation 2014-09-30 13:02:10 +03:00
MassimilianoPinto
5f6d04e7db Match for Class C,B,A in hosts with %
Match for Class C,B,A in hosts with %
2014-09-29 16:50:21 +02:00
MassimilianoPinto
76320c056b Match Class C,B,A addresses
Match Class C,B,A addresses
2014-09-29 12:08:10 +02:00
MassimilianoPinto
1d14129edf Merge branch 'develop' into MAX-268 2014-09-29 09:51:57 +02:00
VilhoRaatikka
5ec1a83f3b Fix to #478, http://bugs.skysql.com/show_bug.cgi?id=478
Execution of session commands failed because session commands and normal sql statements were executed in a wrong order if backend was executing previous session command while new sql stmt was routed to that backend. There was a window where ordering went wrong.
It is possible that one normal sql stmt arrives while previous sescmds are still being executed.

Introduced a new member in backend_ref_t structure, bref_pending_cmd where new sql stmt pointer is stored in that case. When sescmds are executed completely, that command is automatically executed next.
2014-09-26 15:40:32 +03:00
MassimilianoPinto
3fdfc5db8d Code cleanup
Code cleanup
2014-09-25 13:13:52 +02:00