1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

MDEV-19275 Provide SQL service to plugins.

test_sql_service plugin added and employed in test_sql_service.test.
This commit is contained in:
Alexey Botchkov
2020-10-02 10:19:00 +04:00
parent 82bc007ffb
commit 0ccdf8b11b
10 changed files with 630 additions and 3 deletions

View File

@ -14679,3 +14679,40 @@ maria_declare_plugin(mysql_password)
MariaDB_PLUGIN_MATURITY_STABLE /* Maturity */
}
maria_declare_plugin_end;
/*
Exporting functions that allow plugins to do server-style
host/user matching. Used in server_audit2 plugin.
*/
extern "C" int maria_compare_hostname(
const char *wild_host, long wild_ip, long ip_mask,
const char *host, const char *ip)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
acl_host_and_ip h;
h.hostname= (char *) wild_host;
h.ip= wild_ip;
h.ip_mask= ip_mask;
return compare_hostname(&h, host, ip);
#else
return 0;
#endif
}
extern "C" void maria_update_hostname(
const char **wild_host, long *wild_ip, long *ip_mask,
const char *host)
{
#ifndef NO_EMBEDDED_ACCESS_CHECKS
acl_host_and_ip h;
update_hostname(&h, host);
*wild_host= h.hostname;
*wild_ip= h.ip;
*ip_mask= h.ip_mask;
#endif
}