summaryrefslogtreecommitdiff
path: root/src/mailman_pgp/commands/eml_key.py
diff options
context:
space:
mode:
authorJ08nY2017-07-31 00:46:42 +0200
committerJ08nY2017-07-31 00:46:42 +0200
commitc28fc92df4561d377e415d8b42897ec4c9d7267f (patch)
treecef2a65b65b248878420b511e9c1d9bd562924d3 /src/mailman_pgp/commands/eml_key.py
parentac2ab9a488e458ffb897112b9e4a22a573090f18 (diff)
downloadmailman-pgp-c28fc92df4561d377e415d8b42897ec4c9d7267f.tar.gz
mailman-pgp-c28fc92df4561d377e415d8b42897ec4c9d7267f.tar.zst
mailman-pgp-c28fc92df4561d377e415d8b42897ec4c9d7267f.zip
Diffstat (limited to 'src/mailman_pgp/commands/eml_key.py')
-rw-r--r--src/mailman_pgp/commands/eml_key.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/mailman_pgp/commands/eml_key.py b/src/mailman_pgp/commands/eml_key.py
index 5bb2bd8..be0af44 100644
--- a/src/mailman_pgp/commands/eml_key.py
+++ b/src/mailman_pgp/commands/eml_key.py
@@ -67,6 +67,12 @@ def _cmd_set(pgp_list, mlist, msg, msgdata, arguments, results):
if len(keys) != 1:
print('More than one key! Send only one key.', file=results)
return ContinueProcessing.no
+ key = keys.pop()
+
+ if not key.is_public:
+ print('You probably wanted to send your public key only.',
+ file=results)
+ return ContinueProcessing.no
email = get_email(msg)
if not email:
@@ -90,7 +96,7 @@ def _cmd_set(pgp_list, mlist, msg, msgdata, arguments, results):
return ContinueProcessing.no
with transaction():
- pgp_address.key = keys.pop()
+ pgp_address.key = key
ISubscriptionManager(mlist).confirm(token)
print('Key succesfully set.', file=results)
@@ -206,8 +212,14 @@ def _cmd_change(pgp_list, mlist, msg, msgdata, arguments, results):
if len(keys) != 1:
print('More than one key! Send only one key.', file=results)
return ContinueProcessing.no
+ key = keys.pop()
+
+ if not key.is_public:
+ print('You probably wanted to send your public key only.',
+ file=results)
+ return ContinueProcessing.no
- workflow = KeyChangeWorkflow(mlist, pgp_address, keys.pop())
+ workflow = KeyChangeWorkflow(mlist, pgp_address, key)
list(workflow)
print('Key change request received.', file=results)
return ContinueProcessing.no