@@ -246940,9 +246940,9 @@ SQLITE_API void sqlite3mc_vfs_shutdown();
246940246940
246941246941#define SQLITE3MC_VERSION_MAJOR 1
246942246942#define SQLITE3MC_VERSION_MINOR 3
246943- #define SQLITE3MC_VERSION_RELEASE 0
246943+ #define SQLITE3MC_VERSION_RELEASE 1
246944246944#define SQLITE3MC_VERSION_SUBRELEASE 0
246945- #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.3.0 "
246945+ #define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.3.1 "
246946246946
246947246947#endif /* SQLITE3MC_VERSION_H_ */
246948246948/*** End of #include "sqlite3mc_version.h" ***/
@@ -249872,7 +249872,7 @@ static int userAuthCheckLogin(
249872249872 int rc;
249873249873
249874249874 *peAuth = UAUTH_Unknown;
249875- if( !userTableExists(db, "main" ) ){
249875+ if( !userTableExists(db, zDb ) ){
249876249876 *peAuth = UAUTH_Admin; /* No sqlite_user table. Everybody is admin. */
249877249877 return SQLITE_OK;
249878249878 }
@@ -255689,7 +255689,7 @@ sqlite3mcConfigureSQLCipherVersion(sqlite3* db, int configDefault, int legacyVer
255689255689** Purpose: Configuration of SQLite codecs
255690255690** Author: Ulrich Telle
255691255691** Created: 2020-03-02
255692- ** Copyright: (c) 2006-2020 Ulrich Telle
255692+ ** Copyright: (c) 2006-2021 Ulrich Telle
255693255693** License: MIT
255694255694*/
255695255695
@@ -256530,6 +256530,17 @@ sqlite3mcFileControlPragma(sqlite3* db, const char* zDbName, int op, void* pArg)
256530256530 {
256531256531 ((char**)pArg)[0] = sqlite3_mprintf("ok");
256532256532 }
256533+ else
256534+ {
256535+ if (db->pErr)
256536+ {
256537+ const char* z = sqlite3_value_text(db->pErr);
256538+ if (z && sqlite3Strlen30(z) > 0)
256539+ {
256540+ ((char**)pArg)[0] = sqlite3_mprintf(z);
256541+ }
256542+ }
256543+ }
256533256544 }
256534256545 else
256535256546 {
@@ -256679,7 +256690,7 @@ sqlite3mcHandleMainKey(sqlite3* db, const char* zPath)
256679256690** Purpose: Implementation of SQLite codec API
256680256691** Author: Ulrich Telle
256681256692** Created: 2006-12-06
256682- ** Copyright: (c) 2006-2020 Ulrich Telle
256693+ ** Copyright: (c) 2006-2021 Ulrich Telle
256683256694** License: MIT
256684256695*/
256685256696
@@ -257324,6 +257335,7 @@ sqlite3_key_v2(sqlite3* db, const char* zDbName, const void* zKey, int nKey)
257324257335 else
257325257336 {
257326257337 rc = SQLITE_ERROR;
257338+ sqlite3ErrorWithMsg(db, rc, "Key failed. Database '%s' not found.", zDbName);
257327257339 }
257328257340 }
257329257341 return rc;
@@ -257350,6 +257362,7 @@ sqlite3_rekey_v2(sqlite3* db, const char* zDbName, const void* zKey, int nKey)
257350257362 dbIndex = (zDbName) ? sqlite3FindDbName(db, zDbName) : 0;
257351257363 if (dbIndex < 0)
257352257364 {
257365+ sqlite3ErrorWithMsg(db, rc, "Rekey failed. Database '%s' not found.", zDbName);
257353257366 return rc;
257354257367 }
257355257368 pBt = db->aDb[dbIndex].pBt;
@@ -257362,6 +257375,12 @@ sqlite3_rekey_v2(sqlite3* db, const char* zDbName, const void* zKey, int nKey)
257362257375 pPager = sqlite3BtreePager(pBt);
257363257376 codec = sqlite3mcGetCodec(db, zDbName);
257364257377
257378+ if (pagerUseWal(pPager))
257379+ {
257380+ sqlite3ErrorWithMsg(db, rc, "Rekey is not supported in WAL journal mode.");
257381+ return rc;
257382+ }
257383+
257365257384 if ((zKey == NULL || nKey == 0) && (codec == NULL || !sqlite3mcIsEncrypted(codec)))
257366257385 {
257367257386 /* Database not encrypted and key not specified, therefore do nothing */
@@ -257409,6 +257428,7 @@ sqlite3_rekey_v2(sqlite3* db, const char* zDbName, const void* zKey, int nKey)
257409257428 {
257410257429 /* Pagesize cannot be changed for an encrypted database */
257411257430 rc = SQLITE_ERROR;
257431+ sqlite3ErrorWithMsg(db, rc, "Rekey failed. Pagesize cannot be changed for an encrypted database.");
257412257432 goto leave_rekey;
257413257433 }
257414257434 }
@@ -257457,12 +257477,14 @@ sqlite3_rekey_v2(sqlite3* db, const char* zDbName, const void* zKey, int nKey)
257457257477 {
257458257478 /* Pagesize cannot be changed for an encrypted database */
257459257479 rc = SQLITE_ERROR;
257480+ sqlite3ErrorWithMsg(db, rc, "Rekey failed. Pagesize cannot be changed for an encrypted database.");
257460257481 goto leave_rekey;
257461257482 }
257462257483 }
257463257484 else
257464257485 {
257465257486 /* Setup of write cipher failed */
257487+ sqlite3ErrorWithMsg(db, rc, "Rekey failed. Setup of write cipher failed.");
257466257488 goto leave_rekey;
257467257489 }
257468257490 }
0 commit comments