Format authenticator and protocol modules
This commit is contained in:
@ -147,58 +147,58 @@ extern "C"
|
||||
*
|
||||
* @return The module object
|
||||
*/
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
static modulecmd_arg_type_t args[] =
|
||||
{
|
||||
static modulecmd_arg_type_t args[] =
|
||||
{MODULECMD_ARG_SERVICE, "Service where the user is added"},
|
||||
{MODULECMD_ARG_STRING, "User to add" },
|
||||
{MODULECMD_ARG_STRING, "Password of the user" }
|
||||
};
|
||||
|
||||
modulecmd_register_command("cdc",
|
||||
"add_user",
|
||||
MODULECMD_TYPE_ACTIVE,
|
||||
cdc_add_new_user,
|
||||
3,
|
||||
args,
|
||||
"Add a new CDC user");
|
||||
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
NULL, /* No initialize entry point */
|
||||
NULL, /* No create entry point */
|
||||
cdc_auth_set_protocol_data, /* Extract data into structure */
|
||||
cdc_auth_is_client_ssl_capable, /* Check if client supports SSL */
|
||||
cdc_auth_authenticate, /* Authenticate user credentials */
|
||||
cdc_auth_free_client_data, /* Free the client data held in DCB */
|
||||
NULL, /* No destroy entry point */
|
||||
cdc_replace_users, /* Load CDC users */
|
||||
users_default_diagnostic, /* Default diagnostic */
|
||||
users_default_diagnostic_json, /* Default diagnostic */
|
||||
NULL /* No user reauthentication */
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_GA,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"The CDC client to MaxScale authenticator implementation",
|
||||
"V1.1.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
{MODULECMD_ARG_SERVICE, "Service where the user is added"},
|
||||
{MODULECMD_ARG_STRING, "User to add" },
|
||||
{MODULECMD_ARG_STRING, "Password of the user" }
|
||||
};
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
|
||||
modulecmd_register_command("cdc",
|
||||
"add_user",
|
||||
MODULECMD_TYPE_ACTIVE,
|
||||
cdc_add_new_user,
|
||||
3,
|
||||
args,
|
||||
"Add a new CDC user");
|
||||
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
NULL, /* No initialize entry point */
|
||||
NULL, /* No create entry point */
|
||||
cdc_auth_set_protocol_data, /* Extract data into structure */
|
||||
cdc_auth_is_client_ssl_capable, /* Check if client supports SSL */
|
||||
cdc_auth_authenticate, /* Authenticate user credentials */
|
||||
cdc_auth_free_client_data, /* Free the client data held in DCB */
|
||||
NULL, /* No destroy entry point */
|
||||
cdc_replace_users, /* Load CDC users */
|
||||
users_default_diagnostic, /* Default diagnostic */
|
||||
users_default_diagnostic_json, /* Default diagnostic */
|
||||
NULL /* No user reauthentication */
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_GA,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"The CDC client to MaxScale authenticator implementation",
|
||||
"V1.1.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
|
||||
return &info;
|
||||
}
|
||||
return &info;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -703,41 +703,41 @@ extern "C"
|
||||
/**
|
||||
* Module handle entry point
|
||||
*/
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
gssapi_auth_init, /* Initialize authenticator */
|
||||
gssapi_auth_alloc, /* Allocate authenticator data */
|
||||
gssapi_auth_extract, /* Extract data into structure */
|
||||
gssapi_auth_connectssl, /* Check if client supports SSL */
|
||||
gssapi_auth_authenticate, /* Authenticate user credentials */
|
||||
gssapi_auth_free_data, /* Free the client data held in DCB */
|
||||
gssapi_auth_free, /* Free authenticator data */
|
||||
gssapi_auth_load_users, /* Load database users */
|
||||
users_default_diagnostic, /* Default user diagnostic */
|
||||
users_default_diagnostic_json, /* Default user diagnostic */
|
||||
NULL /* No user reauthentication */
|
||||
};
|
||||
gssapi_auth_init, /* Initialize authenticator */
|
||||
gssapi_auth_alloc, /* Allocate authenticator data */
|
||||
gssapi_auth_extract, /* Extract data into structure */
|
||||
gssapi_auth_connectssl, /* Check if client supports SSL */
|
||||
gssapi_auth_authenticate, /* Authenticate user credentials */
|
||||
gssapi_auth_free_data, /* Free the client data held in DCB */
|
||||
gssapi_auth_free, /* Free authenticator data */
|
||||
gssapi_auth_load_users, /* Load database users */
|
||||
users_default_diagnostic, /* Default user diagnostic */
|
||||
users_default_diagnostic_json, /* Default user diagnostic */
|
||||
NULL /* No user reauthentication */
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
static MXS_MODULE info =
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_GA,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"GSSAPI authenticator",
|
||||
"V1.0.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_GA,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"GSSAPI authenticator",
|
||||
"V1.0.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
|
||||
return &info;
|
||||
}
|
||||
return &info;
|
||||
}
|
||||
}
|
||||
|
@ -226,41 +226,41 @@ extern "C"
|
||||
/**
|
||||
* Module handle entry point
|
||||
*/
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
NULL, /* No initialize entry point */
|
||||
gssapi_backend_auth_alloc, /* Allocate authenticator data */
|
||||
gssapi_backend_auth_extract, /* Extract data into structure */
|
||||
gssapi_backend_auth_connectssl, /* Check if client supports SSL */
|
||||
gssapi_backend_auth_authenticate, /* Authenticate user credentials */
|
||||
NULL, /* Client plugin will free shared data */
|
||||
gssapi_backend_auth_free, /* Free authenticator data */
|
||||
NULL, /* Load users from backend databases */
|
||||
NULL, /* No diagnostic */
|
||||
NULL,
|
||||
NULL /* No user reauthentication */
|
||||
};
|
||||
NULL, /* No initialize entry point */
|
||||
gssapi_backend_auth_alloc, /* Allocate authenticator data */
|
||||
gssapi_backend_auth_extract, /* Extract data into structure */
|
||||
gssapi_backend_auth_connectssl, /* Check if client supports SSL */
|
||||
gssapi_backend_auth_authenticate, /* Authenticate user credentials */
|
||||
NULL, /* Client plugin will free shared data */
|
||||
gssapi_backend_auth_free, /* Free authenticator data */
|
||||
NULL, /* Load users from backend databases */
|
||||
NULL, /* No diagnostic */
|
||||
NULL,
|
||||
NULL /* No user reauthentication */
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
static MXS_MODULE info =
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_GA,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"GSSAPI backend authenticator",
|
||||
"V1.0.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_GA,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"GSSAPI backend authenticator",
|
||||
"V1.0.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
|
||||
return &info;
|
||||
}
|
||||
return &info;
|
||||
}
|
||||
}
|
||||
|
@ -57,43 +57,43 @@ extern "C"
|
||||
*
|
||||
* @return The module object
|
||||
*/
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
NULL, /* No initialize entry point */
|
||||
NULL, /* No create entry point */
|
||||
http_auth_set_protocol_data, /* Extract data into structure */
|
||||
http_auth_is_client_ssl_capable,/* Check if client supports SSL */
|
||||
http_auth_authenticate, /* Authenticate user credentials */
|
||||
http_auth_free_client_data, /* Free the client data held in DCB */
|
||||
NULL, /* No destroy entry point */
|
||||
users_default_loadusers, /* Load generic users */
|
||||
users_default_diagnostic, /* Default user diagnostic */
|
||||
users_default_diagnostic_json, /* Default user diagnostic */
|
||||
NULL /* No user reauthentication */
|
||||
};
|
||||
NULL, /* No initialize entry point */
|
||||
NULL, /* No create entry point */
|
||||
http_auth_set_protocol_data, /* Extract data into structure */
|
||||
http_auth_is_client_ssl_capable, /* Check if client supports SSL */
|
||||
http_auth_authenticate, /* Authenticate user credentials */
|
||||
http_auth_free_client_data, /* Free the client data held in DCB */
|
||||
NULL, /* No destroy entry point */
|
||||
users_default_loadusers, /* Load generic users */
|
||||
users_default_diagnostic, /* Default user diagnostic */
|
||||
users_default_diagnostic_json, /* Default user diagnostic */
|
||||
NULL /* No user reauthentication */
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
static MXS_MODULE info =
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_GA,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"The MaxScale HTTP BA authenticator",
|
||||
"V1.1.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_GA,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"The MaxScale HTTP BA authenticator",
|
||||
"V1.1.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
|
||||
return &info;
|
||||
}
|
||||
return &info;
|
||||
}
|
||||
/*lint +e14 */
|
||||
}
|
||||
|
||||
|
@ -51,43 +51,43 @@ extern "C"
|
||||
*
|
||||
* @return The module object
|
||||
*/
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
NULL, /* No initialize entry point */
|
||||
NULL, /* No create entry point */
|
||||
max_admin_auth_set_protocol_data, /* Extract data into structure */
|
||||
max_admin_auth_is_client_ssl_capable, /* Check if client supports SSL */
|
||||
max_admin_auth_authenticate, /* Authenticate user credentials */
|
||||
max_admin_auth_free_client_data, /* Free the client data held in DCB */
|
||||
NULL, /* No destroy entry point */
|
||||
users_default_loadusers, /* Load generic users */
|
||||
users_default_diagnostic, /* Default user diagnostic */
|
||||
users_default_diagnostic_json, /* Default user diagnostic */
|
||||
NULL /* No user reauthentication */
|
||||
};
|
||||
NULL, /* No initialize entry point */
|
||||
NULL, /* No create entry point */
|
||||
max_admin_auth_set_protocol_data, /* Extract data into structure */
|
||||
max_admin_auth_is_client_ssl_capable, /* Check if client supports SSL */
|
||||
max_admin_auth_authenticate, /* Authenticate user credentials */
|
||||
max_admin_auth_free_client_data, /* Free the client data held in DCB */
|
||||
NULL, /* No destroy entry point */
|
||||
users_default_loadusers, /* Load generic users */
|
||||
users_default_diagnostic, /* Default user diagnostic */
|
||||
users_default_diagnostic_json, /* Default user diagnostic */
|
||||
NULL /* No user reauthentication */
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
static MXS_MODULE info =
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_GA,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"The MaxScale Admin client authenticator implementation",
|
||||
"V2.1.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_GA,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"The MaxScale Admin client authenticator implementation",
|
||||
"V2.1.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
|
||||
return &info;
|
||||
}
|
||||
return &info;
|
||||
}
|
||||
/*lint +e14 */
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ static char* get_mariadb_101_users_query(bool include_root)
|
||||
*/
|
||||
static const char* get_password_column_name(const SERVER::Version& version)
|
||||
{
|
||||
const char* rval = "password"; // Usual result, used in MariaDB.
|
||||
const char* rval = "password"; // Usual result, used in MariaDB.
|
||||
auto major = version.major;
|
||||
auto minor = version.minor;
|
||||
if ((major == 5 && minor == 7) || (major == 8 && minor == 0))
|
||||
@ -254,9 +254,9 @@ int replace_mysql_users(Listener* listener, bool skip_local)
|
||||
|
||||
static bool check_password(const char* output,
|
||||
uint8_t* token,
|
||||
size_t token_len,
|
||||
size_t token_len,
|
||||
uint8_t* scramble,
|
||||
size_t scramble_len,
|
||||
size_t scramble_len,
|
||||
uint8_t* phase2_scramble)
|
||||
{
|
||||
uint8_t stored_token[SHA_DIGEST_LENGTH] = {};
|
||||
@ -365,7 +365,7 @@ int validate_mysql_user(MYSQL_AUTH* instance,
|
||||
DCB* dcb,
|
||||
MYSQL_session* session,
|
||||
uint8_t* scramble,
|
||||
size_t scramble_len)
|
||||
size_t scramble_len)
|
||||
{
|
||||
sqlite3* handle = get_handle(instance);
|
||||
const char* validate_query = instance->lower_case_table_names ?
|
||||
@ -782,7 +782,7 @@ static bool check_table_permissions(MYSQL* mysql,
|
||||
*/
|
||||
static bool check_default_table_permissions(MYSQL* mysql,
|
||||
SERVICE* service,
|
||||
SERVER* server,
|
||||
SERVER* server,
|
||||
const char* user)
|
||||
{
|
||||
bool rval = true;
|
||||
@ -839,7 +839,7 @@ static bool check_default_table_permissions(MYSQL* mysql,
|
||||
*/
|
||||
static bool check_clustrix_table_permissions(MYSQL* mysql,
|
||||
SERVICE* service,
|
||||
SERVER* server,
|
||||
SERVER* server,
|
||||
const char* user)
|
||||
{
|
||||
bool rval = true;
|
||||
@ -875,7 +875,7 @@ static bool check_clustrix_table_permissions(MYSQL* mysql,
|
||||
* are missing.
|
||||
*/
|
||||
static bool check_server_permissions(SERVICE* service,
|
||||
SERVER* server,
|
||||
SERVER* server,
|
||||
const char* user,
|
||||
const char* password)
|
||||
{
|
||||
@ -1120,7 +1120,7 @@ int get_users_from_server(MYSQL* con, SERVER_REF* server_ref, SERVICE* service,
|
||||
{
|
||||
SERVER* server = server_ref->server;
|
||||
auto server_version = server->version();
|
||||
if (server_version.total == 0) // No monitor or the monitor hasn't ran yet.
|
||||
if (server_version.total == 0) // No monitor or the monitor hasn't ran yet.
|
||||
{
|
||||
mxs_mysql_update_server_version(server, con);
|
||||
server_version = server->version();
|
||||
|
@ -48,7 +48,7 @@ static void mysql_auth_destroy(void* data);
|
||||
|
||||
static int combined_auth_check(DCB* dcb,
|
||||
uint8_t* auth_token,
|
||||
size_t auth_token_len,
|
||||
size_t auth_token_len,
|
||||
MySQLProtocol* protocol,
|
||||
char* username,
|
||||
uint8_t* stage1_hash,
|
||||
@ -64,11 +64,11 @@ json_t* mysql_auth_diagnostic_json(const Listener* port);
|
||||
int mysql_auth_reauthenticate(DCB* dcb,
|
||||
const char* user,
|
||||
uint8_t* token,
|
||||
size_t token_len,
|
||||
size_t token_len,
|
||||
uint8_t* scramble,
|
||||
size_t scramble_len,
|
||||
size_t scramble_len,
|
||||
uint8_t* output_token,
|
||||
size_t output_token_len);
|
||||
size_t output_token_len);
|
||||
|
||||
extern "C"
|
||||
{
|
||||
@ -80,43 +80,43 @@ extern "C"
|
||||
*
|
||||
* @return The module object
|
||||
*/
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
mysql_auth_init, /* Initialize the authenticator */
|
||||
NULL, /* Create entry point */
|
||||
mysql_auth_set_protocol_data, /* Extract data into structure */
|
||||
mysql_auth_is_client_ssl_capable, /* Check if client supports SSL */
|
||||
mysql_auth_authenticate, /* Authenticate user credentials */
|
||||
mysql_auth_free_client_data, /* Free the client data held in DCB */
|
||||
NULL, /* Destroy entry point */
|
||||
mysql_auth_load_users, /* Load users from backend databases */
|
||||
mysql_auth_diagnostic,
|
||||
mysql_auth_diagnostic_json,
|
||||
mysql_auth_reauthenticate /* Handle COM_CHANGE_USER */
|
||||
};
|
||||
mysql_auth_init, /* Initialize the authenticator */
|
||||
NULL, /* Create entry point */
|
||||
mysql_auth_set_protocol_data, /* Extract data into structure */
|
||||
mysql_auth_is_client_ssl_capable, /* Check if client supports SSL */
|
||||
mysql_auth_authenticate, /* Authenticate user credentials */
|
||||
mysql_auth_free_client_data, /* Free the client data held in DCB */
|
||||
NULL, /* Destroy entry point */
|
||||
mysql_auth_load_users, /* Load users from backend databases */
|
||||
mysql_auth_diagnostic,
|
||||
mysql_auth_diagnostic_json,
|
||||
mysql_auth_reauthenticate /* Handle COM_CHANGE_USER */
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
static MXS_MODULE info =
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_GA,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"The MySQL client to MaxScale authenticator implementation",
|
||||
"V1.1.0",
|
||||
ACAP_TYPE_ASYNC,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_GA,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"The MySQL client to MaxScale authenticator implementation",
|
||||
"V1.1.0",
|
||||
ACAP_TYPE_ASYNC,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
|
||||
return &info;
|
||||
}
|
||||
return &info;
|
||||
}
|
||||
}
|
||||
|
||||
static bool open_instance_database(const char* path, sqlite3** handle)
|
||||
@ -294,14 +294,14 @@ static GWBUF* gen_auth_switch_request_packet(MySQLProtocol* proto, MYSQL_session
|
||||
gw_mysql_set_byte3(bufdata, payloadlen);
|
||||
bufdata += 3;
|
||||
*bufdata++ = client_data->next_sequence;
|
||||
*bufdata++ = MYSQL_REPLY_AUTHSWITCHREQUEST; // AuthSwitchRequest command
|
||||
*bufdata++ = MYSQL_REPLY_AUTHSWITCHREQUEST; // AuthSwitchRequest command
|
||||
memcpy(bufdata, plugin, sizeof(plugin));
|
||||
bufdata += sizeof(plugin);
|
||||
memcpy(bufdata, proto->scramble, GW_MYSQL_SCRAMBLE_SIZE);
|
||||
bufdata += GW_MYSQL_SCRAMBLE_SIZE;
|
||||
*bufdata = '\0';
|
||||
return buffer;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* @brief Authenticates a MySQL user who is a client to MaxScale.
|
||||
*
|
||||
@ -448,8 +448,8 @@ static bool mysql_auth_set_protocol_data(DCB* dcb, GWBUF* buf)
|
||||
* contain required data. If the buffer is unexpectedly large (likely an erroneous or malicious client),
|
||||
* discard the packet as parsing it may cause overflow. The limit is just a guess, but it seems the
|
||||
* packets from most plugins are < 100 bytes. */
|
||||
if ((!client_data->auth_switch_sent &&
|
||||
(client_auth_packet_size >= MYSQL_AUTH_PACKET_BASE_SIZE && client_auth_packet_size < 1028))
|
||||
if ((!client_data->auth_switch_sent
|
||||
&& (client_auth_packet_size >= MYSQL_AUTH_PACKET_BASE_SIZE && client_auth_packet_size < 1028))
|
||||
// If the client is replying to an AuthSwitchRequest, the length is predetermined.
|
||||
|| (client_data->auth_switch_sent
|
||||
&& (client_auth_packet_size == MYSQL_HEADER_LEN + MYSQL_SCRAMBLE_LEN)))
|
||||
@ -461,8 +461,6 @@ static bool mysql_auth_set_protocol_data(DCB* dcb, GWBUF* buf)
|
||||
/* Packet is not big enough */
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -497,7 +495,7 @@ static bool read_zstr(const uint8_t* client_auth_packet, size_t client_auth_pack
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Transfer detailed data from the authentication request to the DCB.
|
||||
@ -558,8 +556,8 @@ static bool mysql_auth_set_client_data(MYSQL_session* client_data,
|
||||
client_data->auth_token_len = client_auth_packet[packet_length_used];
|
||||
packet_length_used++;
|
||||
|
||||
if (client_auth_packet_size <
|
||||
(packet_length_used + client_data->auth_token_len))
|
||||
if (client_auth_packet_size
|
||||
< (packet_length_used + client_data->auth_token_len))
|
||||
{
|
||||
/* Packet was too small to contain authentication token */
|
||||
return false;
|
||||
@ -826,11 +824,11 @@ static int mysql_auth_load_users(Listener* port)
|
||||
int mysql_auth_reauthenticate(DCB* dcb,
|
||||
const char* user,
|
||||
uint8_t* token,
|
||||
size_t token_len,
|
||||
size_t token_len,
|
||||
uint8_t* scramble,
|
||||
size_t scramble_len,
|
||||
size_t scramble_len,
|
||||
uint8_t* output_token,
|
||||
size_t output_token_len)
|
||||
size_t output_token_len)
|
||||
{
|
||||
MYSQL_session* client_data = (MYSQL_session*)dcb->data;
|
||||
MYSQL_session temp;
|
||||
|
@ -206,6 +206,6 @@ int validate_mysql_user(MYSQL_AUTH* instance,
|
||||
DCB* dcb,
|
||||
MYSQL_session* session,
|
||||
uint8_t* scramble,
|
||||
size_t scramble_len);
|
||||
size_t scramble_len);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
@ -153,42 +153,42 @@ extern "C"
|
||||
*
|
||||
* @return The module object
|
||||
*/
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
NULL, /* No initialize entry point */
|
||||
auth_backend_create, /* Create authenticator */
|
||||
auth_backend_extract, /* Extract data into structure */
|
||||
auth_backend_ssl, /* Check if client supports SSL */
|
||||
auth_backend_authenticate, /* Authenticate user credentials */
|
||||
NULL, /* The shared data is freed by the client DCB */
|
||||
auth_backend_destroy, /* Destroy authenticator */
|
||||
NULL, /* We don't need to load users */
|
||||
NULL, /* No diagnostic */
|
||||
NULL,
|
||||
NULL /* No user reauthentication */
|
||||
};
|
||||
NULL, /* No initialize entry point */
|
||||
auth_backend_create, /* Create authenticator */
|
||||
auth_backend_extract, /* Extract data into structure */
|
||||
auth_backend_ssl, /* Check if client supports SSL */
|
||||
auth_backend_authenticate, /* Authenticate user credentials */
|
||||
NULL, /* The shared data is freed by the client DCB */
|
||||
auth_backend_destroy, /* Destroy authenticator */
|
||||
NULL, /* We don't need to load users */
|
||||
NULL, /* No diagnostic */
|
||||
NULL,
|
||||
NULL /* No user reauthentication */
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
static MXS_MODULE info =
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_GA,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"The MySQL MaxScale to backend server authenticator",
|
||||
"V1.0.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_GA,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"The MySQL MaxScale to backend server authenticator",
|
||||
"V1.0.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
|
||||
return &info;
|
||||
}
|
||||
return &info;
|
||||
}
|
||||
/*lint +e14 */
|
||||
}
|
||||
|
@ -53,43 +53,43 @@ extern "C"
|
||||
*
|
||||
* @return The module object
|
||||
*/
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
NULL, /* No initialize entry point */
|
||||
NULL, /* No create entry point */
|
||||
null_auth_set_protocol_data, /* Extract data into structure */
|
||||
null_auth_is_client_ssl_capable,/* Check if client supports SSL */
|
||||
null_auth_authenticate, /* Authenticate user credentials */
|
||||
null_auth_free_client_data, /* Free the client data held in DCB */
|
||||
NULL, /* No destroy entry point */
|
||||
users_default_loadusers, /* Load generic users */
|
||||
NULL, /* No diagnostic */
|
||||
NULL,
|
||||
NULL /* No user reauthentication */
|
||||
};
|
||||
NULL, /* No initialize entry point */
|
||||
NULL, /* No create entry point */
|
||||
null_auth_set_protocol_data, /* Extract data into structure */
|
||||
null_auth_is_client_ssl_capable, /* Check if client supports SSL */
|
||||
null_auth_authenticate, /* Authenticate user credentials */
|
||||
null_auth_free_client_data, /* Free the client data held in DCB */
|
||||
NULL, /* No destroy entry point */
|
||||
users_default_loadusers, /* Load generic users */
|
||||
NULL, /* No diagnostic */
|
||||
NULL,
|
||||
NULL /* No user reauthentication */
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
static MXS_MODULE info =
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_GA,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"The Null client authenticator implementation",
|
||||
"V1.1.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_GA,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"The Null client authenticator implementation",
|
||||
"V1.1.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
|
||||
return &info;
|
||||
}
|
||||
return &info;
|
||||
}
|
||||
/*lint +e14 */
|
||||
}
|
||||
|
||||
|
@ -50,43 +50,43 @@ extern "C"
|
||||
*
|
||||
* @return The module object
|
||||
*/
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
NULL, /* No initialize entry point */
|
||||
NULL, /* No create entry point */
|
||||
null_auth_set_protocol_data, /* Extract data into structure */
|
||||
null_auth_is_client_ssl_capable,/* Check if client supports SSL */
|
||||
null_auth_authenticate, /* Authenticate user credentials */
|
||||
null_auth_free_client_data, /* Free the client data held in DCB */
|
||||
NULL, /* No destroy entry point */
|
||||
users_default_loadusers, /* Load generic users */
|
||||
NULL, /* No diagnostic */
|
||||
NULL,
|
||||
NULL /* No user reauthentication */
|
||||
};
|
||||
NULL, /* No initialize entry point */
|
||||
NULL, /* No create entry point */
|
||||
null_auth_set_protocol_data, /* Extract data into structure */
|
||||
null_auth_is_client_ssl_capable, /* Check if client supports SSL */
|
||||
null_auth_authenticate, /* Authenticate user credentials */
|
||||
null_auth_free_client_data, /* Free the client data held in DCB */
|
||||
NULL, /* No destroy entry point */
|
||||
users_default_loadusers, /* Load generic users */
|
||||
NULL, /* No diagnostic */
|
||||
NULL,
|
||||
NULL /* No user reauthentication */
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
static MXS_MODULE info =
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_GA,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"The Null client authenticator implementation",
|
||||
"V1.1.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_GA,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"The Null client authenticator implementation",
|
||||
"V1.1.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
|
||||
return &info;
|
||||
}
|
||||
return &info;
|
||||
}
|
||||
/*lint +e14 */
|
||||
}
|
||||
|
||||
|
@ -158,41 +158,41 @@ extern "C"
|
||||
/**
|
||||
* Module handle entry point
|
||||
*/
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
pam_auth_init, /* Initialize authenticator */
|
||||
pam_auth_alloc, /* Allocate authenticator data */
|
||||
pam_auth_extract, /* Extract data into structure */
|
||||
pam_auth_connectssl, /* Check if client supports SSL */
|
||||
pam_auth_authenticate, /* Authenticate user credentials */
|
||||
pam_auth_free_data, /* Free the client data held in DCB */
|
||||
pam_auth_free, /* Free authenticator data */
|
||||
pam_auth_load_users, /* Load database users */
|
||||
pam_auth_diagnostic, /* Default user diagnostic */
|
||||
pam_auth_diagnostic_json, /* Default user diagnostic */
|
||||
NULL /* No user reauthentication */
|
||||
};
|
||||
pam_auth_init, /* Initialize authenticator */
|
||||
pam_auth_alloc, /* Allocate authenticator data */
|
||||
pam_auth_extract, /* Extract data into structure */
|
||||
pam_auth_connectssl, /* Check if client supports SSL */
|
||||
pam_auth_authenticate, /* Authenticate user credentials */
|
||||
pam_auth_free_data, /* Free the client data held in DCB */
|
||||
pam_auth_free, /* Free authenticator data */
|
||||
pam_auth_load_users, /* Load database users */
|
||||
pam_auth_diagnostic, /* Default user diagnostic */
|
||||
pam_auth_diagnostic_json, /* Default user diagnostic */
|
||||
NULL /* No user reauthentication */
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
static MXS_MODULE info =
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_GA,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"PAM authenticator",
|
||||
"V1.0.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_GA,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"PAM authenticator",
|
||||
"V1.0.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
|
||||
return &info;
|
||||
}
|
||||
return &info;
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,6 @@ int user_services_cb(void* data, int columns, char** column_vals, char** column_
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PamClientSession::PamClientSession(sqlite3* dbhandle, const PamInstance& instance)
|
||||
@ -137,8 +136,8 @@ void PamClientSession::get_pam_user_services(const DCB* dcb, const MYSQL_session
|
||||
}
|
||||
|
||||
auto word_entry = [](size_t num) -> const char* {
|
||||
return (num == 1) ? "entry" : "entries";
|
||||
};
|
||||
return (num == 1) ? "entry" : "entries";
|
||||
};
|
||||
|
||||
if (!services_out->empty())
|
||||
{
|
||||
@ -152,7 +151,7 @@ void PamClientSession::get_pam_user_services(const DCB* dcb, const MYSQL_session
|
||||
// Check if a matching anonymous user exists.
|
||||
const string anon_query = string("SELECT authentication_string FROM ") + m_instance.m_tablename
|
||||
+ " WHERE " + FIELD_USER + " = ''"
|
||||
+ " AND '" + dcb->remote + "' LIKE " + FIELD_HOST +
|
||||
+ " AND '" + dcb->remote + "' LIKE " + FIELD_HOST
|
||||
+ " AND " + FIELD_PROXY + " = '1' ORDER BY authentication_string;";
|
||||
MXS_DEBUG("PAM proxy user services search sql: '%s'.", anon_query.c_str());
|
||||
|
||||
|
@ -33,7 +33,9 @@ public:
|
||||
bool extract(DCB* dcb, GWBUF* read_buffer);
|
||||
private:
|
||||
PamClientSession(sqlite3* dbhandle, const PamInstance& instance);
|
||||
void get_pam_user_services(const DCB* dcb, const MYSQL_session* session, StringVector* services_out);
|
||||
void get_pam_user_services(const DCB* dcb,
|
||||
const MYSQL_session* session,
|
||||
StringVector* services_out);
|
||||
maxscale::Buffer create_auth_change_packet() const;
|
||||
|
||||
pam_auth_state m_state; /**< Authentication state*/
|
||||
|
@ -242,10 +242,10 @@ int PamInstance::load_users(SERVICE* service)
|
||||
MYSQL_ROW row;
|
||||
while ((row = mysql_fetch_row(res)))
|
||||
{
|
||||
add_pam_user(row[0], row[1], // user, host
|
||||
row[2], row[3] && strcasecmp(row[3], "Y") == 0, // db, anydb
|
||||
row[4], // pam service
|
||||
false); // not a proxy
|
||||
add_pam_user(row[0], row[1], // user, host
|
||||
row[2], row[3] && strcasecmp(row[3], "Y") == 0,// db, anydb
|
||||
row[4], // pam service
|
||||
false); // not a proxy
|
||||
}
|
||||
mysql_free_result(res);
|
||||
}
|
||||
@ -357,13 +357,13 @@ bool PamInstance::fetch_anon_proxy_users(SERVER* server, MYSQL* conn)
|
||||
|
||||
if (!anon_users_info.empty())
|
||||
{
|
||||
MXS_INFO("Found %lu anonymous PAM user(s). Checking them for proxy grants.",
|
||||
anon_users_info.size());
|
||||
MXS_INFO("Found %lu anonymous PAM user(s). Checking them for proxy grants.",
|
||||
anon_users_info.size());
|
||||
}
|
||||
|
||||
for (const auto& elem : anon_users_info)
|
||||
{
|
||||
string query = "SHOW GRANTS FOR ''@'" + elem.first + "';";
|
||||
string query = "SHOW GRANTS FOR ''@'" + elem.first + "';";
|
||||
// Check that the anon user has a proxy grant.
|
||||
if (mysql_query(conn, query.c_str()))
|
||||
{
|
||||
@ -381,9 +381,9 @@ bool PamInstance::fetch_anon_proxy_users(SERVER* server, MYSQL* conn)
|
||||
{
|
||||
if (row[0] && strncmp(row[0], GRANT_PROXY, sizeof(GRANT_PROXY) - 1) == 0)
|
||||
{
|
||||
add_pam_user("", elem.first.c_str(), // user, host
|
||||
NULL, false, // Unused
|
||||
elem.second.c_str(), true); // service, proxy
|
||||
add_pam_user("", elem.first.c_str(), // user, host
|
||||
NULL, false, // Unused
|
||||
elem.second.c_str(), true);// service, proxy
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -75,41 +75,41 @@ extern "C"
|
||||
/**
|
||||
* Module handle entry point
|
||||
*/
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
static MXS_AUTHENTICATOR MyObject =
|
||||
{
|
||||
NULL, /* No initialize entry point */
|
||||
pam_backend_auth_alloc, /* Allocate authenticator data */
|
||||
pam_backend_auth_extract, /* Extract data into structure */
|
||||
pam_backend_auth_connectssl, /* Check if client supports SSL */
|
||||
pam_backend_auth_authenticate, /* Authenticate user credentials */
|
||||
NULL, /* Client plugin will free shared data */
|
||||
pam_backend_auth_free, /* Free authenticator data */
|
||||
NULL, /* Load users from backend databases */
|
||||
NULL, /* No diagnostic */
|
||||
NULL,
|
||||
NULL /* No user reauthentication */
|
||||
};
|
||||
NULL, /* No initialize entry point */
|
||||
pam_backend_auth_alloc, /* Allocate authenticator data */
|
||||
pam_backend_auth_extract, /* Extract data into structure */
|
||||
pam_backend_auth_connectssl, /* Check if client supports SSL */
|
||||
pam_backend_auth_authenticate, /* Authenticate user credentials */
|
||||
NULL, /* Client plugin will free shared data */
|
||||
pam_backend_auth_free, /* Free authenticator data */
|
||||
NULL, /* Load users from backend databases */
|
||||
NULL, /* No diagnostic */
|
||||
NULL,
|
||||
NULL /* No user reauthentication */
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
static MXS_MODULE info =
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_ALPHA_RELEASE,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"PAM backend authenticator",
|
||||
"V1.0.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
MXS_MODULE_API_AUTHENTICATOR,
|
||||
MXS_MODULE_ALPHA_RELEASE,
|
||||
MXS_AUTHENTICATOR_VERSION,
|
||||
"PAM backend authenticator",
|
||||
"V1.0.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
|
||||
return &info;
|
||||
}
|
||||
return &info;
|
||||
}
|
||||
}
|
||||
|
@ -71,45 +71,45 @@ extern "C"
|
||||
*
|
||||
* @return The module object
|
||||
*/
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
static MXS_PROTOCOL MyObject =
|
||||
{
|
||||
static MXS_PROTOCOL MyObject =
|
||||
{
|
||||
cdc_read_event, /* Read - EPOLLIN handler */
|
||||
cdc_write, /* Write - data from gateway */
|
||||
cdc_write_event, /* WriteReady - EPOLLOUT handler */
|
||||
cdc_error, /* Error - EPOLLERR handler */
|
||||
cdc_hangup, /* HangUp - EPOLLHUP handler */
|
||||
cdc_accept, /* Accept */
|
||||
NULL, /* Connect */
|
||||
cdc_close, /* Close */
|
||||
NULL, /* Authentication */
|
||||
cdc_default_auth, /* default authentication */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
cdc_read_event, /* Read - EPOLLIN handler */
|
||||
cdc_write, /* Write - data from gateway */
|
||||
cdc_write_event, /* WriteReady - EPOLLOUT handler */
|
||||
cdc_error, /* Error - EPOLLERR handler */
|
||||
cdc_hangup, /* HangUp - EPOLLHUP handler */
|
||||
cdc_accept, /* Accept */
|
||||
NULL, /* Connect */
|
||||
cdc_close, /* Close */
|
||||
NULL, /* Authentication */
|
||||
cdc_default_auth, /* default authentication */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
static MXS_MODULE info =
|
||||
{
|
||||
MXS_MODULE_API_PROTOCOL,
|
||||
MXS_MODULE_IN_DEVELOPMENT,
|
||||
MXS_PROTOCOL_VERSION,
|
||||
"A Change Data Capture Listener implementation for use in binlog events retrieval",
|
||||
"V1.0.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
MXS_MODULE_API_PROTOCOL,
|
||||
MXS_MODULE_IN_DEVELOPMENT,
|
||||
MXS_PROTOCOL_VERSION,
|
||||
"A Change Data Capture Listener implementation for use in binlog events retrieval",
|
||||
"V1.0.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
|
||||
return &info;
|
||||
}
|
||||
return &info;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,45 +65,45 @@ extern "C"
|
||||
*
|
||||
* @return The module object
|
||||
*/
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
static MXS_PROTOCOL MyObject =
|
||||
{
|
||||
static MXS_PROTOCOL MyObject =
|
||||
{
|
||||
httpd_read_event, /**< Read - EPOLLIN handler */
|
||||
httpd_write, /**< Write - data from gateway */
|
||||
httpd_write_event, /**< WriteReady - EPOLLOUT handler */
|
||||
httpd_error, /**< Error - EPOLLERR handler */
|
||||
httpd_hangup, /**< HangUp - EPOLLHUP handler */
|
||||
httpd_accept, /**< Accept */
|
||||
NULL, /**< Connect */
|
||||
httpd_close, /**< Close */
|
||||
NULL, /**< Authentication */
|
||||
httpd_default_auth, /**< Default authenticator */
|
||||
NULL, /**< Connection limit reached */
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
httpd_read_event, /**< Read - EPOLLIN handler */
|
||||
httpd_write, /**< Write - data from gateway */
|
||||
httpd_write_event, /**< WriteReady - EPOLLOUT handler */
|
||||
httpd_error, /**< Error - EPOLLERR handler */
|
||||
httpd_hangup, /**< HangUp - EPOLLHUP handler */
|
||||
httpd_accept, /**< Accept */
|
||||
NULL, /**< Connect */
|
||||
httpd_close, /**< Close */
|
||||
NULL, /**< Authentication */
|
||||
httpd_default_auth, /**< Default authenticator */
|
||||
NULL, /**< Connection limit reached */
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
static MXS_MODULE info =
|
||||
{
|
||||
MXS_MODULE_API_PROTOCOL,
|
||||
MXS_MODULE_IN_DEVELOPMENT,
|
||||
MXS_PROTOCOL_VERSION,
|
||||
"An experimental HTTPD implementation for use in administration",
|
||||
"V1.2.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
MXS_MODULE_API_PROTOCOL,
|
||||
MXS_MODULE_IN_DEVELOPMENT,
|
||||
MXS_PROTOCOL_VERSION,
|
||||
"An experimental HTTPD implementation for use in administration",
|
||||
"V1.2.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
|
||||
return &info;
|
||||
}
|
||||
return &info;
|
||||
}
|
||||
}
|
||||
/*lint +e14 */
|
||||
|
||||
|
@ -57,7 +57,7 @@ static int gw_send_change_user_to_backend(char* dbname,
|
||||
static void gw_send_proxy_protocol_header(DCB* backend_dcb);
|
||||
static bool get_ip_string_and_port(struct sockaddr_storage* sa,
|
||||
char* ip,
|
||||
int iplen,
|
||||
int iplen,
|
||||
in_port_t* port_out);
|
||||
static bool gw_connection_established(DCB* dcb);
|
||||
json_t* gw_json_diagnostics(DCB* dcb);
|
||||
@ -72,45 +72,45 @@ extern "C"
|
||||
*
|
||||
* @return The module object
|
||||
*/
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
static MXS_PROTOCOL MyObject =
|
||||
{
|
||||
static MXS_PROTOCOL MyObject =
|
||||
{
|
||||
gw_read_backend_event, /* Read - EPOLLIN handler */
|
||||
gw_MySQLWrite_backend, /* Write - data from gateway */
|
||||
gw_write_backend_event, /* WriteReady - EPOLLOUT handler */
|
||||
gw_error_backend_event, /* Error - EPOLLERR handler */
|
||||
gw_backend_hangup, /* HangUp - EPOLLHUP handler */
|
||||
NULL, /* Accept */
|
||||
gw_create_backend_connection, /* Connect */
|
||||
gw_backend_close, /* Close */
|
||||
gw_change_user, /* Authentication */
|
||||
gw_backend_default_auth, /* Default authenticator */
|
||||
NULL, /* Connection limit reached */
|
||||
gw_connection_established,
|
||||
gw_json_diagnostics,
|
||||
};
|
||||
gw_read_backend_event, /* Read - EPOLLIN handler */
|
||||
gw_MySQLWrite_backend, /* Write - data from gateway */
|
||||
gw_write_backend_event, /* WriteReady - EPOLLOUT handler */
|
||||
gw_error_backend_event, /* Error - EPOLLERR handler */
|
||||
gw_backend_hangup, /* HangUp - EPOLLHUP handler */
|
||||
NULL, /* Accept */
|
||||
gw_create_backend_connection, /* Connect */
|
||||
gw_backend_close, /* Close */
|
||||
gw_change_user, /* Authentication */
|
||||
gw_backend_default_auth, /* Default authenticator */
|
||||
NULL, /* Connection limit reached */
|
||||
gw_connection_established,
|
||||
gw_json_diagnostics,
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
static MXS_MODULE info =
|
||||
{
|
||||
MXS_MODULE_API_PROTOCOL,
|
||||
MXS_MODULE_GA,
|
||||
MXS_PROTOCOL_VERSION,
|
||||
"The MySQL to backend server protocol",
|
||||
"V2.0.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
MXS_MODULE_API_PROTOCOL,
|
||||
MXS_MODULE_GA,
|
||||
MXS_PROTOCOL_VERSION,
|
||||
"The MySQL to backend server protocol",
|
||||
"V2.0.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
|
||||
return &info;
|
||||
}
|
||||
return &info;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1976,7 +1976,7 @@ static void gw_send_proxy_protocol_header(DCB* backend_dcb)
|
||||
*/
|
||||
static bool get_ip_string_and_port(struct sockaddr_storage* sa,
|
||||
char* ip,
|
||||
int iplen,
|
||||
int iplen,
|
||||
in_port_t* port_out)
|
||||
{
|
||||
bool success = false;
|
||||
|
@ -155,7 +155,7 @@ GWBUF* mysql_create_com_quit(GWBUF* bufparam,
|
||||
}
|
||||
|
||||
int mysql_send_com_quit(DCB* dcb,
|
||||
int packet_number,
|
||||
int packet_number,
|
||||
GWBUF* bufparam)
|
||||
{
|
||||
GWBUF* buf;
|
||||
@ -330,8 +330,8 @@ GWBUF* mysql_create_standard_error(int packet_number,
|
||||
* @return 0 on failure, 1 on success
|
||||
*/
|
||||
int mysql_send_standard_error(DCB* dcb,
|
||||
int packet_number,
|
||||
int error_number,
|
||||
int packet_number,
|
||||
int error_number,
|
||||
const char* error_message)
|
||||
{
|
||||
GWBUF* buf;
|
||||
@ -353,8 +353,8 @@ int mysql_send_standard_error(DCB* dcb,
|
||||
*
|
||||
*/
|
||||
int mysql_send_custom_error(DCB* dcb,
|
||||
int packet_number,
|
||||
int in_affected_rows,
|
||||
int packet_number,
|
||||
int in_affected_rows,
|
||||
const char* mysql_message)
|
||||
{
|
||||
GWBUF* buf;
|
||||
@ -377,8 +377,8 @@ int mysql_send_custom_error(DCB* dcb,
|
||||
*
|
||||
*/
|
||||
int mysql_send_auth_error(DCB* dcb,
|
||||
int packet_number,
|
||||
int in_affected_rows,
|
||||
int packet_number,
|
||||
int in_affected_rows,
|
||||
const char* mysql_message)
|
||||
{
|
||||
uint8_t* outbuf = NULL;
|
||||
@ -454,7 +454,7 @@ int mysql_send_auth_error(DCB* dcb,
|
||||
}
|
||||
|
||||
char* create_auth_failed_msg(GWBUF* readbuf,
|
||||
char* hostaddr,
|
||||
char* hostaddr,
|
||||
uint8_t* sha1)
|
||||
{
|
||||
char* errstr;
|
||||
@ -485,9 +485,9 @@ char* create_auth_failed_msg(GWBUF* readbuf,
|
||||
*/
|
||||
char* create_auth_fail_str(char* username,
|
||||
char* hostaddr,
|
||||
bool password,
|
||||
bool password,
|
||||
char* db,
|
||||
int errcode)
|
||||
int errcode)
|
||||
{
|
||||
char* errstr;
|
||||
const char* ferrstr;
|
||||
|
@ -166,47 +166,47 @@ extern "C"
|
||||
*
|
||||
* @return The module object
|
||||
*/
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
MXS_INFO("Initialise MaxScaled Protocol module.");
|
||||
|
||||
static MXS_PROTOCOL MyObject =
|
||||
{
|
||||
MXS_INFO("Initialise MaxScaled Protocol module.");
|
||||
maxscaled_read_event, /**< Read - EPOLLIN handler */
|
||||
maxscaled_write, /**< Write - data from gateway */
|
||||
maxscaled_write_event, /**< WriteReady - EPOLLOUT handler */
|
||||
maxscaled_error, /**< Error - EPOLLERR handler */
|
||||
maxscaled_hangup, /**< HangUp - EPOLLHUP handler */
|
||||
maxscaled_accept, /**< Accept */
|
||||
NULL, /**< Connect */
|
||||
maxscaled_close, /**< Close */
|
||||
NULL, /**< Authentication */
|
||||
mxsd_default_auth, /**< Default authenticator */
|
||||
NULL, /**< Connection limit reached */
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static MXS_PROTOCOL MyObject =
|
||||
static MXS_MODULE info =
|
||||
{
|
||||
MXS_MODULE_API_PROTOCOL,
|
||||
MXS_MODULE_GA,
|
||||
MXS_PROTOCOL_VERSION,
|
||||
"A maxscale protocol for the administration interface",
|
||||
"V2.0.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
maxscaled_read_event, /**< Read - EPOLLIN handler */
|
||||
maxscaled_write, /**< Write - data from gateway */
|
||||
maxscaled_write_event, /**< WriteReady - EPOLLOUT handler */
|
||||
maxscaled_error, /**< Error - EPOLLERR handler */
|
||||
maxscaled_hangup, /**< HangUp - EPOLLHUP handler */
|
||||
maxscaled_accept, /**< Accept */
|
||||
NULL, /**< Connect */
|
||||
maxscaled_close, /**< Close */
|
||||
NULL, /**< Authentication */
|
||||
mxsd_default_auth, /**< Default authenticator */
|
||||
NULL, /**< Connection limit reached */
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
{
|
||||
MXS_MODULE_API_PROTOCOL,
|
||||
MXS_MODULE_GA,
|
||||
MXS_PROTOCOL_VERSION,
|
||||
"A maxscale protocol for the administration interface",
|
||||
"V2.0.0",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
|
||||
return &info;
|
||||
}
|
||||
return &info;
|
||||
}
|
||||
}
|
||||
/*lint +e14 */
|
||||
|
||||
|
@ -85,46 +85,46 @@ extern "C"
|
||||
*
|
||||
* @return The module object
|
||||
*/
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
MXS_MODULE* MXS_CREATE_MODULE()
|
||||
{
|
||||
MXS_INFO("Initialise Telnetd Protocol module.");
|
||||
|
||||
static MXS_PROTOCOL MyObject =
|
||||
{
|
||||
MXS_INFO("Initialise Telnetd Protocol module.");
|
||||
telnetd_read_event, /**< Read - EPOLLIN handler */
|
||||
telnetd_write, /**< Write - data from gateway */
|
||||
telnetd_write_event, /**< WriteReady - EPOLLOUT handler */
|
||||
telnetd_error, /**< Error - EPOLLERR handler */
|
||||
telnetd_hangup, /**< HangUp - EPOLLHUP handler */
|
||||
telnetd_accept, /**< Accept */
|
||||
NULL, /**< Connect */
|
||||
telnetd_close, /**< Close */
|
||||
NULL, /**< Authentication */
|
||||
telnetd_default_auth, /**< Default authenticator */
|
||||
NULL, /**< Connection limit reached */
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static MXS_PROTOCOL MyObject =
|
||||
static MXS_MODULE info =
|
||||
{
|
||||
MXS_MODULE_API_PROTOCOL,
|
||||
MXS_MODULE_GA,
|
||||
MXS_PROTOCOL_VERSION,
|
||||
"A telnet deamon protocol for simple administration interface",
|
||||
"V1.1.1",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
telnetd_read_event, /**< Read - EPOLLIN handler */
|
||||
telnetd_write, /**< Write - data from gateway */
|
||||
telnetd_write_event, /**< WriteReady - EPOLLOUT handler */
|
||||
telnetd_error, /**< Error - EPOLLERR handler */
|
||||
telnetd_hangup, /**< HangUp - EPOLLHUP handler */
|
||||
telnetd_accept, /**< Accept */
|
||||
NULL, /**< Connect */
|
||||
telnetd_close, /**< Close */
|
||||
NULL, /**< Authentication */
|
||||
telnetd_default_auth, /**< Default authenticator */
|
||||
NULL, /**< Connection limit reached */
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static MXS_MODULE info =
|
||||
{
|
||||
MXS_MODULE_API_PROTOCOL,
|
||||
MXS_MODULE_GA,
|
||||
MXS_PROTOCOL_VERSION,
|
||||
"A telnet deamon protocol for simple administration interface",
|
||||
"V1.1.1",
|
||||
MXS_NO_MODULE_CAPABILITIES,
|
||||
&MyObject,
|
||||
NULL, /* Process init. */
|
||||
NULL, /* Process finish. */
|
||||
NULL, /* Thread init. */
|
||||
NULL, /* Thread finish. */
|
||||
{
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
return &info;
|
||||
}
|
||||
{MXS_END_MODULE_PARAMS}
|
||||
}
|
||||
};
|
||||
return &info;
|
||||
}
|
||||
}
|
||||
/*lint +e14 */
|
||||
|
||||
|
Reference in New Issue
Block a user