summaryrefslogtreecommitdiff
path: root/src/mailman_pgp/commands/eml_key.py
diff options
context:
space:
mode:
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