MXS-862: Create common MySQL library
The MySQLCommon library contains functions used by both the protocol and authenticator modules. The contents of the modutil.c file could also be moved to this file if the functions in that file are only used by modules and not the core.
This commit is contained in:
@ -1,21 +1,20 @@
|
||||
add_library(MySQLAuth SHARED mysql_auth.c)
|
||||
target_link_libraries(MySQLAuth maxscale-common)
|
||||
target_link_libraries(MySQLAuth maxscale-common MySQLCommon)
|
||||
set_target_properties(MySQLAuth PROPERTIES VERSION "1.0.0")
|
||||
install_module(MySQLAuth core)
|
||||
|
||||
add_library(MySQLBackendAuth SHARED mysql_backend_auth.c)
|
||||
target_link_libraries(MySQLBackendAuth maxscale-common MySQLBackend)
|
||||
target_link_libraries(MySQLBackendAuth maxscale-common MySQLCommon)
|
||||
set_target_properties(MySQLBackendAuth PROPERTIES VERSION "1.0.0")
|
||||
install_module(MySQLBackendAuth core)
|
||||
|
||||
add_library(GSSAPIAuth SHARED gssapi_auth.c gssapi_auth_common.c)
|
||||
target_link_libraries(GSSAPIAuth maxscale-common gssapi_krb5)
|
||||
target_link_libraries(GSSAPIAuth maxscale-common gssapi_krb5 MySQLCommon)
|
||||
set_target_properties(GSSAPIAuth PROPERTIES VERSION "1.0.0")
|
||||
install_module(GSSAPIAuth core)
|
||||
|
||||
add_library(GSSAPIBackendAuth SHARED gssapi_backend_auth.c gssapi_auth_common.c)
|
||||
target_link_libraries(GSSAPIBackendAuth maxscale-common gssapi_krb5
|
||||
MySQLBackend) # Needed for gw_send_backend_auth
|
||||
target_link_libraries(GSSAPIBackendAuth maxscale-common gssapi_krb5 MySQLCommon)
|
||||
set_target_properties(GSSAPIBackendAuth PROPERTIES VERSION "1.0.0")
|
||||
install_module(GSSAPIBackendAuth core)
|
||||
|
||||
|
@ -281,26 +281,10 @@ int gssapi_auth_authenticate(DCB *dcb)
|
||||
|
||||
MYSQL_session *ses = (MYSQL_session*)dcb->data;
|
||||
|
||||
if (validate_gssapi_token(ses->auth_token, ses->auth_token_len))
|
||||
if (validate_gssapi_token(ses->auth_token, ses->auth_token_len) &&
|
||||
mxs_mysql_send_ok(dcb, 4, 0, NULL))
|
||||
{
|
||||
/** Auth token is valid, send the OK packet
|
||||
* @see https://dev.mysql.com/doc/internals/en/packet-OK_Packet.html */
|
||||
uint8_t ok_packet[] =
|
||||
{
|
||||
0x07, 0x00, 0x00, 0x04, // Header
|
||||
0x00, // OK byte
|
||||
0x00, // Affected rows
|
||||
0x00, // Last insert id
|
||||
0x02, 0x00, // Status flags
|
||||
0x00, 0x00 // Warnings
|
||||
};
|
||||
|
||||
GWBUF *buffer = gwbuf_alloc_and_load(sizeof(ok_packet), ok_packet);
|
||||
|
||||
if (buffer && dcb->func.write(dcb, buffer))
|
||||
{
|
||||
rval = MXS_AUTH_SUCCEEDED;
|
||||
}
|
||||
rval = MXS_AUTH_SUCCEEDED;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,6 +192,8 @@ mysql_auth_authenticate(DCB *dcb)
|
||||
if (MXS_AUTH_SUCCEEDED == auth_ret)
|
||||
{
|
||||
dcb->user = MXS_STRDUP_A(client_data->user);
|
||||
/** Send an OK packet to the client */
|
||||
mxs_mysql_send_ok(dcb, ssl_required_by_dcb(dcb) ? 3 : 2, 0, NULL);
|
||||
}
|
||||
else if (dcb->service->log_auth_warnings)
|
||||
{
|
||||
|
Reference in New Issue
Block a user