@@ -246940,9 +246940,9 @@ SQLITE_API void sqlite3mc_vfs_shutdown();
246940
246940
246941
246941
#define SQLITE3MC_VERSION_MAJOR 1
246942
246942
#define SQLITE3MC_VERSION_MINOR 3
246943
- #define SQLITE3MC_VERSION_RELEASE 0
246943
+ #define SQLITE3MC_VERSION_RELEASE 1
246944
246944
#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 "
246946
246946
246947
246947
#endif /* SQLITE3MC_VERSION_H_ */
246948
246948
/*** End of #include "sqlite3mc_version.h" ***/
@@ -249872,7 +249872,7 @@ static int userAuthCheckLogin(
249872
249872
int rc;
249873
249873
249874
249874
*peAuth = UAUTH_Unknown;
249875
- if( !userTableExists(db, "main" ) ){
249875
+ if( !userTableExists(db, zDb ) ){
249876
249876
*peAuth = UAUTH_Admin; /* No sqlite_user table. Everybody is admin. */
249877
249877
return SQLITE_OK;
249878
249878
}
@@ -255689,7 +255689,7 @@ sqlite3mcConfigureSQLCipherVersion(sqlite3* db, int configDefault, int legacyVer
255689
255689
** Purpose: Configuration of SQLite codecs
255690
255690
** Author: Ulrich Telle
255691
255691
** Created: 2020-03-02
255692
- ** Copyright: (c) 2006-2020 Ulrich Telle
255692
+ ** Copyright: (c) 2006-2021 Ulrich Telle
255693
255693
** License: MIT
255694
255694
*/
255695
255695
@@ -256530,6 +256530,17 @@ sqlite3mcFileControlPragma(sqlite3* db, const char* zDbName, int op, void* pArg)
256530
256530
{
256531
256531
((char**)pArg)[0] = sqlite3_mprintf("ok");
256532
256532
}
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
+ }
256533
256544
}
256534
256545
else
256535
256546
{
@@ -256679,7 +256690,7 @@ sqlite3mcHandleMainKey(sqlite3* db, const char* zPath)
256679
256690
** Purpose: Implementation of SQLite codec API
256680
256691
** Author: Ulrich Telle
256681
256692
** Created: 2006-12-06
256682
- ** Copyright: (c) 2006-2020 Ulrich Telle
256693
+ ** Copyright: (c) 2006-2021 Ulrich Telle
256683
256694
** License: MIT
256684
256695
*/
256685
256696
@@ -257324,6 +257335,7 @@ sqlite3_key_v2(sqlite3* db, const char* zDbName, const void* zKey, int nKey)
257324
257335
else
257325
257336
{
257326
257337
rc = SQLITE_ERROR;
257338
+ sqlite3ErrorWithMsg(db, rc, "Key failed. Database '%s' not found.", zDbName);
257327
257339
}
257328
257340
}
257329
257341
return rc;
@@ -257350,6 +257362,7 @@ sqlite3_rekey_v2(sqlite3* db, const char* zDbName, const void* zKey, int nKey)
257350
257362
dbIndex = (zDbName) ? sqlite3FindDbName(db, zDbName) : 0;
257351
257363
if (dbIndex < 0)
257352
257364
{
257365
+ sqlite3ErrorWithMsg(db, rc, "Rekey failed. Database '%s' not found.", zDbName);
257353
257366
return rc;
257354
257367
}
257355
257368
pBt = db->aDb[dbIndex].pBt;
@@ -257362,6 +257375,12 @@ sqlite3_rekey_v2(sqlite3* db, const char* zDbName, const void* zKey, int nKey)
257362
257375
pPager = sqlite3BtreePager(pBt);
257363
257376
codec = sqlite3mcGetCodec(db, zDbName);
257364
257377
257378
+ if (pagerUseWal(pPager))
257379
+ {
257380
+ sqlite3ErrorWithMsg(db, rc, "Rekey is not supported in WAL journal mode.");
257381
+ return rc;
257382
+ }
257383
+
257365
257384
if ((zKey == NULL || nKey == 0) && (codec == NULL || !sqlite3mcIsEncrypted(codec)))
257366
257385
{
257367
257386
/* 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)
257409
257428
{
257410
257429
/* Pagesize cannot be changed for an encrypted database */
257411
257430
rc = SQLITE_ERROR;
257431
+ sqlite3ErrorWithMsg(db, rc, "Rekey failed. Pagesize cannot be changed for an encrypted database.");
257412
257432
goto leave_rekey;
257413
257433
}
257414
257434
}
@@ -257457,12 +257477,14 @@ sqlite3_rekey_v2(sqlite3* db, const char* zDbName, const void* zKey, int nKey)
257457
257477
{
257458
257478
/* Pagesize cannot be changed for an encrypted database */
257459
257479
rc = SQLITE_ERROR;
257480
+ sqlite3ErrorWithMsg(db, rc, "Rekey failed. Pagesize cannot be changed for an encrypted database.");
257460
257481
goto leave_rekey;
257461
257482
}
257462
257483
}
257463
257484
else
257464
257485
{
257465
257486
/* Setup of write cipher failed */
257487
+ sqlite3ErrorWithMsg(db, rc, "Rekey failed. Setup of write cipher failed.");
257466
257488
goto leave_rekey;
257467
257489
}
257468
257490
}
0 commit comments