diff options
| author | J08nY | 2017-08-23 20:12:10 +0200 |
|---|---|---|
| committer | J08nY | 2017-08-23 20:12:10 +0200 |
| commit | a0997fb8e5893fed2c2275ff0cfbfa892b261601 (patch) | |
| tree | 926f093cbe087a8c7f69705f159fe85ff8799caa /src/mailman_pgp/commands/eml_key.py | |
| parent | 43cc9d3e2c76c82bd00ce46ee7de6d69d07f3bb3 (diff) | |
| download | mailman-pgp-a0997fb8e5893fed2c2275ff0cfbfa892b261601.tar.gz mailman-pgp-a0997fb8e5893fed2c2275ff0cfbfa892b261601.tar.zst mailman-pgp-a0997fb8e5893fed2c2275ff0cfbfa892b261601.zip | |
Diffstat (limited to 'src/mailman_pgp/commands/eml_key.py')
| -rw-r--r-- | src/mailman_pgp/commands/eml_key.py | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/src/mailman_pgp/commands/eml_key.py b/src/mailman_pgp/commands/eml_key.py index c42415d..6b3dbd6 100644 --- a/src/mailman_pgp/commands/eml_key.py +++ b/src/mailman_pgp/commands/eml_key.py @@ -65,10 +65,9 @@ def _cmd_set(pgp_list, mlist, msg, msgdata, arguments, results): print('Missing token.', file=results) return ContinueProcessing.no - wrapped = PGPWrapper(msg) + wrapped = PGPWrapper(msg, True) if wrapped.is_encrypted(): - decrypted = wrapped.try_decrypt(pgp_list.key) - wrapped = PGPWrapper(decrypted) + wrapped.try_decrypt(pgp_list.key) if not wrapped.has_keys(): print('No keys attached? Send a key.', file=results) @@ -154,10 +153,9 @@ def _cmd_confirm(pgp_list, mlist, msg, msgdata, arguments, results): print('No key set.', file=results) return ContinueProcessing.no - wrapped = PGPWrapper(msg) + wrapped = PGPWrapper(msg, True) if wrapped.is_encrypted(): - decrypted = wrapped.try_decrypt(pgp_list.key) - wrapped = PGPWrapper(decrypted) + wrapped.try_decrypt(pgp_list.key) if not wrapped.is_signed(): print('Message not signed, ignoring.', file=results) @@ -226,10 +224,9 @@ def _cmd_change(pgp_list, mlist, msg, msgdata, arguments, results): print('Your key is currently not confirmed.', file=results) return ContinueProcessing.no - wrapped = PGPWrapper(msg) + wrapped = PGPWrapper(msg, True) if wrapped.is_encrypted(): - decrypted = wrapped.try_decrypt(pgp_list.key) - wrapped = PGPWrapper(decrypted) + wrapped.try_decrypt(pgp_list.key) if not wrapped.has_keys(): print('No keys attached? Send a key.', file=results) @@ -294,10 +291,9 @@ def _cmd_revoke(pgp_list, mlist, msg, msgdata, arguments, results): print('Your key is currently not confirmed.', file=results) return ContinueProcessing.no - wrapped = PGPWrapper(msg) + wrapped = PGPWrapper(msg, True) if wrapped.is_encrypted(): - decrypted = wrapped.try_decrypt(pgp_list.key) - wrapped = PGPWrapper(decrypted) + wrapped.try_decrypt(pgp_list.key) if not wrapped.has_revocs(): print('No key revocations attached? Send a key revocation.', @@ -378,10 +374,9 @@ def _cmd_sign(pgp_list, mlist, msg, msgdata, arguments, results): print('Your key is currently not confirmed.', file=results) return ContinueProcessing.no - wrapped = PGPWrapper(msg) + wrapped = PGPWrapper(msg, True) if wrapped.is_encrypted(): - decrypted = wrapped.try_decrypt(pgp_list.key) - wrapped = PGPWrapper(decrypted) + wrapped.try_decrypt(pgp_list.key) if not wrapped.has_keys(): print('No keys attached? Send a key.', file=results) @@ -434,15 +429,14 @@ def _cmd_receive(pgp_list, mlist, msg, msgdata, arguments, results): print('No email to send list public key.', file=results) return ContinueProcessing.no - msg = UserNotification(email, mlist.request_address, + out = UserNotification(email, mlist.request_address, '{} public key'.format(mlist.fqdn_listname)) - msg.set_type('multipart/mixed') - msg['MIME-Version'] = '1.0' - msg.attach(MIMEText('Here is the public key you requested.')) - wrapped = MIMEWrapper(msg) - msg = wrapped.attach_keys(pgp_list.pubkey) + out.set_type('multipart/mixed') + out['MIME-Version'] = '1.0' + out.attach(MIMEText('Here is the public key you requested.')) + MIMEWrapper(out).attach_keys(pgp_list.pubkey) - msg.send(mlist) + out.send(mlist) print('Key sent.', file=results) return ContinueProcessing.yes |
