diff options
author | Rob Austein <sra@hactrn.net> | 2009-08-31 22:24:48 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2009-08-31 22:24:48 +0000 |
commit | 1b65eb039f50792d7479cbfbd196f29ff89c7c4d (patch) | |
tree | c17808904c99f3783e4feefc39448584d2c596da /rpkid | |
parent | f6be347c09042f59b8042083f5009cb98496fbb7 (diff) |
Changes to support structured pubd client names.
svn path=/myrpki/myirbe.py; revision=2722
Diffstat (limited to 'rpkid')
-rwxr-xr-x | rpkid/pubd.py | 2 | ||||
-rw-r--r-- | rpkid/publication-schema.rnc | 6 | ||||
-rw-r--r-- | rpkid/publication-schema.rng | 8 | ||||
-rw-r--r-- | rpkid/rpki/relaxng.py | 8 | ||||
-rw-r--r-- | rpkid/testbed.py | 8 |
5 files changed, 23 insertions, 9 deletions
diff --git a/rpkid/pubd.py b/rpkid/pubd.py index e772acad..ec6f3fcf 100755 --- a/rpkid/pubd.py +++ b/rpkid/pubd.py @@ -93,7 +93,7 @@ class pubd_context(object): rpki.log.traceback() cb(500, "Unhandled exception %s" % data) - client_url_regexp = re.compile("/client/([-A-Z0-9_]+)$", re.I) + client_url_regexp = re.compile("/client/([-A-Z0-9_/]+)$", re.I) def client_handler(self, query, path, cb): """ diff --git a/rpkid/publication-schema.rnc b/rpkid/publication-schema.rnc index 6cbcf7d0..2b92e239 100644 --- a/rpkid/publication-schema.rnc +++ b/rpkid/publication-schema.rnc @@ -31,8 +31,10 @@ base64 = xsd:base64Binary { maxLength="512000" } uri_t = xsd:anyURI { maxLength="4096" } uri = attribute uri { uri_t } -# Handles on remote objects (replaces passing raw SQL IDs) -object_handle = xsd:string { maxLength="255" pattern="[\-_A-Za-z0-9]*" } +# Handles on remote objects (replaces passing raw SQL IDs). NB: +# Unlike the up-down protocol, handles in this protocol allow "/" as a +# hierarchy delimiter. +object_handle = xsd:string { maxLength="255" pattern="[\-_A-Za-z0-9/]*" } # <config/> element (use restricted to repository operator) # config_handle attribute, create, list, and destroy commands omitted deliberately, see code for details diff --git a/rpkid/publication-schema.rng b/rpkid/publication-schema.rng index 5bc8a275..f1e87e2f 100644 --- a/rpkid/publication-schema.rng +++ b/rpkid/publication-schema.rng @@ -84,11 +84,15 @@ <ref name="uri_t"/> </attribute> </define> - <!-- Handles on remote objects (replaces passing raw SQL IDs) --> + <!-- + Handles on remote objects (replaces passing raw SQL IDs). NB: + Unlike the up-down protocol, handles in this protocol allow "/" as a + hierarchy delimiter. + --> <define name="object_handle"> <data type="string"> <param name="maxLength">255</param> - <param name="pattern">[\-_A-Za-z0-9]*</param> + <param name="pattern">[\-_A-Za-z0-9/]*</param> </data> </define> <!-- diff --git a/rpkid/rpki/relaxng.py b/rpkid/rpki/relaxng.py index 83fa739a..099c3da1 100644 --- a/rpkid/rpki/relaxng.py +++ b/rpkid/rpki/relaxng.py @@ -1231,11 +1231,15 @@ publication = lxml.etree.RelaxNG(lxml.etree.fromstring('''<?xml version="1.0" en <ref name="uri_t"/> </attribute> </define> - <!-- Handles on remote objects (replaces passing raw SQL IDs) --> + <!-- + Handles on remote objects (replaces passing raw SQL IDs). NB: + Unlike the up-down protocol, handles in this protocol allow "/" as a + hierarchy delimiter. + --> <define name="object_handle"> <data type="string"> <param name="maxLength">255</param> - <param name="pattern">[\-_A-Za-z0-9]*</param> + <param name="pattern">[\-_A-Za-z0-9/]*</param> </data> </define> <!-- diff --git a/rpkid/testbed.py b/rpkid/testbed.py index c61fb4de..b76e9499 100644 --- a/rpkid/testbed.py +++ b/rpkid/testbed.py @@ -387,6 +387,10 @@ class allocation_db(list): a.crl_interval = a.parent.crl_interval if a.regen_margin is None: a.regen_margin = a.parent.regen_margin + i = 0 + for j in xrange(4): + i = a.sia_base.index("/", i) + 1 + a.client_handle = a.sia_base[i:].rstrip("/") self.root.closure() self.map = dict((a.name, a) for a in self) self.engines = [a for a in self if a.is_engine()] @@ -871,7 +875,7 @@ class allocation(object): pubd_pdus.append(rpki.publication.client_elt.make_pdu( action = "create", - client_handle = s.name, + client_handle = s.client_handle, base_uri = s.sia_base, bpki_cert = s.cross_certify(pubd_name + "-TA", reverse = True))) @@ -884,7 +888,7 @@ class allocation(object): repository_handle = "r", bpki_cms_cert = repository_cert, bpki_https_cert = repository_cert, - peer_contact_uri = "https://localhost:%d/client/%s" % (pubd_port, s.name))) + peer_contact_uri = "https://localhost:%d/client/%s" % (pubd_port, s.client_handle))) for k in s.kids: rpkid_pdus.append(rpki.left_right.child_elt.make_pdu( |