Skip to content

Commit

Permalink
cleanup: add 'const' to password validation API
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Oct 31, 2018
1 parent 1cc03e1 commit 0e388d4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions include/mysql/plugin_password_validation.h
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions include/mysql/plugin_password_validation.h.pp
Expand Up @@ -531,6 +531,6 @@
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);
};
3 changes: 2 additions & 1 deletion plugin/cracklib_password_check/cracklib_password_check.c
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions plugin/simple_password_check/simple_password_check.c
Expand Up @@ -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;
Expand Down

0 comments on commit 0e388d4

Please sign in to comment.