aboutsummaryrefslogtreecommitdiff
path: root/rpki/publication.py
diff options
context:
space:
mode:
Diffstat (limited to 'rpki/publication.py')
-rw-r--r--rpki/publication.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/rpki/publication.py b/rpki/publication.py
index fc5b2627..ec2dabd4 100644
--- a/rpki/publication.py
+++ b/rpki/publication.py
@@ -54,8 +54,9 @@ def raise_if_error(pdu):
"""
Raise an appropriate error if this is a <report_error/> PDU.
- As a convience, this will also accept a <msg/> PDU and raise an
- appropriate error if it contains any <report_error/> PDUs.
+ As a convenience, this will also accept a <msg/> PDU and raise an
+ appropriate error if it contains any <report_error/> PDUs or if
+ the <msg/> is not a reply.
"""
if pdu.tag == tag_report_error:
@@ -68,6 +69,8 @@ def raise_if_error(pdu):
raise rpki.exceptions.BadPublicationReply("Unexpected response from pubd: %r, %r" % (code, pdu))
if pdu.tag == tag_msg:
+ if pdu.get("type") != "reply":
+ raise rpki.exceptions.BadPublicationReply("Unexpected response from pubd: expected reply, got %r" % pdu.get("type"))
for p in pdu:
raise_if_error(p)