-
Notifications
You must be signed in to change notification settings - Fork 0
fix: Re-enable SQLite3DB::LoadPlugin() with allow_load_plugin flag #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The condition if (plugin_name) { |
||
| int fd = -1; | ||
| fd = ::open(plugin_name, O_RDONLY); | ||
| char binary_sha1_sqlite3[SHA_DIGEST_LENGTH*2+1]; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoding
allow_load_plugintofalsedirectly within theLoadPluginfunction makes it impossible to enable dynamic plugin loading without recompiling the application. For better flexibility and maintainability, this flag should be a configurable global variable (e.g., withinGloVars) that can be managed externally, such as through a configuration file or command-line argument. This would allow for easier future enablement or testing of dynamic plugins.