diff options
author | Rob Austein <sra@hactrn.net> | 2010-02-24 01:31:33 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2010-02-24 01:31:33 +0000 |
commit | f7910efde4e2ea3e40b00dac0b80124ac7c22448 (patch) | |
tree | 13054596153dcd2b7d82d67871e6790a9a6fae03 /rpkid | |
parent | 2ecbf67ba206151a866a23f2861e0da26f393126 (diff) |
Checkpoint
svn path=/rpkid/rpki/async.py; revision=3006
Diffstat (limited to 'rpkid')
-rw-r--r-- | rpkid/rpki/async.py | 8 | ||||
-rw-r--r-- | rpkid/rpki/left_right.py | 5 | ||||
-rw-r--r-- | rpkid/rpki/x509.py | 33 |
3 files changed, 37 insertions, 9 deletions
diff --git a/rpkid/rpki/async.py b/rpkid/rpki/async.py index 603fa5be..23035442 100644 --- a/rpkid/rpki/async.py +++ b/rpkid/rpki/async.py @@ -323,11 +323,8 @@ class sync_wrapper(object): raise ExitNow def eb(self, err): - if True: - exc_info = sys.exc_info() - self.err = exc_info if exc_info[1] is err else err - else: - self.err = err + exc_info = sys.exc_info() + self.err = exc_info if exc_info[1] is err else err raise ExitNow def __call__(self, *args, **kwargs): @@ -343,7 +340,6 @@ class sync_wrapper(object): defer(thunk) event_loop() if self.err is not None: - #print "Raising self.err: %r" % (self.err,) if isinstance(self.err, tuple): raise self.err[0], self.err[1], self.err[2] else: diff --git a/rpkid/rpki/left_right.py b/rpkid/rpki/left_right.py index d8aca123..15c15c35 100644 --- a/rpkid/rpki/left_right.py +++ b/rpkid/rpki/left_right.py @@ -1018,7 +1018,6 @@ class list_received_resources_elt(rpki.xml_utils.base_elt, left_right_namespace) ca_detail = ca.fetch_active() if ca_detail is not None and ca_detail.latest_ca_cert is not None: r_msg.append(self.make_reply(ca_detail.ca_cert_uri, ca_detail.latest_ca_cert)) - #rpki.log.debug("Generated: %r" % r_msg[-1]) cb() def make_reply(self, uri, cert): @@ -1032,8 +1031,8 @@ class list_received_resources_elt(rpki.xml_utils.base_elt, left_right_namespace) notBefore = str(cert.getNotBefore()), notAfter = str(cert.getNotAfter()), uri = uri, - sia_uri = cert.get_SIA(), - aia_uri = cert.get_AIA(), + sia_uri = cert.get_sia_directory_uri(), + aia_uri = cert.get_aia_uri(), asn = resources.asn, ipv4 = resources.v4, ipv6 = resources.v6) diff --git a/rpkid/rpki/x509.py b/rpkid/rpki/x509.py index 85f04c73..3cf9739a 100644 --- a/rpkid/rpki/x509.py +++ b/rpkid/rpki/x509.py @@ -102,6 +102,18 @@ class PEM_converter(object): b64 = b64[64:] return pem + b64 + "\n" + self.e + "\n" +def _find_xia_uri(extension, name): + """ + Find a rsync URI in an SIA or AIA extension. + Returns the URI if found, otherwise None. + """ + oid = rpki.oids.name2oid[name] + + for method, location in extension: + if method == oid and location[0] == "uri" and location[1].startswith("rsync://"): + return location[1] + return None + class DER_object(object): """ Virtual class to hold a generic DER object. @@ -262,6 +274,20 @@ class DER_object(object): """ return (self.get_POWpkix().getExtension(rpki.oids.name2oid["subjectInfoAccess"]) or ((), 0, None))[2] + def get_sia_directory_uri(self): + """ + Get SIA directory (id-ad-caRepository) URI from this object. + Only works for subclasses that support getExtension(). + """ + return _find_xia_uri(self.get_SIA(), "id-ad-caRepository") + + def get_sia_manifest_uri(self): + """ + Get SIA manifest (id-ad-rpkiManifest) URI from this object. + Only works for subclasses that support getExtension(). + """ + return _find_xia_uri(self.get_SIA(), "id-ad-rpkiManifest") + def get_AIA(self): """ Get the SIA extension from this object. Only works for subclasses @@ -269,6 +295,13 @@ class DER_object(object): """ return (self.get_POWpkix().getExtension(rpki.oids.name2oid["authorityInfoAccess"]) or ((), 0, None))[2] + def get_aia_uri(self): + """ + Get AIA (id-ad-caIssuers) URI from this object. + Only works for subclasses that support getExtension(). + """ + return _find_xia_uri(self.get_AIA(), "id-ad-caIssuers") + def get_basicConstraints(self): """ Get the basicConstraints extension from this object. Only works |