mirror of
https://github.com/MariaDB/server.git
synced 2025-01-25 00:04:33 +01:00
MDEV-5313 Improving audit api.
Service added to handle json.
This commit is contained in:
parent
dc6ad59765
commit
b1527ef51c
21 changed files with 442 additions and 16 deletions
include
json_lib.h
mysql
plugin.hplugin_audit.h.ppplugin_auth.h.ppplugin_encryption.h.ppplugin_ftparser.h.ppplugin_password_validation.h.ppservice_json.hservices.h
service_versions.hlibservices
mysql-test
main
suite/plugins/r
sql
strings
|
@ -174,11 +174,11 @@ enum json_value_types
|
|||
{
|
||||
JSON_VALUE_OBJECT=1,
|
||||
JSON_VALUE_ARRAY=2,
|
||||
JSON_VALUE_STRING,
|
||||
JSON_VALUE_NUMBER,
|
||||
JSON_VALUE_TRUE,
|
||||
JSON_VALUE_FALSE,
|
||||
JSON_VALUE_NULL
|
||||
JSON_VALUE_STRING=3,
|
||||
JSON_VALUE_NUMBER=4,
|
||||
JSON_VALUE_TRUE=5,
|
||||
JSON_VALUE_FALSE=6,
|
||||
JSON_VALUE_NULL=7
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ typedef struct st_mysql_xid MYSQL_XID;
|
|||
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0104
|
||||
|
||||
/* MariaDB plugin interface version */
|
||||
#define MARIA_PLUGIN_INTERFACE_VERSION 0x010d
|
||||
#define MARIA_PLUGIN_INTERFACE_VERSION 0x010e
|
||||
|
||||
/*
|
||||
The allowable types of plugins
|
||||
|
|
|
@ -374,6 +374,51 @@ extern struct thd_wait_service_st {
|
|||
} *thd_wait_service;
|
||||
void thd_wait_begin(void* thd, int wait_type);
|
||||
void thd_wait_end(void* thd);
|
||||
enum json_types
|
||||
{
|
||||
JSV_BAD_JSON=-1,
|
||||
JSV_NOTHING=0,
|
||||
JSV_OBJECT=1,
|
||||
JSV_ARRAY=2,
|
||||
JSV_STRING=3,
|
||||
JSV_NUMBER=4,
|
||||
JSV_TRUE=5,
|
||||
JSV_FALSE=6,
|
||||
JSV_NULL=7
|
||||
};
|
||||
extern struct json_service_st {
|
||||
enum json_types (*json_type)(const char *js, const char *js_end,
|
||||
const char **v, int *vlen);
|
||||
enum json_types (*json_get_array_item)(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **v, int *vlen);
|
||||
enum json_types (*json_get_object_key)(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **v, int *vlen);
|
||||
enum json_types (*json_get_object_nkey)(const char *js,const char *js_end,
|
||||
int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **v, int *vlen);
|
||||
int (*json_escape_string)(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int (*json_unescape_json)(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
} *json_service;
|
||||
enum json_types json_type(const char *js, const char *js_end,
|
||||
const char **v, int *vlen);
|
||||
enum json_types json_get_array_item(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **v, int *vlen);
|
||||
enum json_types json_get_object_key(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **v, int *vlen);
|
||||
enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **v, int *vlen);
|
||||
int json_escape_string(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int json_unescape_json(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
struct st_mysql_xid {
|
||||
long formatID;
|
||||
long gtrid_length;
|
||||
|
|
|
@ -374,6 +374,51 @@ extern struct thd_wait_service_st {
|
|||
} *thd_wait_service;
|
||||
void thd_wait_begin(void* thd, int wait_type);
|
||||
void thd_wait_end(void* thd);
|
||||
enum json_types
|
||||
{
|
||||
JSV_BAD_JSON=-1,
|
||||
JSV_NOTHING=0,
|
||||
JSV_OBJECT=1,
|
||||
JSV_ARRAY=2,
|
||||
JSV_STRING=3,
|
||||
JSV_NUMBER=4,
|
||||
JSV_TRUE=5,
|
||||
JSV_FALSE=6,
|
||||
JSV_NULL=7
|
||||
};
|
||||
extern struct json_service_st {
|
||||
enum json_types (*json_type)(const char *js, const char *js_end,
|
||||
const char **v, int *vlen);
|
||||
enum json_types (*json_get_array_item)(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **v, int *vlen);
|
||||
enum json_types (*json_get_object_key)(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **v, int *vlen);
|
||||
enum json_types (*json_get_object_nkey)(const char *js,const char *js_end,
|
||||
int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **v, int *vlen);
|
||||
int (*json_escape_string)(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int (*json_unescape_json)(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
} *json_service;
|
||||
enum json_types json_type(const char *js, const char *js_end,
|
||||
const char **v, int *vlen);
|
||||
enum json_types json_get_array_item(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **v, int *vlen);
|
||||
enum json_types json_get_object_key(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **v, int *vlen);
|
||||
enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **v, int *vlen);
|
||||
int json_escape_string(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int json_unescape_json(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
struct st_mysql_xid {
|
||||
long formatID;
|
||||
long gtrid_length;
|
||||
|
|
|
@ -374,6 +374,51 @@ extern struct thd_wait_service_st {
|
|||
} *thd_wait_service;
|
||||
void thd_wait_begin(void* thd, int wait_type);
|
||||
void thd_wait_end(void* thd);
|
||||
enum json_types
|
||||
{
|
||||
JSV_BAD_JSON=-1,
|
||||
JSV_NOTHING=0,
|
||||
JSV_OBJECT=1,
|
||||
JSV_ARRAY=2,
|
||||
JSV_STRING=3,
|
||||
JSV_NUMBER=4,
|
||||
JSV_TRUE=5,
|
||||
JSV_FALSE=6,
|
||||
JSV_NULL=7
|
||||
};
|
||||
extern struct json_service_st {
|
||||
enum json_types (*json_type)(const char *js, const char *js_end,
|
||||
const char **v, int *vlen);
|
||||
enum json_types (*json_get_array_item)(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **v, int *vlen);
|
||||
enum json_types (*json_get_object_key)(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **v, int *vlen);
|
||||
enum json_types (*json_get_object_nkey)(const char *js,const char *js_end,
|
||||
int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **v, int *vlen);
|
||||
int (*json_escape_string)(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int (*json_unescape_json)(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
} *json_service;
|
||||
enum json_types json_type(const char *js, const char *js_end,
|
||||
const char **v, int *vlen);
|
||||
enum json_types json_get_array_item(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **v, int *vlen);
|
||||
enum json_types json_get_object_key(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **v, int *vlen);
|
||||
enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **v, int *vlen);
|
||||
int json_escape_string(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int json_unescape_json(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
struct st_mysql_xid {
|
||||
long formatID;
|
||||
long gtrid_length;
|
||||
|
|
|
@ -374,6 +374,51 @@ extern struct thd_wait_service_st {
|
|||
} *thd_wait_service;
|
||||
void thd_wait_begin(void* thd, int wait_type);
|
||||
void thd_wait_end(void* thd);
|
||||
enum json_types
|
||||
{
|
||||
JSV_BAD_JSON=-1,
|
||||
JSV_NOTHING=0,
|
||||
JSV_OBJECT=1,
|
||||
JSV_ARRAY=2,
|
||||
JSV_STRING=3,
|
||||
JSV_NUMBER=4,
|
||||
JSV_TRUE=5,
|
||||
JSV_FALSE=6,
|
||||
JSV_NULL=7
|
||||
};
|
||||
extern struct json_service_st {
|
||||
enum json_types (*json_type)(const char *js, const char *js_end,
|
||||
const char **v, int *vlen);
|
||||
enum json_types (*json_get_array_item)(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **v, int *vlen);
|
||||
enum json_types (*json_get_object_key)(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **v, int *vlen);
|
||||
enum json_types (*json_get_object_nkey)(const char *js,const char *js_end,
|
||||
int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **v, int *vlen);
|
||||
int (*json_escape_string)(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int (*json_unescape_json)(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
} *json_service;
|
||||
enum json_types json_type(const char *js, const char *js_end,
|
||||
const char **v, int *vlen);
|
||||
enum json_types json_get_array_item(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **v, int *vlen);
|
||||
enum json_types json_get_object_key(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **v, int *vlen);
|
||||
enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **v, int *vlen);
|
||||
int json_escape_string(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int json_unescape_json(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
struct st_mysql_xid {
|
||||
long formatID;
|
||||
long gtrid_length;
|
||||
|
|
|
@ -374,6 +374,51 @@ extern struct thd_wait_service_st {
|
|||
} *thd_wait_service;
|
||||
void thd_wait_begin(void* thd, int wait_type);
|
||||
void thd_wait_end(void* thd);
|
||||
enum json_types
|
||||
{
|
||||
JSV_BAD_JSON=-1,
|
||||
JSV_NOTHING=0,
|
||||
JSV_OBJECT=1,
|
||||
JSV_ARRAY=2,
|
||||
JSV_STRING=3,
|
||||
JSV_NUMBER=4,
|
||||
JSV_TRUE=5,
|
||||
JSV_FALSE=6,
|
||||
JSV_NULL=7
|
||||
};
|
||||
extern struct json_service_st {
|
||||
enum json_types (*json_type)(const char *js, const char *js_end,
|
||||
const char **v, int *vlen);
|
||||
enum json_types (*json_get_array_item)(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **v, int *vlen);
|
||||
enum json_types (*json_get_object_key)(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **v, int *vlen);
|
||||
enum json_types (*json_get_object_nkey)(const char *js,const char *js_end,
|
||||
int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **v, int *vlen);
|
||||
int (*json_escape_string)(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int (*json_unescape_json)(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
} *json_service;
|
||||
enum json_types json_type(const char *js, const char *js_end,
|
||||
const char **v, int *vlen);
|
||||
enum json_types json_get_array_item(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **v, int *vlen);
|
||||
enum json_types json_get_object_key(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **v, int *vlen);
|
||||
enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **v, int *vlen);
|
||||
int json_escape_string(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int json_unescape_json(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
struct st_mysql_xid {
|
||||
long formatID;
|
||||
long gtrid_length;
|
||||
|
|
117
include/mysql/service_json.h
Normal file
117
include/mysql/service_json.h
Normal file
|
@ -0,0 +1,117 @@
|
|||
/* Copyright (C) 2018 MariaDB Corporation
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
|
||||
|
||||
#ifndef MYSQL_SERVICE_JSON
|
||||
#define MYSQL_SERVICE_JSON
|
||||
|
||||
/**
|
||||
@file
|
||||
json service
|
||||
|
||||
Esports JSON parsing methods for plugins to use.
|
||||
|
||||
Fuctions of the service:
|
||||
js_type - returns the type of the JSON argument,
|
||||
and the parsed value if it's scalar (not object or array)
|
||||
|
||||
js_get_array_item - expecs JSON array as an argument,
|
||||
and returns the n_item's item's type and value
|
||||
Returns JSV_NOTHING type if the array is shorter
|
||||
than n_item and the actual length of the array in v_len.
|
||||
|
||||
js_get_object_key - expects JSON object as an argument,
|
||||
searches for a key in the object, return it's type and value.
|
||||
JSV_NOTHING if no such key found, the number of keys
|
||||
in v_len.
|
||||
|
||||
js_get_object_nkey - expects JSON object as an argument.
|
||||
finds n_key's key in the object, returns it's name, type and value.
|
||||
JSV_NOTHING if object has less keys than n_key.
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum json_types
|
||||
{
|
||||
JSV_BAD_JSON=-1,
|
||||
JSV_NOTHING=0,
|
||||
JSV_OBJECT=1,
|
||||
JSV_ARRAY=2,
|
||||
JSV_STRING=3,
|
||||
JSV_NUMBER=4,
|
||||
JSV_TRUE=5,
|
||||
JSV_FALSE=6,
|
||||
JSV_NULL=7
|
||||
};
|
||||
|
||||
extern struct json_service_st {
|
||||
enum json_types (*json_type)(const char *js, const char *js_end,
|
||||
const char **v, int *vlen);
|
||||
enum json_types (*json_get_array_item)(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **v, int *vlen);
|
||||
enum json_types (*json_get_object_key)(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **v, int *vlen);
|
||||
enum json_types (*json_get_object_nkey)(const char *js,const char *js_end,
|
||||
int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **v, int *vlen);
|
||||
int (*json_escape_string)(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int (*json_unescape_json)(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
} *json_service;
|
||||
|
||||
#ifdef MYSQL_DYNAMIC_PLUGIN
|
||||
|
||||
#define json_type json_service->json_type
|
||||
#define json_get_array_item json_service->json_get_array_item
|
||||
#define json_get_object_key json_service->json_get_object_key
|
||||
#define json_get_object_nkey json_service->json_get_object_nkey
|
||||
#define json_escape_string json_service->json_escape_string
|
||||
#define json_unescape_json json_service->json_unescape_json
|
||||
|
||||
#else
|
||||
|
||||
enum json_types json_type(const char *js, const char *js_end,
|
||||
const char **v, int *vlen);
|
||||
enum json_types json_get_array_item(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **v, int *vlen);
|
||||
enum json_types json_get_object_key(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **v, int *vlen);
|
||||
enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **v, int *vlen);
|
||||
int json_escape_string(const char *str,const char *str_end,
|
||||
char *json, char *json_end);
|
||||
int json_unescape_json(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end);
|
||||
|
||||
#endif /*MYSQL_DYNAMIC_PLUGIN*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /*MYSQL_SERVICE_JSON */
|
||||
|
||||
|
|
@ -39,6 +39,7 @@ extern "C" {
|
|||
#include <mysql/service_thd_specifics.h>
|
||||
#include <mysql/service_thd_timezone.h>
|
||||
#include <mysql/service_thd_wait.h>
|
||||
#include <mysql/service_json.h>
|
||||
/*#include <mysql/service_wsrep.h>*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -42,3 +42,4 @@
|
|||
#define VERSION_thd_timezone 0x0100
|
||||
#define VERSION_thd_wait 0x0100
|
||||
#define VERSION_wsrep 0x0202
|
||||
#define VERSION_json 0x0100
|
||||
|
|
|
@ -37,6 +37,7 @@ SET(MYSQLSERVICES_SOURCES
|
|||
thd_timezone_service.c
|
||||
thd_wait_service.c
|
||||
wsrep_service.c
|
||||
json_service.c
|
||||
)
|
||||
|
||||
ADD_CONVENIENCE_LIBRARY(mysqlservices ${MYSQLSERVICES_SOURCES})
|
||||
|
|
19
libservices/json_service.c
Normal file
19
libservices/json_service.c
Normal file
|
@ -0,0 +1,19 @@
|
|||
|
||||
/* Copyright (c) 2018, Monty Program Ab
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <service_versions.h>
|
||||
SERVICE_VERSION json_service= (void*)VERSION_json;
|
|
@ -5,7 +5,7 @@ plugin_version 1.0
|
|||
plugin_status ACTIVE
|
||||
plugin_type DAEMON
|
||||
plugin_library handlersocket.so
|
||||
plugin_library_version 1.13
|
||||
plugin_library_version 1.14
|
||||
plugin_author higuchi dot akira at dena dot jp
|
||||
plugin_description Direct access into InnoDB
|
||||
plugin_license BSD
|
||||
|
|
|
@ -12,7 +12,7 @@ PLUGIN_STATUS ACTIVE
|
|||
PLUGIN_TYPE STORAGE ENGINE
|
||||
PLUGIN_TYPE_VERSION #
|
||||
PLUGIN_LIBRARY ha_example.so
|
||||
PLUGIN_LIBRARY_VERSION 1.13
|
||||
PLUGIN_LIBRARY_VERSION 1.14
|
||||
PLUGIN_AUTHOR Brian Aker, MySQL AB
|
||||
PLUGIN_DESCRIPTION Example storage engine
|
||||
PLUGIN_LICENSE GPL
|
||||
|
@ -25,7 +25,7 @@ PLUGIN_STATUS ACTIVE
|
|||
PLUGIN_TYPE DAEMON
|
||||
PLUGIN_TYPE_VERSION #
|
||||
PLUGIN_LIBRARY ha_example.so
|
||||
PLUGIN_LIBRARY_VERSION 1.13
|
||||
PLUGIN_LIBRARY_VERSION 1.14
|
||||
PLUGIN_AUTHOR Sergei Golubchik
|
||||
PLUGIN_DESCRIPTION Unusable Daemon
|
||||
PLUGIN_LICENSE GPL
|
||||
|
@ -64,7 +64,7 @@ PLUGIN_STATUS DELETED
|
|||
PLUGIN_TYPE STORAGE ENGINE
|
||||
PLUGIN_TYPE_VERSION #
|
||||
PLUGIN_LIBRARY ha_example.so
|
||||
PLUGIN_LIBRARY_VERSION 1.13
|
||||
PLUGIN_LIBRARY_VERSION 1.14
|
||||
PLUGIN_AUTHOR Brian Aker, MySQL AB
|
||||
PLUGIN_DESCRIPTION Example storage engine
|
||||
PLUGIN_LICENSE GPL
|
||||
|
|
|
@ -27,7 +27,7 @@ PLUGIN_STATUS ACTIVE
|
|||
PLUGIN_TYPE AUTHENTICATION
|
||||
PLUGIN_TYPE_VERSION 2.2
|
||||
PLUGIN_LIBRARY auth_ed25519.so
|
||||
PLUGIN_LIBRARY_VERSION 1.13
|
||||
PLUGIN_LIBRARY_VERSION 1.14
|
||||
PLUGIN_AUTHOR Sergei Golubchik
|
||||
PLUGIN_DESCRIPTION Elliptic curve ED25519 based authentication
|
||||
PLUGIN_LICENSE GPL
|
||||
|
|
|
@ -6,7 +6,7 @@ PLUGIN_STATUS ACTIVE
|
|||
PLUGIN_TYPE PASSWORD VALIDATION
|
||||
PLUGIN_TYPE_VERSION 1.0
|
||||
PLUGIN_LIBRARY cracklib_password_check.so
|
||||
PLUGIN_LIBRARY_VERSION 1.13
|
||||
PLUGIN_LIBRARY_VERSION 1.14
|
||||
PLUGIN_AUTHOR Sergei Golubchik
|
||||
PLUGIN_DESCRIPTION Password validation via CrackLib
|
||||
PLUGIN_LICENSE GPL
|
||||
|
|
|
@ -4,8 +4,8 @@ Variable_name Value
|
|||
Opened_plugin_libraries 0
|
||||
select * from information_schema.all_plugins where plugin_library='ha_example.so';
|
||||
PLUGIN_NAME PLUGIN_VERSION PLUGIN_STATUS PLUGIN_TYPE PLUGIN_TYPE_VERSION PLUGIN_LIBRARY PLUGIN_LIBRARY_VERSION PLUGIN_AUTHOR PLUGIN_DESCRIPTION PLUGIN_LICENSE LOAD_OPTION PLUGIN_MATURITY PLUGIN_AUTH_VERSION
|
||||
EXAMPLE 0.1 NOT INSTALLED STORAGE ENGINE MYSQL_VERSION_ID ha_example.so 1.13 Brian Aker, MySQL AB Example storage engine GPL OFF Experimental 0.1
|
||||
UNUSABLE 3.14 NOT INSTALLED DAEMON MYSQL_VERSION_ID ha_example.so 1.13 Sergei Golubchik Unusable Daemon GPL OFF Experimental 3.14.15.926
|
||||
EXAMPLE 0.1 NOT INSTALLED STORAGE ENGINE MYSQL_VERSION_ID ha_example.so 1.14 Brian Aker, MySQL AB Example storage engine GPL OFF Experimental 0.1
|
||||
UNUSABLE 3.14 NOT INSTALLED DAEMON MYSQL_VERSION_ID ha_example.so 1.14 Sergei Golubchik Unusable Daemon GPL OFF Experimental 3.14.15.926
|
||||
show status like '%libraries%';
|
||||
Variable_name Value
|
||||
Opened_plugin_libraries 1
|
||||
|
|
|
@ -6,7 +6,7 @@ PLUGIN_STATUS ACTIVE
|
|||
PLUGIN_TYPE PASSWORD VALIDATION
|
||||
PLUGIN_TYPE_VERSION 1.0
|
||||
PLUGIN_LIBRARY simple_password_check.so
|
||||
PLUGIN_LIBRARY_VERSION 1.13
|
||||
PLUGIN_LIBRARY_VERSION 1.14
|
||||
PLUGIN_AUTHOR Sergei Golubchik
|
||||
PLUGIN_DESCRIPTION Simple password strength checks
|
||||
PLUGIN_LICENSE GPL
|
||||
|
|
|
@ -3963,9 +3963,28 @@ static void my_malloc_size_cb_func(long long size, my_bool is_thread_specific)
|
|||
else
|
||||
update_global_memory_status(size);
|
||||
}
|
||||
|
||||
int json_escape_string(const char *str,const char *str_end,
|
||||
char *json, char *json_end)
|
||||
{
|
||||
return json_escape(system_charset_info,
|
||||
(const uchar *) str, (const uchar *) str_end,
|
||||
&my_charset_utf8mb4_bin,
|
||||
(uchar *) json, (uchar *) json_end);
|
||||
}
|
||||
|
||||
|
||||
int json_unescape_json(const char *json_str, const char *json_end,
|
||||
char *res, char *res_end)
|
||||
{
|
||||
return json_unescape(&my_charset_utf8mb4_bin,
|
||||
(const uchar *) json_str, (const uchar *) json_end,
|
||||
system_charset_info, (uchar *) res, (uchar *) res_end);
|
||||
}
|
||||
|
||||
} /*extern "C"*/
|
||||
|
||||
|
||||
/**
|
||||
Create a replication file name or base for file names.
|
||||
|
||||
|
|
|
@ -217,6 +217,16 @@ static struct my_print_error_service_st my_print_error_handler=
|
|||
my_printv_error
|
||||
};
|
||||
|
||||
struct json_service_st json_handler=
|
||||
{
|
||||
json_type,
|
||||
json_get_array_item,
|
||||
json_get_object_key,
|
||||
json_get_object_nkey,
|
||||
json_escape_string,
|
||||
json_unescape_json
|
||||
};
|
||||
|
||||
static struct st_service_ref list_of_services[]=
|
||||
{
|
||||
{ "base64_service", VERSION_base64, &base64_handler },
|
||||
|
@ -239,6 +249,7 @@ static struct st_service_ref list_of_services[]=
|
|||
{ "thd_specifics_service", VERSION_thd_specifics, &thd_specifics_handler },
|
||||
{ "thd_timezone_service", VERSION_thd_timezone, &thd_timezone_handler },
|
||||
{ "thd_wait_service", VERSION_thd_wait, &thd_wait_handler },
|
||||
{ "wsrep_service", VERSION_wsrep, &wsrep_handler }
|
||||
{ "wsrep_service", VERSION_wsrep, &wsrep_handler },
|
||||
{ "json_service", VERSION_json, &json_handler }
|
||||
};
|
||||
|
||||
|
|
|
@ -1846,3 +1846,35 @@ int json_path_compare(const json_path_t *a, const json_path_t *b,
|
|||
b->steps+1, b->last_step, vt);
|
||||
}
|
||||
|
||||
|
||||
enum json_types json_type(const char *js, const char *js_end,
|
||||
const char **v, int *vlen)
|
||||
{
|
||||
return JSV_NOTHING;
|
||||
}
|
||||
|
||||
|
||||
enum json_types json_get_array_item(const char *js, const char *js_end,
|
||||
int n_item,
|
||||
const char **v, int *vlen)
|
||||
{
|
||||
return JSV_NOTHING;
|
||||
}
|
||||
|
||||
|
||||
enum json_types json_get_object_key(const char *js, const char *js_end,
|
||||
const char *key,
|
||||
const char **v, int *vlen)
|
||||
{
|
||||
return JSV_NOTHING;
|
||||
}
|
||||
|
||||
|
||||
enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey,
|
||||
const char **keyname, const char **keyname_end,
|
||||
const char **v, int *vlen)
|
||||
{
|
||||
return JSV_NOTHING;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue