| 91 | |
| 92 | |
| 93 | void 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 |
no test coverage detected