summaryrefslogtreecommitdiff
path: root/client/src/leap
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/leap')
-rw-r--r--client/src/leap/soledad/client/api.py6
-rw-r--r--client/src/leap/soledad/client/crypto.py4
-rw-r--r--client/src/leap/soledad/client/encdecpool.py10
-rw-r--r--client/src/leap/soledad/client/pragmas.py8
-rw-r--r--client/src/leap/soledad/client/secrets.py20
-rw-r--r--client/src/leap/soledad/client/sync.py37
6 files changed, 38 insertions, 47 deletions
diff --git a/client/src/leap/soledad/client/api.py b/client/src/leap/soledad/client/api.py
index f620f1bc..6870d5ba 100644
--- a/client/src/leap/soledad/client/api.py
+++ b/client/src/leap/soledad/client/api.py
@@ -337,7 +337,7 @@ class Soledad(object):
"""
Close underlying U1DB database.
"""
- logger.debug("Closing soledad")
+ logger.debug("closing soledad")
self._dbpool.close()
if getattr(self, '_dbsyncer', None):
self._dbsyncer.close()
@@ -763,7 +763,7 @@ class Soledad(object):
def _sync_errback(failure):
s = StringIO()
failure.printDetailedTraceback(file=s)
- msg = "Soledad exception when syncing!\n" + s.getvalue()
+ msg = "got exception when syncing!\n" + s.getvalue()
logger.error(msg)
return failure
@@ -1005,7 +1005,7 @@ class Soledad(object):
def create_path_if_not_exists(path):
try:
if not os.path.isdir(path):
- logger.info('Creating directory: %s.' % path)
+ logger.info('creating directory: %s.' % path)
os.makedirs(path)
except OSError as exc:
if exc.errno == errno.EEXIST and os.path.isdir(path):
diff --git a/client/src/leap/soledad/client/crypto.py b/client/src/leap/soledad/client/crypto.py
index 9f5fe28e..d81c883b 100644
--- a/client/src/leap/soledad/client/crypto.py
+++ b/client/src/leap/soledad/client/crypto.py
@@ -300,7 +300,7 @@ def encrypt_docstr(docstr, doc_id, doc_rev, key, secret):
# convert binary data to hexadecimal representation so the JSON
# serialization does not complain about what it tries to serialize.
hex_ciphertext = binascii.b2a_hex(ciphertext)
- logger.debug("Encrypting doc: %s" % doc_id)
+ logger.debug("encrypting doc: %s" % doc_id)
return json.dumps({
crypto.ENC_JSON_KEY: hex_ciphertext,
crypto.ENC_SCHEME_KEY: enc_scheme,
@@ -356,7 +356,7 @@ def _verify_doc_mac(doc_id, doc_rev, ciphertext, enc_scheme, enc_method,
calculated_mac_hash = hashlib.sha256(calculated_mac).digest()
if doc_mac_hash != calculated_mac_hash:
- logger.warn("Wrong MAC while decrypting doc...")
+ logger.warn("wrong MAC while decrypting doc...")
raise crypto.WrongMacError("Could not authenticate document's "
"contents.")
diff --git a/client/src/leap/soledad/client/encdecpool.py b/client/src/leap/soledad/client/encdecpool.py
index c1a7f651..056b012f 100644
--- a/client/src/leap/soledad/client/encdecpool.py
+++ b/client/src/leap/soledad/client/encdecpool.py
@@ -154,7 +154,7 @@ class SyncEncrypterPool(SyncEncryptDecryptPool):
Start the encrypter pool.
"""
SyncEncryptDecryptPool.start(self)
- logger.debug("Starting the encryption loop...")
+ logger.debug("starting the encryption loop...")
def stop(self):
"""
@@ -229,10 +229,10 @@ class SyncEncrypterPool(SyncEncryptDecryptPool):
% self.TABLE_NAME
result = yield self._runQuery(query, (doc_id, doc_rev))
if result:
- logger.debug("Found doc on sync db: %s" % doc_id)
+ logger.debug("found doc on sync db: %s" % doc_id)
val = result.pop()
defer.returnValue(val[0])
- logger.debug("Did not find doc on sync db: %s" % doc_id)
+ logger.debug("did not find doc on sync db: %s" % doc_id)
defer.returnValue(None)
def delete_encrypted_doc(self, doc_id, doc_rev):
@@ -505,7 +505,7 @@ class SyncDecrypterPool(SyncEncryptDecryptPool):
:rtype: twisted.internet.defer.Deferred
"""
doc_id, rev, content, gen, trans_id, idx = result
- logger.debug("Sync decrypter pool: decrypted doc %s: %s %s %s"
+ logger.debug("sync decrypter pool: decrypted doc %s: %s %s %s"
% (doc_id, rev, gen, trans_id))
return self.insert_received_doc(
doc_id, rev, content, gen, trans_id, idx)
@@ -610,7 +610,7 @@ class SyncDecrypterPool(SyncEncryptDecryptPool):
:type trans_id: str
"""
# could pass source_replica in params for callback chain
- logger.debug("Sync decrypter pool: inserting doc in local db: "
+ logger.debug("sync decrypter pool: inserting doc in local db: "
"%s:%s %s" % (doc_id, doc_rev, gen))
# convert deleted documents to avoid error on document creation
diff --git a/client/src/leap/soledad/client/pragmas.py b/client/src/leap/soledad/client/pragmas.py
index 3c3e7aab..870ed63e 100644
--- a/client/src/leap/soledad/client/pragmas.py
+++ b/client/src/leap/soledad/client/pragmas.py
@@ -321,7 +321,7 @@ def set_synchronous_off(db_handle):
"""
Change the setting of the "synchronous" flag to OFF.
"""
- logger.debug("SQLCIPHER: SETTING SYNCHRONOUS OFF")
+ logger.debug("sqlcipher: setting synchronous off")
db_handle.cursor().execute('PRAGMA synchronous=OFF')
@@ -329,7 +329,7 @@ def set_synchronous_normal(db_handle):
"""
Change the setting of the "synchronous" flag to NORMAL.
"""
- logger.debug("SQLCIPHER: SETTING SYNCHRONOUS NORMAL")
+ logger.debug("sqlcipher: setting synchronous normal")
db_handle.cursor().execute('PRAGMA synchronous=NORMAL')
@@ -337,7 +337,7 @@ def set_mem_temp_store(db_handle):
"""
Use a in-memory store for temporary tables.
"""
- logger.debug("SQLCIPHER: SETTING TEMP_STORE MEMORY")
+ logger.debug("sqlcipher: setting temp_store memory")
db_handle.cursor().execute('PRAGMA temp_store=MEMORY')
@@ -362,7 +362,7 @@ def set_write_ahead_logging(db_handle):
requirements of the application. The default strategy is to run a
checkpoint once the WAL reaches 1000 pages"
"""
- logger.debug("SQLCIPHER: SETTING WRITE-AHEAD LOGGING")
+ logger.debug("sqlcipher: setting write-ahead logging")
db_handle.cursor().execute('PRAGMA journal_mode=WAL')
# The optimum value can still use a little bit of tuning, but we favor
diff --git a/client/src/leap/soledad/client/secrets.py b/client/src/leap/soledad/client/secrets.py
index b7bcdd0a..1eb6f31d 100644
--- a/client/src/leap/soledad/client/secrets.py
+++ b/client/src/leap/soledad/client/secrets.py
@@ -193,42 +193,42 @@ class SoledadSecrets(object):
"""
# STAGE 1 - verify if secrets exist locally
try:
- logger.info("Trying to load secrets from local storage...")
+ logger.info("trying to load secrets from local storage...")
version = self._load_secrets_from_local_file()
# eventually migrate local and remote stored documents from old
# format version
if version < self.RECOVERY_DOC_VERSION:
self._store_secrets()
self._upload_crypto_secrets()
- logger.info("Found secrets in local storage.")
+ logger.info("found secrets in local storage")
return
except NoStorageSecret:
- logger.info("Could not find secrets in local storage.")
+ logger.info("could not find secrets in local storage")
# STAGE 2 - there are no secrets in local storage and this is the
# first time we are running soledad with the specified
# secrets_path. Try to fetch encrypted secrets from
# server.
try:
- logger.info('Trying to fetch secrets from remote storage...')
+ logger.info('trying to fetch secrets from remote storage...')
version = self._download_crypto_secrets()
self._store_secrets()
# eventually migrate remote stored document from old format
# version
if version < self.RECOVERY_DOC_VERSION:
self._upload_crypto_secrets()
- logger.info('Found secrets in remote storage.')
+ logger.info('found secrets in remote storage.')
return
except NoStorageSecret:
- logger.info("Could not find secrets in remote storage.")
+ logger.info("could not find secrets in remote storage.")
# STAGE 3 - there are no secrets in server also, so we want to
# generate the secrets and store them in the remote
# db.
- logger.info("Generating secrets...")
+ logger.info("generating secrets...")
self._gen_crypto_secrets()
- logger.info("Uploading secrets...")
+ logger.info("uploading secrets...")
self._upload_crypto_secrets()
def _has_secret(self):
@@ -298,7 +298,7 @@ class SoledadSecrets(object):
"""
Generate the crypto secrets.
"""
- logger.info('No cryptographic secrets found, creating new secrets...')
+ logger.info('no cryptographic secrets found, creating new secrets...')
secret_id = self._gen_secret()
self.set_secret_id(secret_id)
@@ -445,7 +445,7 @@ class SoledadSecrets(object):
encrypted_secret)
secret_count += 1
except SecretsException as e:
- logger.error("Failed to decrypt storage secret: %s"
+ logger.error("failed to decrypt storage secret: %s"
% str(e))
return secret_count, active_secret
diff --git a/client/src/leap/soledad/client/sync.py b/client/src/leap/soledad/client/sync.py
index 335daaef..0c68d100 100644
--- a/client/src/leap/soledad/client/sync.py
+++ b/client/src/leap/soledad/client/sync.py
@@ -101,16 +101,12 @@ class SoledadSynchronizer(Synchronizer):
target_gen, target_trans_id = 0, ''
target_my_gen, target_my_trans_id = 0, ''
- logger.debug(
- "Soledad target sync info:\n"
- " target replica uid: %s\n"
- " target generation: %d\n"
- " target trans id: %s\n"
- " target my gen: %d\n"
- " target my trans_id: %s\n"
- " source replica_uid: %s\n"
- % (self.target_replica_uid, target_gen, target_trans_id,
- target_my_gen, target_my_trans_id, self.source._replica_uid))
+ logger.debug("target replica uid: %s" % self.target_replica_uid)
+ logger.debug("target generation: %d" % target_gen)
+ logger.debug("target trans id: %s" % target_trans_id)
+ logger.debug("target my gen: %d" % target_my_gen)
+ logger.debug("target my trans_id: %s" % target_my_trans_id)
+ logger.debug("source replica_uid: %s" % self.source._replica_uid)
# make sure we'll have access to target replica uid once it exists
if self.target_replica_uid is None:
@@ -133,8 +129,7 @@ class SoledadSynchronizer(Synchronizer):
# what's changed since that generation and this current gen
my_gen, _, changes = self.source.whats_changed(target_my_gen)
- logger.debug("Soledad sync: there are %d documents to send."
- % len(changes))
+ logger.debug("there are %d documents to send" % len(changes))
# get source last-seen database generation for the target
if self.target_replica_uid is None:
@@ -143,11 +138,10 @@ class SoledadSynchronizer(Synchronizer):
target_last_known_gen, target_last_known_trans_id = \
self.source._get_replica_gen_and_trans_id(
self.target_replica_uid)
- logger.debug(
- "Soledad source sync info:\n"
- " last target gen known to source: %d\n"
- " last target trans_id known to source: %s"
- % (target_last_known_gen, target_last_known_trans_id))
+ logger.debug(
+ "last known target gen: %d" % target_last_known_gen)
+ logger.debug(
+ "last known target trans_id: %s" % target_last_known_trans_id)
# validate transaction ids
if not changes and target_last_known_gen == target_gen:
@@ -180,11 +174,8 @@ class SoledadSynchronizer(Synchronizer):
target_last_known_gen, target_last_known_trans_id,
self._insert_doc_from_target, ensure_callback=ensure_callback,
defer_decryption=defer_decryption)
- logger.debug(
- "Soledad source sync info after sync exchange:\n"
- " source known target gen: %d\n"
- " source known target trans_id: %s"
- % (new_gen, new_trans_id))
+ logger.debug("target gen after sync: %d" % new_gen)
+ logger.debug("target trans_id after sync: %s" % new_trans_id)
info = {
"target_replica_uid": self.target_replica_uid,
"new_gen": new_gen,
@@ -223,7 +214,7 @@ class SoledadSynchronizer(Synchronizer):
:return: A deferred which will fire when the sync has been completed.
:rtype: twisted.internet.defer.Deferred
"""
- logger.debug("Completing deferred last step in SYNC...")
+ logger.debug("completing deferred last step in sync...")
# record target synced-up-to generation including applying what we
# sent