MCPcopy Create free account
hub / github.com/MariaDB/server / encryption_plugin_backup_init

Function encryption_plugin_backup_init

extra/mariabackup/encryption_plugin.cc:93–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91
92
93void encryption_plugin_backup_init(MYSQL *mysql)
94{
95 MYSQL_RES *result;
96 MYSQL_ROW row;
97 std::ostringstream oss;
98 char *argv[PLUGIN_MAX_ARGS];
99 char show_query[1024] = "";
100 std::string plugin_load;
101 int argc;
102
103 result = xb_mysql_query(mysql, QUERY_PLUGIN, true, true);
104 while ((row = mysql_fetch_row(result)))
105 {
106 char *name= row[0];
107 char *library= row[1];
108 char *dir= row[2];
109
110 if (!plugin_load.length())
111 {
112#ifdef _WIN32
113 for (char *p = dir; *p; p++)
114 if (*p == '\\') *p = '/';
115#endif
116 strncpy(opt_plugin_dir, dir, FN_REFLEN - 1);
117 opt_plugin_dir[FN_REFLEN - 1] = '\0';
118 oss << "plugin_dir=" << '"' << dir << '"' << std::endl;
119 }
120
121 plugin_load += std::string(";") + name;
122
123 if (library)
124 {
125 /* Remove shared library suffixes, in case we'll prepare on different OS.*/
126 const char *extensions[] = { ".dll", ".so", 0 };
127 for (size_t i = 0; extensions[i]; i++)
128 {
129 const char *ext = extensions[i];
130 if (ends_with(library, ext))
131 library[strlen(library) - strlen(ext)] = 0;
132 }
133 plugin_load += std::string("=") + library;
134 }
135
136 if (strncmp(name, "provider_", 9) == 0)
137 continue;
138
139 /* Read plugin variables. */
140 snprintf(show_query, sizeof(show_query), "SHOW variables like '%s_%%'", name);
141 }
142 mysql_free_result(result);
143 if (!plugin_load.length())
144 {
145 initialize_default_encryption();
146 return;
147 }
148
149 oss << "plugin_load=" << plugin_load.c_str() + 1 << std::endl;
150

Callers 1

xtrabackup_backup_funcFunction · 0.85

Calls 13

xb_mysql_queryFunction · 0.85
mysql_fetch_rowFunction · 0.85
stringClass · 0.85
ends_withFunction · 0.85
mysql_free_resultFunction · 0.85
add_to_plugin_load_listFunction · 0.85
encryption_plugin_initFunction · 0.85
lengthMethod · 0.45
c_strMethod · 0.45
push_backMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected