MySQL 9.1.0
Source Code Documentation
validate_password_imp.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 2024, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License, version 2.0,
5as published by the Free Software Foundation.
6
7This program is designed to work with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation. The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have either included with
13the program or referenced in the documentation.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License, version 2.0, for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef VALIDATE_PASSWORD_IMP_H
25#define VALIDATE_PASSWORD_IMP_H
26
37
39extern REQUIRES_SERVICE_PLACEHOLDER(log_builtins);
40extern REQUIRES_SERVICE_PLACEHOLDER(log_builtins_string);
41extern REQUIRES_SERVICE_PLACEHOLDER(mysql_string_character_access);
42extern REQUIRES_SERVICE_PLACEHOLDER(mysql_string_factory);
43extern REQUIRES_SERVICE_PLACEHOLDER(mysql_string_case);
44extern REQUIRES_SERVICE_PLACEHOLDER(mysql_string_converter);
45extern REQUIRES_SERVICE_PLACEHOLDER(mysql_string_iterator);
46extern REQUIRES_SERVICE_PLACEHOLDER(mysql_string_ctype);
47extern REQUIRES_SERVICE_PLACEHOLDER(mysql_string_value);
48extern REQUIRES_SERVICE_PLACEHOLDER(component_sys_variable_register);
49extern REQUIRES_SERVICE_PLACEHOLDER(component_sys_variable_unregister);
50extern REQUIRES_SERVICE_PLACEHOLDER(status_variable_registration);
51extern REQUIRES_SERVICE_PLACEHOLDER(mysql_thd_security_context);
52extern REQUIRES_SERVICE_PLACEHOLDER(mysql_security_context_options);
53extern REQUIRES_SERVICE_PLACEHOLDER(psi_memory_v2);
56 mysql_service_registry_no_lock);
58 mysql_service_registration_no_lock);
59/**
60 An implementation of the password_validation_service to validate password and
61 to get its strength.
62*/
64 public:
65 /**
66 Validates the strength of given password.
67
68 @sa validate_password::validate()
69 */
70 static DEFINE_BOOL_METHOD(validate, (void *thd, my_h_string password));
71
72 /**
73 Gets the password strength between (0-100)
74
75 @sa validate_password::get_strength()
76 */
78 unsigned int *strength));
79};
80
82 public:
83 /**
84 Validate if number of changed characters matches the pre-configured
85 criteria
86
87 @param [in] current_password Current password
88 @param [in] new_password New password
89 @param [out] minimum_required Minimum required number of changed characters
90 @param [out] changed Actual number of changed characters
91
92 @returns Result of validation
93 @retval false Success
94 @retval true Error
95 */
96 static DEFINE_BOOL_METHOD(validate, (my_h_string current_password,
97 my_h_string new_password,
98 uint *minimum_required, uint *changed));
99};
100#endif /* VALIDATE_PASSWORD_IMP_H */
Definition: validate_password_imp.h:81
static mysql_service_status_t validate(my_h_string current_password, my_h_string new_password, uint *minimum_required, uint *changed) noexcept
Validate if number of changed characters matches the pre-configured criteria.
Definition: validate_password_imp.cc:619
An implementation of the password_validation_service to validate password and to get its strength.
Definition: validate_password_imp.h:63
static mysql_service_status_t get_strength(void *thd, my_h_string password, unsigned int *strength) noexcept
Gets the password strength between (0-100)
Definition: validate_password_imp.cc:534
static mysql_service_status_t validate(void *thd, my_h_string password) noexcept
Validates the strength of given password.
Definition: validate_password_imp.cc:591
Specifies macros to define Components.
static char * password
Definition: mysql_secure_installation.cc:58
const mysql_service_registry_registration_t * registry_registration
Specifies macros to define Service Implementations.
#define DEFINE_BOOL_METHOD(name, args)
A short macro to define method that returns bool, which is the most common case.
Definition: service_implementation.h:88
Definition: mysql_string_service.cc:60
REQUIRES_SERVICE_PLACEHOLDER_AS(registry, mysql_service_registry_no_lock)
REQUIRES_SERVICE_PLACEHOLDER(registry)