MXS-1026: Prevent crash with NullAuth

The authenticator module will not crash but backend authentication will
always fail.
This commit is contained in:
Markus Makela 2016-12-02 11:57:03 +02:00
parent 6f7b572822
commit 1d9d325a01
2 changed files with 9 additions and 1 deletions

View File

@ -4,7 +4,7 @@ set_target_properties(MySQLAuth PROPERTIES VERSION "1.0.0")
install(TARGETS MySQLAuth DESTINATION ${MAXSCALE_LIBDIR})
add_library(NullAuth SHARED null_auth.c)
target_link_libraries(NullAuth maxscale-common)
target_link_libraries(NullAuth maxscale-common MySQLClient)
set_target_properties(NullAuth PROPERTIES VERSION "1.0.0")
install(TARGETS NullAuth DESTINATION ${MAXSCALE_LIBDIR})

View File

@ -31,6 +31,9 @@
#include <dcb.h>
#include <buffer.h>
/** MXS-1026: Without MySQL protocol data structures, the NullAuth authenticator will crash. */
#include <mysql_client_server_protocol.h>
/* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
@ -124,6 +127,11 @@ null_auth_authenticate(DCB *dcb)
static int
null_auth_set_protocol_data(DCB *dcb, GWBUF *buf)
{
/** MXS-1026: This will just prevent a crash when the NullAuth authenticator
* is used. This does not provide a way to use MaxScale with no authentication. */
dcb->data = calloc(1, sizeof(MYSQL_session));
dcb->protocol = mysql_protocol_init(dcb, dcb->fd);
return 0;
}