From 0e388d43a7efe7b68903808fa8bdb521d31aa069 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 27 Oct 2018 11:53:05 +0200 Subject: [PATCH] cleanup: add 'const' to password validation API --- include/mysql/plugin_password_validation.h | 4 ++-- include/mysql/plugin_password_validation.h.pp | 4 ++-- plugin/cracklib_password_check/cracklib_password_check.c | 3 ++- plugin/simple_password_check/simple_password_check.c | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/include/mysql/plugin_password_validation.h b/include/mysql/plugin_password_validation.h index e2763483db6..699d42d6b50 100644 --- a/include/mysql/plugin_password_validation.h +++ b/include/mysql/plugin_password_validation.h @@ -42,8 +42,8 @@ struct st_mariadb_password_validation Function provided by the plugin which should perform password validation and return 0 if the password has passed the validation. */ - int (*validate_password)(MYSQL_CONST_LEX_STRING *username, - MYSQL_CONST_LEX_STRING *password); + int (*validate_password)(const MYSQL_CONST_LEX_STRING *username, + const MYSQL_CONST_LEX_STRING *password); }; #ifdef __cplusplus diff --git a/include/mysql/plugin_password_validation.h.pp b/include/mysql/plugin_password_validation.h.pp index 9701ad1b92f..b13f8cc9afb 100644 --- a/include/mysql/plugin_password_validation.h.pp +++ b/include/mysql/plugin_password_validation.h.pp @@ -531,6 +531,6 @@ void thd_wakeup_subsequent_commits(void* thd, int wakeup_error); struct st_mariadb_password_validation { int interface_version; - int (*validate_password)(MYSQL_CONST_LEX_STRING *username, - MYSQL_CONST_LEX_STRING *password); + int (*validate_password)(const MYSQL_CONST_LEX_STRING *username, + const MYSQL_CONST_LEX_STRING *password); }; diff --git a/plugin/cracklib_password_check/cracklib_password_check.c b/plugin/cracklib_password_check/cracklib_password_check.c index 22d5eee21f2..d64ef990983 100644 --- a/plugin/cracklib_password_check/cracklib_password_check.c +++ b/plugin/cracklib_password_check/cracklib_password_check.c @@ -21,7 +21,8 @@ static char *dictionary; -static int crackme(MYSQL_CONST_LEX_STRING *username, MYSQL_CONST_LEX_STRING *password) +static int crackme(const MYSQL_CONST_LEX_STRING *username, + const MYSQL_CONST_LEX_STRING *password) { char *user= alloca(username->length + 1); char *host; diff --git a/plugin/simple_password_check/simple_password_check.c b/plugin/simple_password_check/simple_password_check.c index 5a76c3d3005..2d298f0efa9 100644 --- a/plugin/simple_password_check/simple_password_check.c +++ b/plugin/simple_password_check/simple_password_check.c @@ -22,8 +22,8 @@ static unsigned min_length, min_digits, min_letters, min_others; -static int validate(MYSQL_CONST_LEX_STRING *username, - MYSQL_CONST_LEX_STRING *password) +static int validate(const MYSQL_CONST_LEX_STRING *username, + const MYSQL_CONST_LEX_STRING *password) { unsigned digits=0 , uppers=0 , lowers=0, others=0, length= (unsigned)password->length; const char *ptr= password->str, *end= ptr + length;