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.
This commit is contained in:
Markus Mäkelä
2017-01-28 20:48:17 +02:00
parent 041c0f1f2d
commit 2f4df0c21e
3 changed files with 125 additions and 55 deletions

View File

@ -128,7 +128,8 @@ static void* mysql_auth_init(char **options)
char *err;
if (sqlite3_exec(instance->handle, create_sql, NULL, NULL, &err) != SQLITE_OK)
if (sqlite3_exec(instance->handle, users_create_sql, NULL, NULL, &err) != SQLITE_OK ||
sqlite3_exec(instance->handle, databases_create_sql, NULL, NULL, &err) != SQLITE_OK)
{
MXS_ERROR("Failed to create database: %s", err);
sqlite3_free(err);
@ -264,9 +265,6 @@ mysql_auth_authenticate(DCB *dcb)
MXS_DEBUG("Receiving connection from '%s' to database '%s'.",
client_data->user, client_data->db);
auth_ret = combined_auth_check(dcb, client_data->auth_token, client_data->auth_token_len,
protocol, client_data->user, client_data->client_sha1, client_data->db);
MYSQL_AUTH *instance = (MYSQL_AUTH*)dcb->listener->auth_instance;
bool is_ok = validate_mysql_user(instance->handle, dcb, client_data);