Fix missing vars

This commit is contained in:
Antonio J. Delgado 2025-02-05 11:04:32 +02:00
parent 3245bd0e2f
commit 6daa19c5e9

View file

@ -159,6 +159,8 @@ class ImapFilter:
return True
def _create_sieve_script(self, filters):
owner = None
group = None
if os.path.exists(self.config['sieve_scripts_path']):
self._log.debug(
"Updating Sieve script in '%s'...",
@ -214,7 +216,8 @@ class ImapFilter:
with open(self.config['sieve_scripts_path'], 'w', encoding='UTF-8') as sieve_script:
sieve_script.write(content)
if os.geteuid() == 0:
os.chown(self.config['sieve_scripts_path'], owner, group)
if owner and group:
os.chown(self.config['sieve_scripts_path'], owner, group)
os.chmod(
self.config['sieve_scripts_path'],
0o777