MySQL 8.4.0
Source Code Documentation
mysql_native_password.cc File Reference

Macros

#define LOG_COMPONENT_TAG   "mysql_native_password"
 

Functions

static void native_password_authentication_deprecation_warning ()
 
static int generate_native_password (char *outbuf, unsigned int *buflen, const char *inbuf, unsigned int inbuflen)
 
static int validate_native_password_hash (char *const inbuf, unsigned int buflen)
 
static int set_native_salt (const char *password, unsigned int password_len, unsigned char *salt, unsigned char *salt_len)
 
static int compare_native_password_with_hash (const char *hash, unsigned long hash_length, const char *cleartext, unsigned long cleartext_length, int *is_error)
 Compare a clear text password with a stored hash for the native password plugin. More...
 
static int native_password_authenticate (MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
 MySQL Server Password Authentication Plugin. More...
 
 mysql_declare_plugin (mysql_native_password)
 

Variables

static struct st_mysql_auth native_password_handler
 
 mysql_declare_plugin_end
 

Macro Definition Documentation

◆ LOG_COMPONENT_TAG

#define LOG_COMPONENT_TAG   "mysql_native_password"

Function Documentation

◆ compare_native_password_with_hash()

static int compare_native_password_with_hash ( const char *  hash,
unsigned long  hash_length,
const char *  cleartext,
unsigned long  cleartext_length,
int *  is_error 
)
static

Compare a clear text password with a stored hash for the native password plugin.

If the password is non-empty it calculates a hash from the cleartext and compares it with the supplied hash.

if the password is empty checks if the hash is empty too.

  • hash pointer to the hashed data
  • hash_length length of the hashed data
  • cleartext pointer to the clear text password
  • cleartext_length length of the cleat text password
  • [out] is_error non-zero in case of error extracting the salt
    Return values
    0the hash was created with that password
    non-zerothe hash was created with a different password

empty password results in an empty hash

◆ generate_native_password()

static int generate_native_password ( char *  outbuf,
unsigned int *  buflen,
const char *  inbuf,
unsigned int  inbuflen 
)
static

◆ mysql_declare_plugin()

mysql_declare_plugin ( mysql_native_password  )

◆ native_password_authenticate()

static int native_password_authenticate ( MYSQL_PLUGIN_VIO vio,
MYSQL_SERVER_AUTH_INFO info 
)
static

MySQL Server Password Authentication Plugin.

In the MySQL authentication protocol:

  1. the server sends the random scramble to the client
  2. client sends the encrypted password back to the server
  3. the server checks the password.

◆ native_password_authentication_deprecation_warning()

static void native_password_authentication_deprecation_warning ( )
static

◆ set_native_salt()

static int set_native_salt ( const char *  password,
unsigned int  password_len,
unsigned char *  salt,
unsigned char *  salt_len 
)
static

◆ validate_native_password_hash()

static int validate_native_password_hash ( char *const  inbuf,
unsigned int  buflen 
)
static

Variable Documentation

◆ mysql_declare_plugin_end

mysql_declare_plugin_end

◆ native_password_handler

struct st_mysql_auth native_password_handler
static
Initial value:
= {
}
static const char * get_plugin_name(cached_plugins_enum plugin_index)
Get name of the plugin at given index.
Definition: sql_authentication.h:212
static int generate_native_password(char *outbuf, unsigned int *buflen, const char *inbuf, unsigned int inbuflen)
Definition: mysql_native_password.cc:99
static int validate_native_password_hash(char *const inbuf, unsigned int buflen)
Definition: mysql_native_password.cc:131
static int native_password_authenticate(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
MySQL Server Password Authentication Plugin.
Definition: mysql_native_password.cc:202
static int compare_native_password_with_hash(const char *hash, unsigned long hash_length, const char *cleartext, unsigned long cleartext_length, int *is_error)
Compare a clear text password with a stored hash for the native password plugin.
Definition: mysql_native_password.cc:171
static int set_native_salt(const char *password, unsigned int password_len, unsigned char *salt, unsigned char *salt_len)
Definition: mysql_native_password.cc:140
#define AUTH_FLAG_USES_INTERNAL_STORAGE
Definition: plugin_auth.h:50
#define MYSQL_AUTHENTICATION_INTERFACE_VERSION
Definition: plugin_auth.h:37
@ PLUGIN_MYSQL_NATIVE_PASSWORD
Definition: sql_authentication.h:161