MySQL 8.0.39
Source Code Documentation
plugin_auth_common.h File Reference

This file defines constants and data structures that are the same for both client- and server-side authentication plugins. More...

Go to the source code of this file.

Classes

struct  MYSQL_PLUGIN_VIO_INFO
 
struct  MYSQL_PLUGIN_VIO
 Provides plugin access to communication channel. More...
 

Macros

#define MYSQL_PLUGIN_AUTH_COMMON_INCLUDED
 
#define MYSQL_USERNAME_LENGTH   96
 the max allowed length for a user name More...
 
#define CR_AUTH_PLUGIN_ERROR   3
 return values of the plugin authenticate_user() method. More...
 
#define CR_AUTH_HANDSHAKE   2
 Authentication failed, client server handshake. More...
 
#define CR_AUTH_USER_CREDENTIALS   1
 Authentication failed, user credentials. More...
 
#define CR_ERROR   0
 Authentication failed. More...
 
#define CR_OK   -1
 Authentication (client part) was successful. More...
 
#define CR_OK_HANDSHAKE_COMPLETE   -2
 Authentication was successful. More...
 
#define CR_OK_AUTH_IN_SANDBOX_MODE   -3
 Authentication was successful with limited operations. More...
 
#define PROXY_FLAG   0
 Flag to be passed back to server from authentication plugins via authenticated_as when proxy mapping should be done by the server. More...
 

Typedefs

typedef struct MYSQL_PLUGIN_VIO MYSQL_PLUGIN_VIO
 Provides plugin access to communication channel. More...
 

Enumerations

enum  net_async_status { NET_ASYNC_COMPLETE = 0 , NET_ASYNC_NOT_READY , NET_ASYNC_ERROR , NET_ASYNC_COMPLETE_NO_MORE_RESULTS }
 

Detailed Description

This file defines constants and data structures that are the same for both client- and server-side authentication plugins.

Macro Definition Documentation

◆ CR_AUTH_HANDSHAKE

#define CR_AUTH_HANDSHAKE   2

Authentication failed, client server handshake.

An error occurred during the client server handshake. These errors are reported in table performance_schema.host_cache, column COUNT_HANDSHAKE_ERRORS.

◆ CR_AUTH_PLUGIN_ERROR

#define CR_AUTH_PLUGIN_ERROR   3

return values of the plugin authenticate_user() method.

Authentication failed, plugin internal error. An error occurred in the authentication plugin itself. These errors are reported in table performance_schema.host_cache, column COUNT_AUTH_PLUGIN_ERRORS.

◆ CR_AUTH_USER_CREDENTIALS

#define CR_AUTH_USER_CREDENTIALS   1

Authentication failed, user credentials.

For example, wrong passwords. These errors are reported in table performance_schema.host_cache, column COUNT_AUTHENTICATION_ERRORS.

◆ CR_ERROR

#define CR_ERROR   0

Authentication failed.

Additionally, all other CR_xxx values (libmysql error code) can be used too.

The client plugin may set the error code and the error message directly in the MYSQL structure and return CR_ERROR. If a CR_xxx specific error code was returned, an error message in the MYSQL structure will be overwritten. If CR_ERROR is returned without setting the error in MYSQL, CR_UNKNOWN_ERROR will be user.

◆ CR_OK

#define CR_OK   -1

Authentication (client part) was successful.

It does not mean that the authentication as a whole was successful, usually it only means that the client was able to send the user name and the password to the server. If CR_OK is returned, the libmysql reads the next packet expecting it to be one of OK, ERROR, or CHANGE_PLUGIN packets.

◆ CR_OK_AUTH_IN_SANDBOX_MODE

#define CR_OK_AUTH_IN_SANDBOX_MODE   -3

Authentication was successful with limited operations.

It means that the both client and server side plugins decided to allow authentication with very limited operations ALTER USER to do registration.

◆ CR_OK_HANDSHAKE_COMPLETE

#define CR_OK_HANDSHAKE_COMPLETE   -2

Authentication was successful.

It means that the client has done its part successfully and also that a plugin has read the last packet (one of OK, ERROR, CHANGE_PLUGIN). In this case, libmysql will not read a packet from the server, but it will use the data at mysql->net.read_pos.

A plugin may return this value if the number of roundtrips in the authentication protocol is not known in advance, and the client plugin needs to read one packet more to determine if the authentication is finished or not.

◆ MYSQL_PLUGIN_AUTH_COMMON_INCLUDED

#define MYSQL_PLUGIN_AUTH_COMMON_INCLUDED

◆ MYSQL_USERNAME_LENGTH

#define MYSQL_USERNAME_LENGTH   96

the max allowed length for a user name

◆ PROXY_FLAG

#define PROXY_FLAG   0

Flag to be passed back to server from authentication plugins via authenticated_as when proxy mapping should be done by the server.

Typedef Documentation

◆ MYSQL_PLUGIN_VIO

Provides plugin access to communication channel.

Enumeration Type Documentation

◆ net_async_status

Enumerator
NET_ASYNC_COMPLETE 
NET_ASYNC_NOT_READY 
NET_ASYNC_ERROR 
NET_ASYNC_COMPLETE_NO_MORE_RESULTS