From: Tony Mack Date: Mon, 15 Aug 2011 22:47:47 +0000 (-0400) Subject: CA certs are only given to objects of type authority X-Git-Tag: sfa-1.0-30 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=refs%2Ftags%2Fsfa-1.0-30;p=sfa.git CA certs are only given to objects of type authority --- diff --git a/sfa/trust/hierarchy.py b/sfa/trust/hierarchy.py index f28329ce..89bebcc6 100644 --- a/sfa/trust/hierarchy.py +++ b/sfa/trust/hierarchy.py @@ -231,13 +231,19 @@ class Hierarchy: def create_gid(self, xrn, uuid, pkey): hrn, type = urn_to_hrn(xrn) + parent_hrn = get_authority(hrn) # Using hrn_to_urn() here to make sure the urn is in the right format # If xrn was a hrn instead of a urn, then the gid's urn will be # of type None urn = hrn_to_urn(hrn, type) gid = GID(subject=hrn, uuid=uuid, hrn=hrn, urn=urn) - parent_hrn = get_authority(hrn) + # is this a CA cert + if hrn == self.config.SFA_INTERFACE_HRN or \ + or not parent_hrn or 'authority' in type: + gid.set_intermediate_ca(True) + + # set issuer if not parent_hrn or hrn == self.config.SFA_INTERFACE_HRN: # if there is no parent hrn, then it must be self-signed. this # is where we terminate the recursion @@ -247,7 +253,6 @@ class Hierarchy: parent_auth_info = self.get_auth_info(parent_hrn) gid.set_issuer(parent_auth_info.get_pkey_object(), parent_auth_info.hrn) gid.set_parent(parent_auth_info.get_gid_object()) - gid.set_intermediate_ca(True) gid.set_pubkey(pkey) gid.encode()