aboutsummaryrefslogtreecommitdiff
path: root/rpkid/rpki
diff options
context:
space:
mode:
Diffstat (limited to 'rpkid/rpki')
-rw-r--r--rpkid/rpki/exceptions.py9
-rw-r--r--rpkid/rpki/https.py2
-rw-r--r--rpkid/rpki/left_right.py2
-rw-r--r--rpkid/rpki/publication.py15
-rw-r--r--rpkid/rpki/relaxng.py1
-rw-r--r--rpkid/rpki/rpki_engine.py3
-rw-r--r--rpkid/rpki/sql.py2
-rw-r--r--rpkid/rpki/up_down.py7
8 files changed, 25 insertions, 16 deletions
diff --git a/rpkid/rpki/exceptions.py b/rpkid/rpki/exceptions.py
index 70608f5f..c3638375 100644
--- a/rpkid/rpki/exceptions.py
+++ b/rpkid/rpki/exceptions.py
@@ -136,3 +136,12 @@ class NoActiveCA(RPKI_Exception):
class BadClientURL(RPKI_Exception):
"""URL given to HTTPS client does not match profile."""
+
+class ClientNotFound(RPKI_Exception):
+ """Could not find specified client in database."""
+
+class BadExtension(RPKI_Exception):
+ """Forbidden X.509 extension."""
+
+class ForbiddenURI(RPKI_Exception):
+ """Forbidden URI, does not start with correct base URI."""
diff --git a/rpkid/rpki/https.py b/rpkid/rpki/https.py
index 7f805377..0e51cec9 100644
--- a/rpkid/rpki/https.py
+++ b/rpkid/rpki/https.py
@@ -21,7 +21,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
"""
-import httplib, BaseHTTPServer, tlslite.api, glob, traceback, urlparse, socket, signal
+import httplib, BaseHTTPServer, tlslite.api, traceback, urlparse, signal
import rpki.x509, rpki.exceptions, rpki.log
# This should be wrapped somewhere in rpki.x509 eventually
diff --git a/rpkid/rpki/left_right.py b/rpkid/rpki/left_right.py
index 363feddb..a2f74ecf 100644
--- a/rpkid/rpki/left_right.py
+++ b/rpkid/rpki/left_right.py
@@ -17,7 +17,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
"""
-import base64, lxml.etree, time, traceback, os
+import traceback
import rpki.resource_set, rpki.x509, rpki.sql, rpki.exceptions, rpki.xml_utils
import rpki.https, rpki.up_down, rpki.relaxng, rpki.sundial, rpki.log, rpki.roa
import rpki.publication, rpki.async
diff --git a/rpkid/rpki/publication.py b/rpkid/rpki/publication.py
index 8d5ff267..0b784e97 100644
--- a/rpkid/rpki/publication.py
+++ b/rpkid/rpki/publication.py
@@ -17,7 +17,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
"""
-import base64, lxml.etree, time, traceback, os
+import base64, os
import rpki.resource_set, rpki.x509, rpki.sql, rpki.exceptions, rpki.xml_utils
import rpki.https, rpki.up_down, rpki.relaxng, rpki.sundial, rpki.log, rpki.roa
@@ -30,11 +30,11 @@ class publication_namespace(object):
class control_elt(rpki.xml_utils.data_elt, rpki.sql.sql_persistant, publication_namespace):
"""Virtual class for control channel objects."""
- def serve_dispatch(self, r_msg, client, cb):
+ def serve_dispatch(self, r_msg, cb):
"""Action dispatch handler. This needs special handling because
we need to make sure that this PDU arrived via the control channel.
"""
- if client is not None:
+ if self.client is not None:
raise rpki.exceptions.BadQuery, "Control query received on client channel"
rpki.xml_utils.data_elt.serve_dispatch(self, r_msg, cb)
@@ -162,15 +162,15 @@ class publication_object_elt(rpki.xml_utils.base_elt, publication_namespace):
elt.text = base64.b64encode(self.payload.get_DER())
return elt
- def serve_dispatch(self, r_msg, client, cb):
+ def serve_dispatch(self, r_msg, cb):
"""Action dispatch handler."""
- if client is None:
+ if self.client is None:
raise rpki.exceptions.BadQuery, "Client query received on control channel"
dispatch = { "publish" : self.serve_publish,
"withdraw" : self.serve_withdraw }
if self.action not in dispatch:
raise rpki.exceptions.BadQuery, "Unexpected query: action %s" % self.action
- client.check_allowed_uri(self.uri)
+ self.client.check_allowed_uri(self.uri)
dispatch[self.action]()
r_pdu = self.__class__()
r_pdu.action = self.action
@@ -267,7 +267,8 @@ class msg(rpki.xml_utils.msg, publication_namespace):
def loop(iterator, q_pdu):
q_pdu.gctx = gctx
- q_pdu.serve_dispatch(r_msg, client, iterator)
+ q_pdu.client = client
+ q_pdu.serve_dispatch(r_msg, iterator)
def done():
cb(r_msg)
diff --git a/rpkid/rpki/relaxng.py b/rpkid/rpki/relaxng.py
index c66d965a..0f2d2ab5 100644
--- a/rpkid/rpki/relaxng.py
+++ b/rpkid/rpki/relaxng.py
@@ -1697,3 +1697,4 @@ publication = lxml.etree.RelaxNG(lxml.etree.fromstring('''<?xml version="1.0" en
End:
-->
'''))
+
diff --git a/rpkid/rpki/rpki_engine.py b/rpkid/rpki/rpki_engine.py
index c373e856..d2b28abd 100644
--- a/rpkid/rpki/rpki_engine.py
+++ b/rpkid/rpki/rpki_engine.py
@@ -17,7 +17,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
"""
-import traceback, os, time, getopt, sys, MySQLdb, lxml.etree
+import traceback, lxml.etree
import rpki.resource_set, rpki.up_down, rpki.left_right, rpki.x509, rpki.sql
import rpki.https, rpki.config, rpki.exceptions, rpki.relaxng, rpki.log, rpki.async
@@ -217,7 +217,6 @@ class ca_obj(rpki.sql.sql_persistant):
information and the parent's up-down protocol list_response PDU.
"""
- repository = parent.repository()
sia_uri = rc.suggested_sia_head and rc.suggested_sia_head.rsync()
if not sia_uri or not sia_uri.startswith(parent.sia_base):
sia_uri = parent.sia_base
diff --git a/rpkid/rpki/sql.py b/rpkid/rpki/sql.py
index e9284539..6705e53b 100644
--- a/rpkid/rpki/sql.py
+++ b/rpkid/rpki/sql.py
@@ -17,7 +17,7 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
"""
-import MySQLdb, time, warnings, _mysql_exceptions
+import MySQLdb, warnings, _mysql_exceptions
import rpki.x509, rpki.resource_set, rpki.sundial, rpki.log
class session(object):
diff --git a/rpkid/rpki/up_down.py b/rpkid/rpki/up_down.py
index 15932c38..2d087b0d 100644
--- a/rpkid/rpki/up_down.py
+++ b/rpkid/rpki/up_down.py
@@ -21,7 +21,7 @@ import base64, lxml.etree, time
import rpki.resource_set, rpki.x509, rpki.exceptions
import rpki.xml_utils, rpki.relaxng
-xmlns="http://www.apnic.net/specs/rescerts/up-down/"
+xmlns = "http://www.apnic.net/specs/rescerts/up-down/"
nsmap = { None : xmlns }
@@ -242,9 +242,8 @@ class class_response_syntax(base_elt):
return [c.toXML() for c in self.classes]
class list_response_pdu(class_response_syntax):
- """Up-Down protocol "list_response" PDU."""
-
- pass
+ """Up-Down protocol "list_response" PDU."""
+ pass
class issue_pdu(base_elt):
"""Up-Down protocol "issue" PDU."""