summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2020-10-02 10:19:00 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2020-10-02 10:19:00 +0400
commit0ccdf8b11b7537c93ad5f5d966666cf48d7b6857 (patch)
tree1b09325a08775d3a9ef711a354621117cc28907a /sql/sql_acl.cc
parent82bc007ffb0568bb01c1c9521d3d5d116a72fa8e (diff)
downloadmariadb-git-0ccdf8b11b7537c93ad5f5d966666cf48d7b6857.tar.gz
MDEV-19275 Provide SQL service to plugins.
test_sql_service plugin added and employed in test_sql_service.test.
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 161ffc66641..3958cb3fba7 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -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
+}
+
+