Merge pull request #28 from ProxySQL/v3.1-vec-loadplugin-fix

fix: Re-enable SQLite3DB::LoadPlugin() with allow_load_plugin flag
pull/5312/head
René Cannaò 3 months ago committed by GitHub
commit 19d29a7346
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1065,14 +1065,15 @@ SQLite3_result::SQLite3_result() {
/**
* @brief Loads a SQLite3 plugin.
*
*
* This function loads a SQLite3 plugin specified by the given plugin_name.
* It initializes function pointers to SQLite3 API functions provided by the plugin.
* If the plugin_name is NULL, it loads the built-in SQLite3 library and initializes function pointers to its API functions.
*
*
* @param[in] plugin_name The name of the SQLite3 plugin library to load.
*/
void SQLite3DB::LoadPlugin(const char *plugin_name) {
const bool allow_load_plugin = false; // TODO: Revisit plugin loading safety mechanism
proxy_sqlite3_config = NULL;
proxy_sqlite3_bind_double = NULL;
proxy_sqlite3_bind_int = NULL;
@ -1109,7 +1110,7 @@ void SQLite3DB::LoadPlugin(const char *plugin_name) {
proxy_sqlite3_prepare_v2 = NULL;
proxy_sqlite3_open_v2 = NULL;
proxy_sqlite3_exec = NULL;
if (plugin_name) {
if (plugin_name && allow_load_plugin == true) {
int fd = -1;
fd = ::open(plugin_name, O_RDONLY);
char binary_sha1_sqlite3[SHA_DIGEST_LENGTH*2+1];

@ -1381,20 +1381,7 @@ void ProxySQL_Main_init() {
static void LoadPlugins() {
GloMyLdapAuth = NULL;
if (proxy_sqlite3_open_v2 == nullptr) {
if (GloVars.sqlite3_plugin) {
proxy_warning("SQLite3 plugin loading disabled: function replacement is temporarily disabled for plugin: %s\n", GloVars.sqlite3_plugin);
} else {
proxy_warning("SQLite3 plugin function replacement is disabled; no sqlite3 plugin specified\n");
}
/*
* Temporarily disabled: do not replace proxy_sqlite3_* symbols from plugins because
* this can change core sqlite3 behavior unexpectedly. The original call is kept
* here for reference and to make re-enabling trivial in the future.
* TODO: Revisit plugin function replacement and implement a safer mechanism
* for plugin-provided sqlite3 capabilities (create a ticket/PR and reference it here).
*/
// SQLite3DB::LoadPlugin(GloVars.sqlite3_plugin);
SQLite3DB::LoadPlugin(GloVars.sqlite3_plugin);
}
if (GloVars.web_interface_plugin) {
dlerror();

Loading…
Cancel
Save