MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dialog.c File Reference
#include <my_global.h>
#include <mysql.h>
#include <mysql/plugin_auth.h>
#include <mysql/client_plugin.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
Include dependency graph for dialog.c:

Go to the source code of this file.

Macros

#define _GNU_SOURCE   /* for RTLD_DEFAULT */
#define ORDINARY_QUESTION   "\2"
#define LAST_QUESTION   "\3"
#define PASSWORD_QUESTION   "\4"
#define LAST_PASSWORD   "\5"

Typedefs

typedef char *(* mysql_authentication_dialog_ask_t )(struct st_mysql *mysql, int type, const char *prompt, char *buf, int buf_len)

Functions

 mysql_declare_plugin (dialog)
 mysql_declare_client_plugin (AUTHENTICATION)

Variables

 MYSQL_AUTHENTICATION_PLUGIN
 three_attempts
Sergei Golubchik
Sergei Dialog plugin demo
Sergei Dialog plugin PLUGIN_LICENSE_GPL
Sergei Dialog plugin NULL
Sergei Dialog plugin mysql_declare_plugin_end
 GPL
 init_dialog
perform_dialog mysql_end_client_plugin

Detailed Description

dialog client authentication plugin with examples

dialog is a general purpose client authentication plugin, it simply asks the user the question, as provided by the server and reports the answer back to the server. No encryption is involved, the answers are sent in clear text.

Two examples are provided: two_questions server plugin, that asks the password and an "Are you sure?" question with a reply "yes, of course". It demonstrates the usage of "password" (input is hidden) and "ordinary" (input can be echoed) questions, and how to mark the last question, to avoid an extra roundtrip.

And three_attempts plugin that gives the user three attempts to enter a correct password. It shows the situation when a number of questions is not known in advance.

Definition in file dialog.c.

Macro Definition Documentation

#define ORDINARY_QUESTION   "\2"

first byte of the question string is the question "type". It can be an "ordinary" or a "password" question. The last bit set marks a last question in the authentication exchange.

Definition at line 58 of file dialog.c.

Typedef Documentation

typedef char*(* mysql_authentication_dialog_ask_t)(struct st_mysql *mysql, int type, const char *prompt, char *buf, int buf_len)

type of the mysql_authentication_dialog_ask function

Parameters
mysqlmysql
typetype of the input 1 - ordinary string input 2 - password string
promptprompt
bufa buffer to store the use input
buf_lenthe length of the buffer
Return values
apointer to the user input string. It may be equal to 'buf' or to 'mysql->password'. In all other cases it is assumed to be an allocated string, and the "dialog" plugin will free() it.

Definition at line 205 of file dialog.c.