diff options
| author | Eli Zaretskii | 2023-05-23 14:30:31 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2023-05-23 14:30:31 +0300 |
| commit | a347b26cba2124496b1fa5adb75f43c8a05842a6 (patch) | |
| tree | 11d17c5a564603ffd86bff62fb569eb84a024c8c /src/sqlite.c | |
| parent | fe22bf503fb724816a6c629e2e6d21c1edf8b5f7 (diff) | |
| download | emacs-a347b26cba2124496b1fa5adb75f43c8a05842a6.tar.gz emacs-a347b26cba2124496b1fa5adb75f43c8a05842a6.zip | |
Disable loading SQLite3 extensions when SQLite3 version is too old
* src/sqlite.c (HAVE_LOAD_EXTENSION): Define to 1 only if
enabling/disabling extension loading is supported as well.
(load_dll_functions, Fsqlite_load_extension): Condition on
HAVE_LOAD_EXTENSION, not on HAVE_SQLITE3_LOAD_EXTENSION.
(Bug#63653)
Diffstat (limited to 'src/sqlite.c')
| -rw-r--r-- | src/sqlite.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/sqlite.c b/src/sqlite.c index 77ce61ba657..852e3746ef4 100644 --- a/src/sqlite.c +++ b/src/sqlite.c | |||
| @@ -32,6 +32,17 @@ YOSHIDA <syohex@gmail.com>, which can be found at: | |||
| 32 | 32 | ||
| 33 | #include <sqlite3.h> | 33 | #include <sqlite3.h> |
| 34 | 34 | ||
| 35 | /* Support for loading SQLite extensions requires the ability to | ||
| 36 | enable and disable loading of extensions (by default this is | ||
| 37 | disabled, and we want to keep it that way). The required macro is | ||
| 38 | available since SQLite 3.13. */ | ||
| 39 | # if defined HAVE_SQLITE3_LOAD_EXTENSION && \ | ||
| 40 | defined SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION | ||
| 41 | # define HAVE_LOAD_EXTENSION 1 | ||
| 42 | # else | ||
| 43 | # define HAVE_LOAD_EXTENSION 0 | ||
| 44 | # endif | ||
| 45 | |||
| 35 | #ifdef WINDOWSNT | 46 | #ifdef WINDOWSNT |
| 36 | 47 | ||
| 37 | # include <windows.h> | 48 | # include <windows.h> |
| @@ -77,7 +88,7 @@ DEF_DLL_FN (SQLITE_API int, sqlite3_exec, | |||
| 77 | DEF_DLL_FN (SQLITE_API int, sqlite3_prepare_v2, | 88 | DEF_DLL_FN (SQLITE_API int, sqlite3_prepare_v2, |
| 78 | (sqlite3*, const char*, int, sqlite3_stmt**, const char**)); | 89 | (sqlite3*, const char*, int, sqlite3_stmt**, const char**)); |
| 79 | 90 | ||
| 80 | # ifdef HAVE_SQLITE3_LOAD_EXTENSION | 91 | # if HAVE_LOAD_EXTENSION |
| 81 | DEF_DLL_FN (SQLITE_API int, sqlite3_load_extension, | 92 | DEF_DLL_FN (SQLITE_API int, sqlite3_load_extension, |
| 82 | (sqlite3*, const char*, const char*, char**)); | 93 | (sqlite3*, const char*, const char*, char**)); |
| 83 | # undef sqlite3_load_extension | 94 | # undef sqlite3_load_extension |
| @@ -175,7 +186,7 @@ load_dll_functions (HMODULE library) | |||
| 175 | LOAD_DLL_FN (library, sqlite3_column_text); | 186 | LOAD_DLL_FN (library, sqlite3_column_text); |
| 176 | LOAD_DLL_FN (library, sqlite3_column_name); | 187 | LOAD_DLL_FN (library, sqlite3_column_name); |
| 177 | LOAD_DLL_FN (library, sqlite3_exec); | 188 | LOAD_DLL_FN (library, sqlite3_exec); |
| 178 | # ifdef HAVE_SQLITE3_LOAD_EXTENSION | 189 | # if HAVE_LOAD_EXTENSION |
| 179 | LOAD_DLL_FN (library, sqlite3_load_extension); | 190 | LOAD_DLL_FN (library, sqlite3_load_extension); |
| 180 | LOAD_DLL_FN (library, sqlite3_db_config); | 191 | LOAD_DLL_FN (library, sqlite3_db_config); |
| 181 | # endif | 192 | # endif |
| @@ -675,7 +686,7 @@ DEFUN ("sqlite-pragma", Fsqlite_pragma, Ssqlite_pragma, 2, 2, 0, | |||
| 675 | SSDATA (concat2 (build_string ("PRAGMA "), pragma))); | 686 | SSDATA (concat2 (build_string ("PRAGMA "), pragma))); |
| 676 | } | 687 | } |
| 677 | 688 | ||
| 678 | #ifdef HAVE_SQLITE3_LOAD_EXTENSION | 689 | #if HAVE_LOAD_EXTENSION |
| 679 | DEFUN ("sqlite-load-extension", Fsqlite_load_extension, | 690 | DEFUN ("sqlite-load-extension", Fsqlite_load_extension, |
| 680 | Ssqlite_load_extension, 2, 2, 0, | 691 | Ssqlite_load_extension, 2, 2, 0, |
| 681 | doc: /* Load an SQlite MODULE into DB. | 692 | doc: /* Load an SQlite MODULE into DB. |
| @@ -750,7 +761,7 @@ Only modules on Emacs' list of allowed modules can be loaded. */) | |||
| 750 | } | 761 | } |
| 751 | return Qnil; | 762 | return Qnil; |
| 752 | } | 763 | } |
| 753 | #endif /* HAVE_SQLITE3_LOAD_EXTENSION */ | 764 | #endif /* HAVE_LOAD_EXTENSION */ |
| 754 | 765 | ||
| 755 | DEFUN ("sqlite-next", Fsqlite_next, Ssqlite_next, 1, 1, 0, | 766 | DEFUN ("sqlite-next", Fsqlite_next, Ssqlite_next, 1, 1, 0, |
| 756 | doc: /* Return the next result set from SET. | 767 | doc: /* Return the next result set from SET. |
| @@ -860,7 +871,7 @@ syms_of_sqlite (void) | |||
| 860 | defsubr (&Ssqlite_commit); | 871 | defsubr (&Ssqlite_commit); |
| 861 | defsubr (&Ssqlite_rollback); | 872 | defsubr (&Ssqlite_rollback); |
| 862 | defsubr (&Ssqlite_pragma); | 873 | defsubr (&Ssqlite_pragma); |
| 863 | #ifdef HAVE_SQLITE3_LOAD_EXTENSION | 874 | #if HAVE_LOAD_EXTENSION |
| 864 | defsubr (&Ssqlite_load_extension); | 875 | defsubr (&Ssqlite_load_extension); |
| 865 | #endif | 876 | #endif |
| 866 | defsubr (&Ssqlite_next); | 877 | defsubr (&Ssqlite_next); |