Commit 754f8e35 authored by Colomban Wendling's avatar Colomban Wendling

Properly use selected chain mode also when reading from a file

This fix accountrc decryption on FreeBSD.
parent a41f9c8c
......@@ -58,7 +58,7 @@ def pass_decrypt(p, key=PASSCRYPT_KEY, mode=DES.MODE_CFB):
return p
def accountrc_decrypt(filename, key=PASSCRYPT_KEY):
def accountrc_decrypt(filename, key=PASSCRYPT_KEY, mode=DES.MODE_CFB):
""" Reads passwords from ClawsMail's accountrc file """
p = ConfigParser()
......@@ -72,7 +72,7 @@ def accountrc_decrypt(filename, key=PASSCRYPT_KEY):
address = '<unknown>'
account = '<unknown>'
password = pass_decrypt(p.get(s, 'password'), key)
password = pass_decrypt(p.get(s, 'password'), key, mode=mode)
print('password for %s, %s is "%s"' % (account, address, password))
except Exception as e:
print('Error resolving password for account "%s": %s' % (s, e))
......@@ -111,7 +111,7 @@ if __name__ == '__main__':
for a in args:
if os.path.exists(a):
accountrc_decrypt(a, key=options.key)
accountrc_decrypt(a, key=options.key, mode=options.mode)
password = pass_decrypt(a, key=options.key, mode=options.mode)
print('password "%s" is "%s"' % (a, password))
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment