Ensure omemo folder is created with mode 0700

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2021-07-28 20:39:52 +02:00
parent 4d9dff5bf5
commit beb5255cb2
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -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(