Ensure omemo folder is created with mode 0700
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
4d9dff5bf5
commit
beb5255cb2
1 changed files with 6 additions and 1 deletions
|
@ -74,7 +74,12 @@ class Plugin(E2EEPlugin):
|
||||||
digest = hashlib.sha256(jid_str).digest()
|
digest = hashlib.sha256(jid_str).digest()
|
||||||
hashed_jid = base64.b32encode(digest).decode('US-ASCII')
|
hashed_jid = base64.b32encode(digest).decode('US-ASCII')
|
||||||
data_dir = os.path.join(DATA_HOME, 'omemo', hashed_jid)
|
data_dir = os.path.join(DATA_HOME, 'omemo', hashed_jid)
|
||||||
os.makedirs(data_dir, exist_ok=True)
|
|
||||||
|
try:
|
||||||
|
# Raise exception if folder exists so that we don't chmod again.
|
||||||
|
os.makedirs(data_dir, mode=0o700, exist_ok=False)
|
||||||
|
except OSError: # Folder already exists
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.core.xmpp.register_plugin(
|
self.core.xmpp.register_plugin(
|
||||||
|
|
Loading…
Reference in a new issue