Skip to content

Commit c98b2b3

Browse files
committed
password validation plugin type and a simple plugin
1 parent b5357f0 commit c98b2b3

File tree

9 files changed

+608
-16
lines changed

9 files changed

+608
-16
lines changed

cmake/abi_check.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ IF(CMAKE_COMPILER_IS_GNUCC AND RUN_ABI_CHECK)
4343
${CMAKE_SOURCE_DIR}/include/mysql/psi/psi_abi_v2.h
4444
${CMAKE_SOURCE_DIR}/include/mysql/client_plugin.h
4545
${CMAKE_SOURCE_DIR}/include/mysql/plugin_auth.h
46+
${CMAKE_SOURCE_DIR}/include/mysql/plugin_password_validation.h
4647
)
4748

4849
ADD_CUSTOM_TARGET(abi_check ALL

include/mysql/plugin.h

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,19 @@ typedef struct st_mysql_xid MYSQL_XID;
8080
/*
8181
The allowable types of plugins
8282
*/
83-
#define MYSQL_UDF_PLUGIN 0 /* User-defined function */
84-
#define MYSQL_STORAGE_ENGINE_PLUGIN 1 /* Storage Engine */
83+
#define MYSQL_UDF_PLUGIN 0 /* not implemented */
84+
#define MYSQL_STORAGE_ENGINE_PLUGIN 1
8585
#define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */
86-
#define MYSQL_DAEMON_PLUGIN 3 /* The daemon/raw plugin type */
87-
#define MYSQL_INFORMATION_SCHEMA_PLUGIN 4 /* The I_S plugin type */
88-
#define MYSQL_AUDIT_PLUGIN 5 /* The Audit plugin type */
89-
#define MYSQL_REPLICATION_PLUGIN 6 /* The replication plugin type */
90-
#define MYSQL_AUTHENTICATION_PLUGIN 7 /* The authentication plugin type */
91-
#define MYSQL_VALIDATE_PASSWORD_PLUGIN 8 /* validate password plugin type */
86+
#define MYSQL_DAEMON_PLUGIN 3
87+
#define MYSQL_INFORMATION_SCHEMA_PLUGIN 4
88+
#define MYSQL_AUDIT_PLUGIN 5
89+
#define MYSQL_REPLICATION_PLUGIN 6
90+
#define MYSQL_AUTHENTICATION_PLUGIN 7
9291
#define MYSQL_MAX_PLUGIN_TYPE_NUM 9 /* The number of plugin types */
9392

93+
/* MariaDB plugin types */
94+
#define MariaDB_PASSWORD_VALIDATION_PLUGIN 8
95+
9496
/* We use the following strings to define licenses for plugins */
9597
#define PLUGIN_LICENSE_PROPRIETARY 0
9698
#define PLUGIN_LICENSE_GPL 1
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#ifndef MYSQL_PLUGIN_PASSWORD_VALIDATION_INCLUDED
2+
/* Copyright (C) 2014 Sergei Golubchik and MariaDB
3+
4+
This program is free software; you can redistribute it and/or modify
5+
it under the terms of the GNU General Public License as published by
6+
the Free Software Foundation; version 2 of the License.
7+
8+
This program is distributed in the hope that it will be useful,
9+
but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
GNU General Public License for more details.
12+
13+
You should have received a copy of the GNU General Public License
14+
along with this program; if not, write to the Free Software
15+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
16+
17+
/**
18+
@file
19+
20+
Authentication Plugin API.
21+
22+
This file defines the API for server authentication plugins.
23+
*/
24+
25+
#define MYSQL_PLUGIN_PASSWORD_VALIDATION_INCLUDED
26+
27+
#include <mysql/plugin.h>
28+
29+
#define MariaDB_PASSWORD_VALIDATION_INTERFACE_VERSION 0x0100
30+
31+
/**
32+
Password validation plugin descriptor
33+
*/
34+
struct st_mysql_password_validation
35+
{
36+
int interface_version; /**< version plugin uses */
37+
/**
38+
Function provided by the plugin which should perform password validation
39+
and return 0 if the password has passed the validation.
40+
*/
41+
int (*validate_password)(MYSQL_LEX_STRING *username,
42+
MYSQL_LEX_STRING *password);
43+
};
44+
#endif
45+

0 commit comments

Comments
 (0)