MySQL  8.0.16
Source Code Documentation
migrate_keyring.h
Go to the documentation of this file.
1 /* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
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, version 2.0,
5  as published by the Free Software Foundation.
6 
7  This program is also distributed with certain software (including
8  but not limited to OpenSSL) that is licensed under separate terms,
9  as designated in a particular file or component or in included license
10  documentation. The authors of MySQL hereby grant you an additional
11  permission to link the program and your derivative works with the
12  separately licensed software that they have included with MySQL.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License, version 2.0, for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef MIGRATE_KEYRING_H_INCLUDED
24 #define MIGRATE_KEYRING_H_INCLUDED
25 
26 #include <string>
27 #include "mysql.h"
28 #include "mysql/plugin_keyring.h"
29 
30 class THD;
31 
32 #define MAX_KEY_LEN 16384
33 
35 
36 class Key_info {
37  public:
38  Key_info() {}
39  Key_info(char *key_id, char *user_id) {
40  m_key_id = key_id;
41  m_user_id = user_id;
42  }
43  Key_info(const Key_info &ki) {
44  this->m_key_id = ki.m_key_id;
45  this->m_user_id = ki.m_user_id;
46  }
47 
48  public:
49  std::string m_key_id;
50  std::string m_user_id;
51 };
52 
54  public:
55  /**
56  Standard constructor.
57  */
59  /**
60  Initialize all needed parameters to proceed with migration process.
61  */
62  bool init(int argc, char **argv, char *source_plugin,
63  char *destination_plugin, char *user, char *host, char *password,
64  char *socket, ulong port);
65  /**
66  Migrate keys from source keyring to destination keyring.
67  */
68  bool execute();
69  /**
70  Standard destructor
71  */
73 
74  private:
75  /**
76  Load source or destination plugin.
77  */
78  bool load_plugin(enum_plugin_type plugin_type);
79  /**
80  Fetch keys from source plugin and store in destination plugin.
81  */
82  bool fetch_and_store_keys();
83  /**
84  Disable @@keyring_operations variable.
85  */
87  /**
88  Enable @@keyring_operations variable.
89  */
91 
92  private:
93  int m_argc;
94  char **m_argv;
97  std::string m_source_plugin_name;
99  std::string m_internal_option;
102  std::vector<Key_info> m_source_keys;
104 };
105 
106 #endif /* MIGRATE_KEYRING_H_INCLUDED */
int m_argc
Definition: migrate_keyring.h:93
get_options & argc
Definition: do_ctype.cc:51
Key_info(char *key_id, char *user_id)
Definition: migrate_keyring.h:39
Key_info()
Definition: migrate_keyring.h:38
std::string m_internal_option
Definition: migrate_keyring.h:99
Definition: migrate_keyring.h:53
Key_info(const Key_info &ki)
Definition: migrate_keyring.h:43
std::string m_key_id
Definition: migrate_keyring.h:49
Definition: migrate_keyring.h:36
This file defines the client API to MySQL and also the ABI of the dynamically linked libmysqlclient...
char * host
Definition: mysqladmin.cc:57
~Migrate_keyring()
Standard destructor.
Definition: migrate_keyring.cc:384
MYSQL * mysql
Definition: migrate_keyring.h:103
bool load_plugin(enum_plugin_type plugin_type)
Load source or destination plugin.
Definition: migrate_keyring.cc:222
static in_port_t port
Definition: testapp.c:33
std::string m_source_plugin_name
Definition: migrate_keyring.h:97
bool fetch_and_store_keys()
Fetch keys from source plugin and store in destination plugin.
Definition: migrate_keyring.cc:280
char * user
Definition: mysqladmin.cc:57
char * argv[]
Definition: example1.cc:2
bool enable_keyring_operations()
Enable @keyring_operations variable.
Definition: migrate_keyring.cc:370
bool init(int argc, char **argv, char *source_plugin, char *destination_plugin, char *user, char *host, char *password, char *socket, ulong port)
Initialize all needed parameters to proceed with migration process.
Definition: migrate_keyring.cc:59
Migrate_keyring()
Standard constructor.
Definition: migrate_keyring.cc:33
st_mysql_keyring * m_source_plugin_handle
Definition: migrate_keyring.h:100
The descriptor structure for the plugin, that is referred from st_mysql_plugin.
Definition: plugin_keyring.h:38
char ** m_argv
Definition: migrate_keyring.h:94
std::string m_user_id
Definition: migrate_keyring.h:50
std::string m_destination_plugin_name
Definition: migrate_keyring.h:98
enum_plugin_type
Definition: migrate_keyring.h:34
st_mysql_keyring * m_destination_plugin_handle
Definition: migrate_keyring.h:101
std::string m_source_plugin_option
Definition: migrate_keyring.h:95
static char * password
Definition: mysql_secure_installation.cc:55
std::string m_destination_plugin_option
Definition: migrate_keyring.h:96
Definition: mysql.h:294
std::vector< Key_info > m_source_keys
Definition: migrate_keyring.h:102
bool execute()
Migrate keys from source keyring to destination keyring.
Definition: migrate_keyring.cc:158
unsigned long ulong
Definition: my_inttypes.h:46
bool disable_keyring_operations()
Disable @keyring_operations variable.
Definition: migrate_keyring.cc:353
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_class.h:776