MySQL 8.4.2
Source Code Documentation
s_mysql_validate_password_changed_characters Struct Reference

Service to enforce that new password contains N different characters compared to existing password. More...

#include <validate_password.h>

Public Attributes

mysql_service_status_t(* validate )(my_h_string current_password, my_h_string new_password, uint *minimum_required, uint *changed)
 Validate if number of changed characters matches the pre-configured criteria. More...
 

Detailed Description

Service to enforce that new password contains N different characters compared to existing password.

REQUIRES_SERVICE(validate_password_changed_characters)
bool compare_passwords(const char *current_password,
unsigned int current_password_length,
const char * new_oassword,
unsigned int new_password_length) {
String current_password_string, new_password_string;
current_password_string.assign(current_password, current_password_length,
new_password_string.assign(new_password, new_password_length,
unsigned int min_required = 0, changed = 0;
if (mysql_service_validate_password_changed_characters->validate(
current_password_string, new_password_string,
&min_required, &changed)) {
// Raise error that min_required characters should be changed
return true;
}
return false;
}
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:167
#define REQUIRES_SERVICE(service)
Adds a Service requirement with a pointer to placeholder to the list of components.
Definition: component_implementation.h:305
MYSQL_STRINGS_EXPORT CHARSET_INFO my_charset_utf8mb3_bin
Definition: ctype-utf8.cc:5899

Member Data Documentation

◆ validate

mysql_service_status_t(* s_mysql_validate_password_changed_characters::validate) (my_h_string current_password, my_h_string new_password, uint *minimum_required, uint *changed)

Validate if number of changed characters matches the pre-configured criteria.

Parameters
[in]current_passwordCurrent password
[in]new_passwordNew password
[out]minimum_requiredMinimum required number of changed characters
[out]changedActual number of changed characters
Returns
Result of validation
Return values
falseSuccess
trueError

The documentation for this struct was generated from the following file: