mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
[CSE] Change the Database to handle Encrypted Files
Create a table to hold the information between the real file name and the fake file name
This commit is contained in:
parent
4892b0ec43
commit
b909bb6977
2 changed files with 25 additions and 0 deletions
|
@ -455,6 +455,17 @@ bool SyncJournalDb::checkConnect()
|
|||
return sqlFail("Create table version", createQuery);
|
||||
}
|
||||
|
||||
/* maps the end to end filename in the server/metadata to the actuall filename in disk
|
||||
*/
|
||||
createQuery.prepare("CREATE TABLE IF NOT EXISTS e2efilemap("
|
||||
"mangledname TEXT UNIQUE,"
|
||||
"name TEXT UNIQUE"
|
||||
")");
|
||||
|
||||
if (!createQuery.exec()) {
|
||||
return sqlFail("Create table e2efilemap", createQuery);
|
||||
}
|
||||
|
||||
bool forceRemoteDiscovery = false;
|
||||
|
||||
SqlQuery versionQuery("SELECT major, minor, patch FROM version;", _db);
|
||||
|
@ -692,6 +703,16 @@ bool SyncJournalDb::checkConnect()
|
|||
return sqlFail("prepare _setDataFingerprintQuery2", *_setDataFingerprintQuery2);
|
||||
}
|
||||
|
||||
_getE2eFileMangledName.reset(new SqlQuery(_db));
|
||||
if (_getE2eFileMangledName->prepare("SELECT mangledname FROM e2efilemap WHERE mangledname =?1;")) {
|
||||
return sqlFail("prepare _getE2eFileMangledName", *_getE2eFileMangledName);
|
||||
}
|
||||
|
||||
_setE2eFileRelationQuery.reset(new SqlQuery(_db));
|
||||
if (_setE2eFileRelationQuery->prepare("INSERT INTO e2efilemap (mangledname, name) VALUES (?1, ?2);")) {
|
||||
return sqlFail("prepare _setE2eFileRelationQuery", *_setE2eFileRelationQuery);
|
||||
}
|
||||
|
||||
// don't start a new transaction now
|
||||
commitInternal(QString("checkConnect End"), false);
|
||||
|
||||
|
|
|
@ -266,6 +266,10 @@ private:
|
|||
QScopedPointer<SqlQuery> _setDataFingerprintQuery1;
|
||||
QScopedPointer<SqlQuery> _setDataFingerprintQuery2;
|
||||
|
||||
// End to End Encryption Related Queries/
|
||||
QScopedPointer<SqlQuery> _setE2eFileRelationQuery;
|
||||
QScopedPointer<SqlQuery> _getE2eFileMangledName;
|
||||
|
||||
/* This is the list of paths we called avoidReadFromDbOnNextSync on.
|
||||
* It means that they should not be written to the DB in any case since doing
|
||||
* that would write the etag and would void the purpose of avoidReadFromDbOnNextSync
|
||||
|
|
Loading…
Reference in a new issue