Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/ci4sqlite3mc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ jobs:
make threadtest
./threadtest

- name: VFS stack tests
run: |
make vfsstacktest
./vfsstacktest

android_build:
name: Android (API ${{ matrix.api-level }})
runs-on: ubuntu-latest
Expand Down
6 changes: 5 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ sqlite3shell_LDFLAGS += -no-install
endif

# Tests for the cryptographic primitives (not installed, built like the shell).
check_PROGRAMS = cryptotest tempfiletest oomtest rekeytest threadtest
check_PROGRAMS = cryptotest tempfiletest oomtest rekeytest threadtest vfsstacktest
cryptotest_SOURCES = test/cryptotest.c
cryptotest_CFLAGS = $(sqlite3shell_CFLAGS)
cryptotest_LDADD = $(sqlite3shell_LDADD)
Expand All @@ -186,3 +186,7 @@ threadtest_SOURCES = test/threadtest.c
threadtest_CFLAGS = $(sqlite3shell_CFLAGS)
threadtest_LDADD = $(sqlite3shell_LDADD)
threadtest_LDFLAGS = $(sqlite3shell_LDFLAGS)
vfsstacktest_SOURCES = test/vfsstacktest.c
vfsstacktest_CFLAGS = $(sqlite3shell_CFLAGS)
vfsstacktest_LDADD = $(sqlite3shell_LDADD)
vfsstacktest_LDFLAGS = $(sqlite3shell_LDFLAGS)
41 changes: 17 additions & 24 deletions src/sqlite3mc_vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -977,32 +977,25 @@ SQLITE_PRIVATE void sqlite3mcSetCodec(sqlite3* db, const char* zDbName, const ch
SQLITE_PRIVATE void* sqlite3mcPagerCodec(PgHdrMC* pPg)
{
sqlite3_file* pFile = sqlite3PagerFile(pPg->pPager);
void* aData = 0;
if (pFile->pMethods == &mcIoMethodsGlobal1 ||
pFile->pMethods == &mcIoMethodsGlobal2 ||
pFile->pMethods == &mcIoMethodsGlobal3 ||
pFile->pMethods == &mcIoMethodsGlobal4)
{
sqlite3mc_file* mcFile = (sqlite3mc_file*) pFile;
Codec* codec = mcFile->codec;
if (codec != 0 && sqlite3mcIsEncrypted(codec))
{
int rc;
aData = sqlite3mcCodec(codec, pPg->pData, pPg->pgno, 6);
rc = sqlite3mcGetCodecLastError(codec);
if (rc != SQLITE_OK)
{
aData = 0;
}
}
else
{
aData = (char*) pPg->pData;
}
void* aData = (char*) pPg->pData;
Codec* codec = NULL;
/*
** Ask the file for its codec instead of checking its methods: another VFS
** shim may sit above the Multiple Ciphers VFS and wrap the file.
*/
if (pFile->pMethods != NULL)
{
sqlite3OsFileControlHint(pFile, SQLITE3MC_FCNTL_PCODEC, &codec);
}
else
if (codec != 0 && sqlite3mcIsEncrypted(codec))
{
aData = (char*) pPg->pData;
int rc;
aData = sqlite3mcCodec(codec, pPg->pData, pPg->pgno, 6);
rc = sqlite3mcGetCodecLastError(codec);
if (rc != SQLITE_OK)
{
aData = 0;
}
}
return aData;
}
Expand Down
Loading
Loading