aboutsummaryrefslogtreecommitdiff
path: root/rpkid/rpki/x509.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2010-11-10 04:12:22 +0000
committerRob Austein <sra@hactrn.net>2010-11-10 04:12:22 +0000
commit3d7748a4283d6bcc89f373307a6dba967f7faf32 (patch)
tree578ec271a07cb353b285590c05fb2ec25106b67c /rpkid/rpki/x509.py
parent78b47e58845c28f629a065133257ee9062d7021c (diff)
Fix handling of inheritance in EE certs
svn path=/rpkid/rootd.py; revision=3544
Diffstat (limited to 'rpkid/rpki/x509.py')
-rw-r--r--rpkid/rpki/x509.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/rpkid/rpki/x509.py b/rpkid/rpki/x509.py
index d013d247..61b5fef7 100644
--- a/rpkid/rpki/x509.py
+++ b/rpkid/rpki/x509.py
@@ -509,11 +509,17 @@ class X509(DER_object):
else:
assert not is_ca
- if resources is not None and resources.asn:
- exts.append(["sbgp-autonomousSysNum", True, (resources.asn.to_rfc3779_tuple(), None)])
-
- if resources is not None and (resources.v4 or resources.v6):
- exts.append(["sbgp-ipAddrBlock", True, [x for x in (resources.v4.to_rfc3779_tuple(), resources.v6.to_rfc3779_tuple()) if x is not None]])
+ # This next bit suggests that perhaps .to_rfc3779_tuple() should
+ # be raising an exception when there are no resources rather than
+ # returning None. Maybe refactor later.
+
+ if resources is not None:
+ r = resources.asn.to_rfc3779_tuple()
+ if r is not None:
+ exts.append(["sbgp-autonomousSysNum", True, (r, None)])
+ r = [x for x in (resources.v4.to_rfc3779_tuple(), resources.v6.to_rfc3779_tuple()) if x is not None]
+ if r:
+ exts.append(["sbgp-ipAddrBlock", True, r])
for x in exts:
x[0] = rpki.oids.name2oid[x[0]]