MySQL 9.0.0
Source Code Documentation
qa_auth_client.cc File Reference
#include <mysql/client_plugin.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 test_plugin_client (MYSQL_PLUGIN_VIO *vio, MYSQL *mysql)
 The main function of the test plugin. More...
 
 mysql_declare_client_plugin (AUTHENTICATION) "qa_auth_client"
 

Variables

 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

◆ mysql_declare_client_plugin()

mysql_declare_client_plugin ( AUTHENTICATION  )

◆ 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

Variable Documentation

◆ GPL

Dialog Client Authentication GPL

◆ MYSQL_CLIENT_PLUGIN_AUTHOR_ORACLE

MYSQL_CLIENT_PLUGIN_AUTHOR_ORACLE

◆ mysql_end_client_plugin

Dialog Client Authentication mysql_end_client_plugin

◆ nullptr

Dialog Client Authentication nullptr

◆ Plugin

Dialog Client Authentication Plugin

◆ test_plugin_client

Dialog Client Authentication test_plugin_client