Handle 32-bit time size
[shibboleth/cpp-opensaml.git] / saml / saml2 / metadata / impl / MetadataImpl.cpp
index 23cd26d..a88ae51 100644 (file)
@@ -249,7 +249,7 @@ namespace opensaml {
             }
                 
             ExtensionsImpl(const ExtensionsImpl& src)
-                    : AbstractXMLObject(src), AbstractDOMCachingXMLObject(src), AbstractElementProxy(src) {
+                    : AbstractXMLObject(src), AbstractElementProxy(src), AbstractDOMCachingXMLObject(src) {
                 for (list<XMLObject*>::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) {
                     if (*i) {
                         getXMLObjects().push_back((*i)->clone());
@@ -986,7 +986,7 @@ namespace opensaml {
             IMPL_STRING_ATTRIB(ID);
             IMPL_STRING_ATTRIB(ProtocolSupportEnumeration);
             IMPL_STRING_ATTRIB(ErrorURL);
-            IMPL_DATETIME_ATTRIB(ValidUntil,LLONG_MAX);
+            IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
             IMPL_DATETIME_ATTRIB(CacheDuration,0);
             IMPL_TYPED_CHILD(Extensions);
             IMPL_TYPED_CHILDREN(KeyDescriptor,m_pos_Organization);
@@ -1005,10 +1005,10 @@ namespace opensaml {
                             // See if rest of protocol string is present.
                             if (0==XMLString::compareNString(m_ProtocolSupportEnumeration+index+1,protocol+1,len-1)) {
                                 // Only possible match is if it's the last character or a space comes after it.
-                                if (m_ProtocolSupportEnumeration[index+len+1]==chNull || m_ProtocolSupportEnumeration[index+len+1]==chSpace)
+                                if (m_ProtocolSupportEnumeration[index+len]==chNull || m_ProtocolSupportEnumeration[index+len]==chSpace)
                                     return true;
                                 else
-                                    pos=index+len+1;
+                                    pos=index+len;
                             }
                             else {
                                 // Move past last search and start again.
@@ -1828,7 +1828,7 @@ namespace opensaml {
             
             IMPL_STRING_ATTRIB(ID);
             IMPL_STRING_ATTRIB(AffiliationOwnerID);
-            IMPL_DATETIME_ATTRIB(ValidUntil,LLONG_MAX);
+            IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
             IMPL_DATETIME_ATTRIB(CacheDuration,0);
             IMPL_TYPED_CHILD(Extensions);
             IMPL_TYPED_CHILDREN(AffiliateMember,m_pos_AffiliateMember);
@@ -2030,7 +2030,7 @@ namespace opensaml {
             
             IMPL_STRING_ATTRIB(ID);
             IMPL_STRING_ATTRIB(EntityID);
-            IMPL_DATETIME_ATTRIB(ValidUntil,LLONG_MAX);
+            IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
             IMPL_DATETIME_ATTRIB(CacheDuration,0);
             IMPL_TYPED_CHILD(Extensions);
             IMPL_TYPED_CHILDREN(RoleDescriptor,m_pos_AffiliationDescriptor);
@@ -2066,6 +2066,54 @@ namespace opensaml {
                 AbstractAttributeExtensibleXMLObject::setAttribute(qualifiedName, value);
             }
 
+            const IDPSSODescriptor* getIDPSSODescriptor(const XMLCh* protocol) const {
+                for (vector<IDPSSODescriptor*>::const_iterator i=m_IDPSSODescriptors.begin(); i!=m_IDPSSODescriptors.end(); i++) {
+                    if ((*i)->hasSupport(protocol) && (*i)->isValid())
+                        return (*i);
+                }
+                return NULL;
+            }
+            
+            const SPSSODescriptor* getSPSSODescriptor(const XMLCh* protocol) const {
+                for (vector<SPSSODescriptor*>::const_iterator i=m_SPSSODescriptors.begin(); i!=m_SPSSODescriptors.end(); i++) {
+                    if ((*i)->hasSupport(protocol) && (*i)->isValid())
+                        return (*i);
+                }
+                return NULL;
+            }
+            
+            const AuthnAuthorityDescriptor* getAuthnAuthorityDescriptor(const XMLCh* protocol) const {
+                for (vector<AuthnAuthorityDescriptor*>::const_iterator i=m_AuthnAuthorityDescriptors.begin(); i!=m_AuthnAuthorityDescriptors.end(); i++) {
+                    if ((*i)->hasSupport(protocol) && (*i)->isValid())
+                        return (*i);
+                }
+                return NULL;
+            }
+            
+            const AttributeAuthorityDescriptor* getAttributeAuthorityDescriptor(const XMLCh* protocol) const {
+                for (vector<AttributeAuthorityDescriptor*>::const_iterator i=m_AttributeAuthorityDescriptors.begin(); i!=m_AttributeAuthorityDescriptors.end(); i++) {
+                    if ((*i)->hasSupport(protocol) && (*i)->isValid())
+                        return (*i);
+                }
+                return NULL;
+            }
+            
+            const PDPDescriptor* getPDPDescriptor(const XMLCh* protocol) const {
+                for (vector<PDPDescriptor*>::const_iterator i=m_PDPDescriptors.begin(); i!=m_PDPDescriptors.end(); i++) {
+                    if ((*i)->hasSupport(protocol) && (*i)->isValid())
+                        return (*i);
+                }
+                return NULL;
+            }
+            
+            const RoleDescriptor* getRoleDescriptor(xmltooling::QName& qname, const XMLCh* protocol) const {
+                for (vector<RoleDescriptor*>::const_iterator i=m_RoleDescriptors.begin(); i!=m_RoleDescriptors.end(); i++) {
+                    if ((*i)->getSchemaType() && qname==(*((*i)->getSchemaType())) && (*i)->hasSupport(protocol) && (*i)->isValid())
+                        return (*i);
+                }
+                return NULL;
+            }
+
         protected:
             void marshallAttributes(DOMElement* domElement) const {
                 MARSHALL_ID_ATTRIB(ID,ID,NULL);
@@ -2192,7 +2240,7 @@ namespace opensaml {
             
             IMPL_STRING_ATTRIB(ID);
             IMPL_STRING_ATTRIB(Name);
-            IMPL_DATETIME_ATTRIB(ValidUntil,LLONG_MAX);
+            IMPL_DATETIME_ATTRIB(ValidUntil,SAMLTIME_MAX);
             IMPL_DATETIME_ATTRIB(CacheDuration,0);
             IMPL_TYPED_CHILD(Extensions);
             IMPL_TYPED_CHILDREN(EntityDescriptor,m_children.end());