MXS-862: Add create/destroy and remove plugin_name entry points

The create and destroy entry points allow authenticators to store data in
the DCB. This data is not shared by other DCBs related to the same
session.

The plugin_name entry point wasn't really useful as the plugins would
still need to send a AuthSwitchRequest packet if they wanted to change the
authentication mechanism.
This commit is contained in:
Markus Makela
2016-10-04 12:06:52 +03:00
parent 829d5a7453
commit dfeb5c46c9
15 changed files with 155 additions and 89 deletions

View File

@ -252,8 +252,8 @@ typedef struct dcb
struct dcb *nextpersistent; /**< Next DCB in the persistent pool for SERVER */
time_t persistentstart; /**< Time when DCB placed in persistent pool */
struct service *service; /**< The related service */
void *data; /**< Specific client data */
void *backend_data; /**< Specific backend data */
void *data; /**< Specific client data, shared between DCBs of this session */
void *authenticator_data; /**< The authenticator data for this DCB */
DCBMM memdata; /**< The data related to DCB memory management */
SPINLOCK cb_lock; /**< The lock for the callbacks linked list */
DCB_CALLBACK *callbacks; /**< The list of callbacks for the DCB */
@ -284,7 +284,7 @@ typedef struct dcb
.cb_lock = SPINLOCK_INIT, .pollinlock = SPINLOCK_INIT, \
.fd = DCBFD_CLOSED, .stats = DCBSTATS_INIT, .ssl_state = SSL_HANDSHAKE_UNKNOWN, \
.state = DCB_STATE_ALLOC, .polloutlock = SPINLOCK_INIT, .dcb_chk_tail = CHK_NUM_DCB, \
.backend_data = NULL}
.authenticator_data = NULL}
/**
* The DCB usage filer used for returning DCB's in use for a certain reason

View File

@ -42,12 +42,14 @@ struct servlistener;
* @verbatim
* The operations that can be performed on the descriptor
*
* create Create a data structure unique to this DCB, stored in dcb->authenticator_data
* extract Extract the data from a buffer and place in a structure
* shared at the session level, stored in dcb->data
* connectssl Determine whether the connection can support SSL
* authenticate Carry out the authentication
* free Free extracted data
* destroy Destroy the unique DCB data
* loadusers Load or update authenticator user data
* plugin_name The protocol specific name of the authentication plugin.
* @endverbatim
*
* This forms the "module object" for authenticator modules within the gateway.
@ -56,12 +58,13 @@ struct servlistener;
*/
typedef struct gw_authenticator
{
void *(*create)();
int (*extract)(struct dcb *, GWBUF *);
bool (*connectssl)(struct dcb *);
int (*authenticate)(struct dcb *);
void (*free)(struct dcb *);
void (*destroy)(void *);
int (*loadusers)(struct servlistener *);
const char* plugin_name;
} GWAUTHENTICATOR;
/** Return values for extract and authenticate entry points */