MySQL 8.4.2
Source Code Documentation
qa_auth_interface.cc File Reference
#include <mysql/client_plugin.h>
#include <mysql/plugin_auth.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mysql.h>
#include "my_compiler.h"

Macros

#define ORDINARY_QUESTION   "\2"
 first byte of the question string is the question "type". More...
 
#define LAST_QUESTION   "\3"
 
#define LAST_PASSWORD   "\4"
 
#define PASSWORD_QUESTION   "\5"
 

Functions

static int qa_auth_interface (MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
 
static int generate_auth_string_hash (char *outbuf, unsigned int *buflen, const char *inbuf, unsigned int inbuflen)
 
static int validate_auth_string_hash (char *const inbuf, unsigned int buflen)
 
static int set_salt (const char *password, unsigned int password_len, unsigned char *salt, unsigned char *salt_len)
 
 mysql_declare_plugin (test_plugin)
 
static int test_plugin_client (MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
 The main function of the test plugin. More...
 
 mysql_declare_client_plugin (AUTHENTICATION) "qa_auth_interface"
 

Variables

static struct st_mysql_auth qa_auth_test_handler
 
 mysql_declare_plugin_end
 
 MYSQL_CLIENT_PLUGIN_AUTHOR_ORACLE
 
Dialog Client Authentication Plugin
 
Dialog Client Authentication GPL
 
Dialog Client Authentication nullptr
 
Dialog Client Authentication test_plugin_client
 
Dialog Client Authentication mysql_end_client_plugin
 

Macro Definition Documentation

◆ LAST_PASSWORD

#define LAST_PASSWORD   "\4"

◆ LAST_QUESTION

#define LAST_QUESTION   "\3"

◆ ORDINARY_QUESTION

#define ORDINARY_QUESTION   "\2"

first byte of the question string is the question "type".

It can be a "ordinary" or a "password" question. The last bit set marks a last question in the authentication exchange.

◆ PASSWORD_QUESTION

#define PASSWORD_QUESTION   "\5"

Function Documentation

◆ generate_auth_string_hash()

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

◆ mysql_declare_client_plugin()

mysql_declare_client_plugin ( AUTHENTICATION  )

◆ mysql_declare_plugin()

mysql_declare_plugin ( test_plugin  )

◆ qa_auth_interface()

static int qa_auth_interface ( MYSQL_PLUGIN_VIO vio,
MYSQL_SERVER_AUTH_INFO info 
)
static

◆ set_salt()

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

◆ test_plugin_client()

static int test_plugin_client ( MYSQL_PLUGIN_VIO vio,
MYSQL mysql 
)
static

The main function of the test plugin.

Reads the prompt, check if the handshake is done and if the prompt is a password request and returns the password. Otherwise return error.

Note
  1. this plugin shows how a client authentication plugin may read a MySQL protocol OK packet internally - which is important where a number of packets is not known in advance.
  2. the first byte of the prompt is special. it is not shown to the user, but signals whether it is the last question (prompt[0] & 1 == 1) or not last (prompt[0] & 1 == 0), and whether the input is a password (not echoed).
  3. the prompt is expected to be sent zero-terminated

◆ validate_auth_string_hash()

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

Variable Documentation

◆ GPL

Dialog Client Authentication GPL

◆ MYSQL_CLIENT_PLUGIN_AUTHOR_ORACLE

MYSQL_CLIENT_PLUGIN_AUTHOR_ORACLE

◆ mysql_declare_plugin_end

mysql_declare_plugin_end

◆ mysql_end_client_plugin

Dialog Client Authentication mysql_end_client_plugin

◆ nullptr

Dialog Client Authentication nullptr

◆ Plugin

Dialog Client Authentication Plugin

◆ qa_auth_test_handler

struct st_mysql_auth qa_auth_test_handler
static
Initial value:
= {
"qa_auth_interface",
nullptr}
#define AUTH_FLAG_PRIVILEGED_USER_FOR_PASSWORD_CHANGE
Definition: plugin_auth.h:49
#define MYSQL_AUTHENTICATION_INTERFACE_VERSION
Definition: plugin_auth.h:37
static int validate_auth_string_hash(char *const inbuf, unsigned int buflen)
Definition: qa_auth_interface.cc:157
static int qa_auth_interface(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info)
Definition: qa_auth_interface.cc:42
static int set_salt(const char *password, unsigned int password_len, unsigned char *salt, unsigned char *salt_len)
Definition: qa_auth_interface.cc:162
static int generate_auth_string_hash(char *outbuf, unsigned int *buflen, const char *inbuf, unsigned int inbuflen)
Definition: qa_auth_interface.cc:145

◆ test_plugin_client

Dialog Client Authentication test_plugin_client