summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2014-07-14 20:01:01 -0300
committerdrebs <drebs@leap.se>2014-08-01 12:53:21 -0300
commit69f5087c718cc534a969fcba0fcb35812c88ad8b (patch)
treecd6bc4351d17ea4e0f27c04df91277801326afa4
parent6183ad313298de08e05c31c5f18f133361cd803b (diff)
Add encrypted field to sync db (#5895).
-rw-r--r--client/src/leap/soledad/client/crypto.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/client/src/leap/soledad/client/crypto.py b/client/src/leap/soledad/client/crypto.py
index 7133f804..89220860 100644
--- a/client/src/leap/soledad/client/crypto.py
+++ b/client/src/leap/soledad/client/crypto.py
@@ -691,7 +691,7 @@ class SyncDecrypterPool(SyncEncryptDecryptPool):
"""
# TODO implement throttling to reduce cpu usage??
TABLE_NAME = "docs_received"
- FIELD_NAMES = "doc_id, rev, content, gen, trans_id"
+ FIELD_NAMES = "doc_id, rev, content, gen, trans_id, encrypted"
write_encrypted_lock = threading.Lock()
@@ -733,13 +733,15 @@ class SyncDecrypterPool(SyncEncryptDecryptPool):
:type trans_id: str
"""
docstr = json.dumps(content)
- sql_ins = "INSERT INTO '%s' VALUES (?, ?, ?, ?, ?)" % (
+ sql_ins = "INSERT INTO '%s' VALUES (?, ?, ?, ?, ?, ?)" % (
self.TABLE_NAME,)
con = self._sync_db
with self._sync_db_write_lock:
with con:
- con.execute(sql_ins, (doc_id, doc_rev, docstr, gen, trans_id))
+ con.execute(
+ sql_ins,
+ (doc_id, doc_rev, docstr, gen, trans_id, 1))
def insert_marker_for_received_doc(self, doc_id, doc_rev, gen):
"""
@@ -757,12 +759,12 @@ class SyncDecrypterPool(SyncEncryptDecryptPool):
:param gen: the Document Generation
:type gen: int
"""
- sql_ins = "INSERT INTO '%s' VALUES (?, ?, ?, ?, ?)" % (
+ sql_ins = "INSERT INTO '%s' VALUES (?, ?, ?, ?, ?, ?)" % (
self.TABLE_NAME,)
con = self._sync_db
with self._sync_db_write_lock:
with con:
- con.execute(sql_ins, (doc_id, doc_rev, '', gen, ''))
+ con.execute(sql_ins, (doc_id, doc_rev, '', gen, '', 0))
def insert_received_doc(self, doc_id, doc_rev, content, gen, trans_id):
"""