Skip to content

Commit eaaa106

Browse files
committed
MDEV-35254 Make iterations count configurable in PARSEC plugin
This patch adds a global plugin variable parsec_iterations to define define the number of iterations to be used when generating the key corresponding to the password. It has a default value, lower and upper bounds.
1 parent ce6be40 commit eaaa106

24 files changed

Lines changed: 328 additions & 17 deletions

include/mysql/plugin.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ typedef struct st_mysql_xid MYSQL_XID;
8484
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0105
8585

8686
/** MariaDB plugin interface version */
87-
#define MARIA_PLUGIN_INTERFACE_VERSION 0x010f
87+
#define MARIA_PLUGIN_INTERFACE_VERSION 0x0110
8888

8989
/*
9090
The allowable types of plugins

include/mysql/plugin_audit.h.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,12 @@
337337
void my_sha512_result(void *context, unsigned char *digest);
338338
}
339339
extern "C" {
340+
extern struct thd_service_st {
341+
THD* (*get_current_thd)(void);
342+
} *thd_service;
343+
THD* get_current_thd();
344+
}
345+
extern "C" {
340346
struct st_mysql_const_lex_string
341347
{
342348
const char *str;

include/mysql/plugin_auth.h.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,12 @@
337337
void my_sha512_result(void *context, unsigned char *digest);
338338
}
339339
extern "C" {
340+
extern struct thd_service_st {
341+
THD* (*get_current_thd)(void);
342+
} *thd_service;
343+
THD* get_current_thd();
344+
}
345+
extern "C" {
340346
struct st_mysql_const_lex_string
341347
{
342348
const char *str;

include/mysql/plugin_data_type.h.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,12 @@
337337
void my_sha512_result(void *context, unsigned char *digest);
338338
}
339339
extern "C" {
340+
extern struct thd_service_st {
341+
THD* (*get_current_thd)(void);
342+
} *thd_service;
343+
THD* get_current_thd();
344+
}
345+
extern "C" {
340346
struct st_mysql_const_lex_string
341347
{
342348
const char *str;

include/mysql/plugin_encryption.h.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,12 @@
337337
void my_sha512_result(void *context, unsigned char *digest);
338338
}
339339
extern "C" {
340+
extern struct thd_service_st {
341+
THD* (*get_current_thd)(void);
342+
} *thd_service;
343+
THD* get_current_thd();
344+
}
345+
extern "C" {
340346
struct st_mysql_const_lex_string
341347
{
342348
const char *str;

include/mysql/plugin_ftparser.h.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,12 @@
337337
void my_sha512_result(void *context, unsigned char *digest);
338338
}
339339
extern "C" {
340+
extern struct thd_service_st {
341+
THD* (*get_current_thd)(void);
342+
} *thd_service;
343+
THD* get_current_thd();
344+
}
345+
extern "C" {
340346
struct st_mysql_const_lex_string
341347
{
342348
const char *str;

include/mysql/plugin_function.h.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,12 @@
337337
void my_sha512_result(void *context, unsigned char *digest);
338338
}
339339
extern "C" {
340+
extern struct thd_service_st {
341+
THD* (*get_current_thd)(void);
342+
} *thd_service;
343+
THD* get_current_thd();
344+
}
345+
extern "C" {
340346
struct st_mysql_const_lex_string
341347
{
342348
const char *str;

include/mysql/plugin_password_validation.h.pp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,12 @@
337337
void my_sha512_result(void *context, unsigned char *digest);
338338
}
339339
extern "C" {
340+
extern struct thd_service_st {
341+
THD* (*get_current_thd)(void);
342+
} *thd_service;
343+
THD* get_current_thd();
344+
}
345+
extern "C" {
340346
struct st_mysql_const_lex_string
341347
{
342348
const char *str;

include/mysql/service_thd.h

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#ifndef MYSQL_SERVICE_THD_INCLUDED
2+
/* Copyright (c) 2026, MariaDB Corporation.
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-1335 USA */
16+
17+
/**
18+
@file include/mysql/service_thd.h
19+
This service provides functions for plugins and storage engines to access
20+
current thd.
21+
*/
22+
23+
#ifdef __cplusplus
24+
extern "C" {
25+
#endif
26+
27+
extern struct thd_service_st {
28+
MYSQL_THD (*get_current_thd)(void);
29+
} *thd_service;
30+
31+
#ifdef MYSQL_DYNAMIC_PLUGIN
32+
# define get_current_thd() thd_service->get_current_thd()
33+
#else
34+
/**
35+
current thd accessor
36+
@return pointer to current thd
37+
*/
38+
MYSQL_THD get_current_thd();
39+
#endif
40+
41+
#ifdef __cplusplus
42+
}
43+
#endif
44+
45+
#define MYSQL_SERVICE_THD_INCLUDED
46+
#endif

include/mysql/services.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ extern "C" {
3232
#include <mysql/service_progress_report.h>
3333
#include <mysql/service_sha1.h>
3434
#include <mysql/service_sha2.h>
35+
#include <mysql/service_thd.h>
3536
#include <mysql/service_thd_alloc.h>
3637
#include <mysql/service_thd_autoinc.h>
3738
#include <mysql/service_thd_error_context.h>

0 commit comments

Comments
 (0)