From: Krzysztof Jackiewicz Date: Thu, 13 May 2021 12:53:32 +0000 (+0200) Subject: Open legacy db in R/W mode X-Git-Tag: accepted/tizen/6.0/unified/20210515.083846~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c53c27617187678245b4af0465e377583312af45;p=platform%2Fcore%2Fsecurity%2Fkey-manager.git Open legacy db in R/W mode If due to a failure during previous transaction a rollback journal is generated, the original legacy database has to be restored to the original state before it can be dumped. However, it can't be done unless the database is opened in R/W mode. Change-Id: Icc455f4e820a5be8b0628e95895680e9cbb14eb6 --- diff --git a/src/manager/sqlcipher/sqlcipher.c b/src/manager/sqlcipher/sqlcipher.c index 5f345df..2578748 100644 --- a/src/manager/sqlcipher/sqlcipher.c +++ b/src/manager/sqlcipher/sqlcipher.c @@ -230276,7 +230276,7 @@ __attribute__((visibility("default"))) char *dumpLegacyDb(const char *dbPath, co sqlite3 *db; - int rc = sqlite3_open_v2(dbPath, &db, SQLITE_OPEN_READONLY, 0); + int rc = sqlite3_open_v2(dbPath, &db, SQLITE_OPEN_READWRITE, 0); if (!rc && !(rc = sqlite3_key(db, pass, passSize)) && !(rc = sqlite3_exec(db, "PRAGMA cipher_compatibility=2", 0, 0, 0))) rc = sqlite3_db_dump(db, ssout, (void*)&out);