1 /* Copyright (C) 2013 Sergei Golubchik and Monty Program Ab
2 
3    This program is free software; you can redistribute it and/or modify
4    it under the terms of the GNU General Public License as published by
5    the Free Software Foundation; version 2 of the License.
6 
7    This program is distributed in the hope that it will be useful,
8    but WITHOUT ANY WARRANTY; without even the implied warranty of
9    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10    GNU General Public License for more details.
11 
12    You should have received a copy of the GNU General Public License
13    along with this program; if not, write to the Free Software
14    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335  USA */
15 
16 /* old plugin api structures, used for backward compatibility */
17 
18 #define upgrade_var(X) latest->X= X
19 #define upgrade_str(X) strmake_buf(latest->X, X)
20 #define downgrade_var(X) X= latest->X
21 #define downgrade_str(X) strmake_buf(X, latest->X)
22 
23 /**************************************************************/
24 /* Authentication API, version 0x0100 *************************/
25 #define MIN_AUTHENTICATION_INTERFACE_VERSION 0x0100
26 
27 struct MYSQL_SERVER_AUTH_INFO_0x0100 {
28   const char *user_name;
29   unsigned int user_name_length;
30   const char *auth_string;
31   unsigned long auth_string_length;
32   char authenticated_as[49];
33   char external_user[512];
34   int  password_used;
35   const char *host_or_ip;
36   unsigned int host_or_ip_length;
37 
38   void upgrade(MYSQL_SERVER_AUTH_INFO *latest)
39   {
40     upgrade_var(user_name);
41     upgrade_var(user_name_length);
42     upgrade_var(auth_string);
43     upgrade_var(auth_string_length);
44     upgrade_str(authenticated_as);
45     upgrade_str(external_user);
46     upgrade_var(password_used);
47     upgrade_var(host_or_ip);
48     upgrade_var(host_or_ip_length);
49   }
50   void downgrade(MYSQL_SERVER_AUTH_INFO *latest)
51   {
52     downgrade_var(user_name);
53     downgrade_var(user_name_length);
54     downgrade_var(auth_string);
55     downgrade_var(auth_string_length);
56     downgrade_str(authenticated_as);
57     downgrade_str(external_user);
58     downgrade_var(password_used);
59     downgrade_var(host_or_ip);
60     downgrade_var(host_or_ip_length);
61   }
62 };
63 
64 /**************************************************************/
65 
66