aboutsummaryrefslogtreecommitdiff
path: root/src/mailman_pgp/commands/eml_key.py
diff options
context:
space:
mode:
authorJ08nY2017-07-14 00:37:40 +0200
committerJ08nY2017-07-14 00:37:40 +0200
commit8368cd832d21b404c01ab475ade6209b906ab422 (patch)
treedc0e6b5452ec3d80bef493d8518757a513791eca /src/mailman_pgp/commands/eml_key.py
parent57f8d97c696913beeba8467aa550804422336d9c (diff)
downloadmailman-pgp-8368cd832d21b404c01ab475ade6209b906ab422.tar.gz
mailman-pgp-8368cd832d21b404c01ab475ade6209b906ab422.tar.zst
mailman-pgp-8368cd832d21b404c01ab475ade6209b906ab422.zip
Make key change work.
Diffstat (limited to 'src/mailman_pgp/commands/eml_key.py')
-rw-r--r--src/mailman_pgp/commands/eml_key.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mailman_pgp/commands/eml_key.py b/src/mailman_pgp/commands/eml_key.py
index 7b7782d..2f7a7e7 100644
--- a/src/mailman_pgp/commands/eml_key.py
+++ b/src/mailman_pgp/commands/eml_key.py
@@ -31,7 +31,8 @@ from mailman_pgp.model.address import PGPAddress
from mailman_pgp.model.list import PGPMailingList
from mailman_pgp.pgp.wrapper import PGPWrapper
from mailman_pgp.workflows.base import CONFIRM_REQUEST
-from mailman_pgp.workflows.key_change import KeyChangeWorkflow
+from mailman_pgp.workflows.key_change import (CHANGE_CONFIRM_REQUEST,
+ KeyChangeWorkflow)
def _get_email(msg):
@@ -128,9 +129,12 @@ def _cmd_confirm(pgp_list, mlist, msg, msgdata, arguments, results):
print('Wrong token.', file=results)
return ContinueProcessing.no
- # TODO differentiate between key change and subscription here.
+ if pendable.get('type') == KeyChangeWorkflow.pendable_class().PEND_TYPE:
+ expecting = CHANGE_CONFIRM_REQUEST.format(pendable.get('fingerprint'),
+ token)
+ else:
+ expecting = CONFIRM_REQUEST.format(pgp_address.key_fingerprint, token)
- expecting = CONFIRM_REQUEST.format(pgp_address.key_fingerprint, token)
for sig_subject in wrapped.get_signed():
if expecting in sig_subject:
ISubscriptionManager(mlist).confirm(token)
@@ -143,6 +147,11 @@ def _cmd_confirm(pgp_list, mlist, msg, msgdata, arguments, results):
def _cmd_change(pgp_list, mlist, msg, msgdata, arguments, results):
# New public key in attachment, requires to be signed with current
# key
+ if len(arguments) != 1:
+ print('Extraneous argument/s: ' + ','.join(arguments[1:]),
+ file=results)
+ return ContinueProcessing.no
+
wrapped = PGPWrapper(msg)
if not wrapped.has_keys():
print('No keys attached? Send a key.', file=results)