From c94a8ec50180f280a81259fa13a23eb3a45e087f Mon Sep 17 00:00:00 2001 From: Scott Cantor Date: Tue, 22 Nov 2011 19:57:50 +0000 Subject: [PATCH] https://issues.shibboleth.net/jira/browse/CPPOST-71 --- saml/saml1/core/impl/AssertionsImpl.cpp | 98 +++++++-------- saml/saml1/core/impl/ProtocolsImpl.cpp | 28 ++--- saml/saml2/core/impl/Assertions20Impl.cpp | 63 +++++----- saml/saml2/core/impl/Protocols20Impl.cpp | 138 ++++++++++----------- saml/saml2/metadata/impl/MetadataImpl.cpp | 195 +++++++++++++----------------- 5 files changed, 248 insertions(+), 274 deletions(-) diff --git a/saml/saml1/core/impl/AssertionsImpl.cpp b/saml/saml1/core/impl/AssertionsImpl.cpp index d741354..2e9d55f 100644 --- a/saml/saml1/core/impl/AssertionsImpl.cpp +++ b/saml/saml1/core/impl/AssertionsImpl.cpp @@ -136,6 +136,10 @@ namespace opensaml { public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller { + void init() { + m_NotBefore=m_NotOnOrAfter=nullptr; + } + public: virtual ~ConditionsImpl() { delete m_NotBefore; @@ -176,10 +180,6 @@ namespace opensaml { } } - void init() { - m_NotBefore=m_NotOnOrAfter=nullptr; - } - IMPL_XMLOBJECT_CLONE(Conditions); IMPL_DATETIME_ATTRIB(NotBefore,0); IMPL_DATETIME_ATTRIB(NotOnOrAfter,SAMLTIME_MAX); @@ -212,6 +212,10 @@ namespace opensaml { public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller { + void init() { + m_Format=m_NameQualifier=nullptr; + } + public: virtual ~NameIdentifierImpl() { XMLString::release(&m_Format); @@ -230,10 +234,6 @@ namespace opensaml { setNameQualifier(src.getNameQualifier()); } - void init() { - m_Format=m_NameQualifier=nullptr; - } - IMPL_XMLOBJECT_CLONE(NameIdentifier); IMPL_STRING_ATTRIB(Format); IMPL_STRING_ATTRIB(NameQualifier); @@ -271,6 +271,16 @@ namespace opensaml { public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller { + void init() { + m_SubjectConfirmationData=nullptr; + m_KeyInfo=nullptr; + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_pos_SubjectConfirmationData=m_children.begin(); + m_pos_KeyInfo=m_pos_SubjectConfirmationData; + ++m_pos_KeyInfo; + } + public: virtual ~SubjectConfirmationImpl() {} @@ -286,24 +296,13 @@ namespace opensaml { setSubjectConfirmationData(src.getSubjectConfirmationData()->clone()); if (src.getKeyInfo()) setKeyInfo(src.getKeyInfo()->cloneKeyInfo()); - VectorOf(ConfirmationMethod) v=getConfirmationMethods(); for (vector::const_iterator i=src.m_ConfirmationMethods.begin(); i!=src.m_ConfirmationMethods.end(); i++) { if (*i) { - v.push_back((*i)->cloneConfirmationMethod()); + getConfirmationMethods().push_back((*i)->cloneConfirmationMethod()); } } } - void init() { - m_SubjectConfirmationData=nullptr; - m_KeyInfo=nullptr; - m_children.push_back(nullptr); - m_children.push_back(nullptr); - m_pos_SubjectConfirmationData=m_children.begin(); - m_pos_KeyInfo=m_pos_SubjectConfirmationData; - ++m_pos_KeyInfo; - } - IMPL_XMLOBJECT_CLONE(SubjectConfirmation); IMPL_TYPED_CHILDREN(ConfirmationMethod,m_pos_SubjectConfirmationData); IMPL_XMLOBJECT_CHILD(SubjectConfirmationData); @@ -327,6 +326,16 @@ namespace opensaml { public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller { + void init() { + m_NameIdentifier=nullptr; + m_SubjectConfirmation=nullptr; + m_children.push_back(nullptr); + m_children.push_back(nullptr); + m_pos_NameIdentifier=m_children.begin(); + m_pos_SubjectConfirmation=m_pos_NameIdentifier; + ++m_pos_SubjectConfirmation; + } + public: virtual ~SubjectImpl() {} @@ -344,16 +353,6 @@ namespace opensaml { setSubjectConfirmation(src.getSubjectConfirmation()->cloneSubjectConfirmation()); } - void init() { - m_NameIdentifier=nullptr; - m_SubjectConfirmation=nullptr; - m_children.push_back(nullptr); - m_children.push_back(nullptr); - m_pos_NameIdentifier=m_children.begin(); - m_pos_SubjectConfirmation=m_pos_NameIdentifier; - ++m_pos_SubjectConfirmation; - } - IMPL_XMLOBJECT_CLONE(Subject); IMPL_TYPED_CHILD(NameIdentifier); IMPL_TYPED_CHILD(SubjectConfirmation); @@ -391,6 +390,7 @@ namespace opensaml { m_children.push_back(nullptr); m_pos_Subject=m_children.begin(); } + protected: SubjectStatementImpl() { init(); @@ -436,6 +436,10 @@ namespace opensaml { public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller { + void init() { + m_IPAddress=m_DNSAddress=nullptr; + } + public: virtual ~SubjectLocalityImpl() { XMLString::release(&m_IPAddress); @@ -454,10 +458,6 @@ namespace opensaml { setDNSAddress(src.getDNSAddress()); } - void init() { - m_IPAddress=m_DNSAddress=nullptr; - } - IMPL_XMLOBJECT_CLONE(SubjectLocality); IMPL_STRING_ATTRIB(IPAddress); IMPL_STRING_ATTRIB(DNSAddress); @@ -480,6 +480,11 @@ namespace opensaml { public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller { + void init() { + m_AuthorityKind=nullptr; + m_Location=m_Binding=nullptr; + } + public: virtual ~AuthorityBindingImpl() { delete m_AuthorityKind; @@ -500,11 +505,6 @@ namespace opensaml { setBinding(src.getBinding()); } - void init() { - m_AuthorityKind=nullptr; - m_Location=m_Binding=nullptr; - } - IMPL_XMLOBJECT_CLONE(AuthorityBinding); IMPL_XMLOBJECT_ATTRIB(AuthorityKind,xmltooling::QName); IMPL_STRING_ATTRIB(Location); @@ -556,10 +556,9 @@ namespace opensaml { setAuthenticationInstant(src.getAuthenticationInstant()); if (src.getSubjectLocality()) setSubjectLocality(src.getSubjectLocality()->cloneSubjectLocality()); - VectorOf(AuthorityBinding) v=getAuthorityBindings(); for (vector::const_iterator i=src.m_AuthorityBindings.begin(); i!=src.m_AuthorityBindings.end(); i++) { if (*i) { - v.push_back((*i)->cloneAuthorityBinding()); + getAuthorityBindings().push_back((*i)->cloneAuthorityBinding()); } } } @@ -605,7 +604,8 @@ namespace opensaml { : AbstractXMLObject(nsURI, localName, prefix, schemaType), m_Namespace(nullptr) { } - ActionImpl(const ActionImpl& src) : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) { + ActionImpl(const ActionImpl& src) + : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src), m_Namespace(nullptr) { setNamespace(src.getNamespace()); } @@ -700,10 +700,9 @@ namespace opensaml { setDecision(src.getDecision()); if (src.getEvidence()) setEvidence(src.getEvidence()->cloneEvidence()); - VectorOf(Action) v=getActions(); for (vector::const_iterator i=src.m_Actions.begin(); i!=src.m_Actions.end(); i++) { if (*i) { - v.push_back((*i)->cloneAction()); + getActions().push_back((*i)->cloneAction()); } } } @@ -803,10 +802,9 @@ namespace opensaml { init(); setAttributeName(src.getAttributeName()); setAttributeNamespace(src.getAttributeNamespace()); - VectorOf(XMLObject) v=getAttributeValues(); for (vector::const_iterator i=src.m_AttributeValues.begin(); i!=src.m_AttributeValues.end(); i++) { if (*i) { - v.push_back((*i)->clone()); + getAttributeValues().push_back((*i)->clone()); } } } @@ -860,10 +858,9 @@ namespace opensaml { void _clone(const AttributeStatementImpl& src) { SubjectStatementImpl::_clone(src); - VectorOf(Attribute) v=getAttributes(); for (vector::const_iterator i=src.m_Attributes.begin(); i!=src.m_Attributes.end(); i++) { if (*i) { - v.push_back((*i)->cloneAttribute()); + getAttributes().push_back((*i)->cloneAttribute()); } } } @@ -907,7 +904,9 @@ namespace opensaml { continue; } - getUnknownXMLObjects().push_back((*i)->clone()); + if (*i) { + getUnknownXMLObjects().push_back((*i)->clone()); + } } } } @@ -956,6 +955,7 @@ namespace opensaml { m_pos_Signature=m_pos_Advice; ++m_pos_Signature; } + public: virtual ~AssertionImpl() { XMLString::release(&m_MinorVersion); diff --git a/saml/saml1/core/impl/ProtocolsImpl.cpp b/saml/saml1/core/impl/ProtocolsImpl.cpp index 9911c18..67a86ec 100644 --- a/saml/saml1/core/impl/ProtocolsImpl.cpp +++ b/saml/saml1/core/impl/ProtocolsImpl.cpp @@ -235,10 +235,9 @@ namespace opensaml { void _clone(const AttributeQueryImpl& src) { SubjectQueryImpl::_clone(src); setResource(src.getResource()); - VectorOf(AttributeDesignator) v=getAttributeDesignators(); for (vector::const_iterator i=src.m_AttributeDesignators.begin(); i!=src.m_AttributeDesignators.end(); i++) { if (*i) { - v.push_back((*i)->cloneAttributeDesignator()); + getAttributeDesignators().push_back((*i)->cloneAttributeDesignator()); } } } @@ -293,10 +292,9 @@ namespace opensaml { setResource(src.getResource()); if (src.getEvidence()) setEvidence(src.getEvidence()->cloneEvidence()); - VectorOf(Action) v=getActions(); for (vector::const_iterator i=src.m_Actions.begin(); i!=src.m_Actions.end(); i++) { if (*i) { - v.push_back((*i)->cloneAction()); + getActions().push_back((*i)->cloneAction()); } } } @@ -370,10 +368,9 @@ namespace opensaml { setIssueInstant(src.getIssueInstant()); if (src.getSignature()) setSignature(src.getSignature()->cloneSignature()); - VectorOf(RespondWith) v=getRespondWiths(); for (vector::const_iterator i=src.m_RespondWiths.begin(); i!=src.m_RespondWiths.end(); i++) { if (*i) { - v.push_back((*i)->cloneRespondWith()); + getRespondWiths().push_back((*i)->cloneRespondWith()); } } } @@ -499,16 +496,14 @@ namespace opensaml { RequestAbstractTypeImpl::_clone(src); if (src.getQuery()) setQuery(src.getQuery()->cloneQuery()); - VectorOf(AssertionIDReference) v=getAssertionIDReferences(); for (vector::const_iterator i=src.m_AssertionIDReferences.begin(); i!=src.m_AssertionIDReferences.end(); i++) { if (*i) { - v.push_back((*i)->cloneAssertionIDReference()); + getAssertionIDReferences().push_back((*i)->cloneAssertionIDReference()); } } - VectorOf(AssertionArtifact) v2=getAssertionArtifacts(); for (vector::const_iterator i=src.m_AssertionArtifacts.begin(); i!=src.m_AssertionArtifacts.end(); i++) { if (*i) { - v2.push_back((*i)->cloneAssertionArtifact()); + getAssertionArtifacts().push_back((*i)->cloneAssertionArtifact()); } } } @@ -566,6 +561,7 @@ namespace opensaml { m_StatusCode=nullptr; m_pos_StatusCode=m_children.begin(); } + public: virtual ~StatusCodeImpl() { delete m_Value; @@ -618,9 +614,11 @@ namespace opensaml { StatusDetailImpl(const StatusDetailImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { - VectorOf(XMLObject) v=getUnknownXMLObjects(); - for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) - v.push_back((*i)->clone()); + for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) { + if (*i) { + getUnknownXMLObjects().push_back((*i)->clone()); + } + } } IMPL_XMLOBJECT_CLONE(StatusDetail); @@ -651,6 +649,7 @@ namespace opensaml { m_pos_StatusDetail=m_pos_StatusMessage; ++m_pos_StatusDetail; } + public: virtual ~StatusImpl() {} @@ -862,10 +861,9 @@ namespace opensaml { ResponseAbstractTypeImpl::_clone(src); if (src.getStatus()) setStatus(src.getStatus()->cloneStatus()); - VectorOf(saml1::Assertion) v=getAssertions(); for (vector::const_iterator i=src.m_Assertions.begin(); i!=src.m_Assertions.end(); i++) { if (*i) { - v.push_back((*i)->cloneAssertion()); + getAssertions().push_back((*i)->cloneAssertion()); } } } diff --git a/saml/saml2/core/impl/Assertions20Impl.cpp b/saml/saml2/core/impl/Assertions20Impl.cpp index a827715..e472d6d 100644 --- a/saml/saml2/core/impl/Assertions20Impl.cpp +++ b/saml/saml2/core/impl/Assertions20Impl.cpp @@ -197,10 +197,9 @@ namespace opensaml { void _clone(const EncryptedElementTypeImpl& src) { if (src.getEncryptedData()) setEncryptedData(src.getEncryptedData()->cloneEncryptedData()); - VectorOf(EncryptedKey) v=getEncryptedKeys(); for (vector::const_iterator i=src.m_EncryptedKeys.begin(); i!=src.m_EncryptedKeys.end(); i++) { if (*i) { - v.push_back((*i)->cloneEncryptedKey()); + getEncryptedKeys().push_back((*i)->cloneEncryptedKey()); } } } @@ -260,10 +259,9 @@ namespace opensaml { AudienceRestrictionImpl(const AudienceRestrictionImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { - VectorOf(Audience) v=getAudiences(); for (vector::const_iterator i=src.m_Audiences.begin(); i!=src.m_Audiences.end(); i++) { if (*i) { - v.push_back((*i)->cloneAudience()); + getAudiences().push_back((*i)->cloneAudience()); } } } @@ -310,17 +308,15 @@ namespace opensaml { } ProxyRestrictionImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) - : AbstractXMLObject(nsURI, localName, prefix, schemaType) { - m_Count=nullptr; + : AbstractXMLObject(nsURI, localName, prefix, schemaType), m_Count(nullptr) { } ProxyRestrictionImpl(const ProxyRestrictionImpl& src) - : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { + : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src), m_Count(nullptr) { setCount(src.m_Count); - VectorOf(Audience) v=getAudiences(); for (vector::const_iterator i=src.m_Audiences.begin(); i!=src.m_Audiences.end(); i++) { if (*i) { - v.push_back((*i)->cloneAudience()); + getAudiences().push_back((*i)->cloneAudience()); } } } @@ -366,6 +362,7 @@ namespace opensaml { m_pos_EncryptedID=m_pos_NameID; ++m_pos_EncryptedID; } + public: virtual ~DelegateImpl() { XMLString::release(&m_ConfirmationMethod); @@ -432,10 +429,9 @@ namespace opensaml { DelegationRestrictionTypeImpl(const DelegationRestrictionTypeImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { - VectorOf(Delegate) v=getDelegates(); for (vector::const_iterator i=src.m_Delegates.begin(); i!=src.m_Delegates.end(); i++) { if (*i) { - v.push_back((*i)->cloneDelegate()); + getDelegates().push_back((*i)->cloneDelegate()); } } } @@ -459,6 +455,7 @@ namespace opensaml { void init() { m_NotBefore=m_NotOnOrAfter=nullptr; } + public: virtual ~ConditionsImpl() { delete m_NotBefore; @@ -607,11 +604,11 @@ namespace opensaml { virtual ~SubjectConfirmationDataImpl() {} SubjectConfirmationDataImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) - : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { } SubjectConfirmationDataImpl(const SubjectConfirmationDataImpl& src) - : AbstractXMLObject(src), SubjectConfirmationDataTypeImpl(src), AnyElementImpl(src) { + : AbstractXMLObject(src), SubjectConfirmationDataTypeImpl(src), AnyElementImpl(src) { } void _clone(const SubjectConfirmationDataImpl& src) { @@ -675,19 +672,21 @@ namespace opensaml { virtual ~KeyInfoConfirmationDataTypeImpl() {} KeyInfoConfirmationDataTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) - : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { } KeyInfoConfirmationDataTypeImpl(const KeyInfoConfirmationDataTypeImpl& src) - : AbstractXMLObject(src), SubjectConfirmationDataTypeImpl(src), AbstractComplexElement(src), - AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) { + : AbstractXMLObject(src), SubjectConfirmationDataTypeImpl(src), AbstractComplexElement(src), + AbstractAttributeExtensibleXMLObject(src), AbstractDOMCachingXMLObject(src) { } void _clone(const KeyInfoConfirmationDataTypeImpl& src) { SubjectConfirmationDataTypeImpl::_clone(src); - VectorOf(KeyInfo) v=getKeyInfos(); - for (vector::const_iterator i=src.m_KeyInfos.begin(); i!=src.m_KeyInfos.end(); ++i) - v.push_back((*i)->cloneKeyInfo()); + for (vector::const_iterator i=src.m_KeyInfos.begin(); i!=src.m_KeyInfos.end(); ++i) { + if (*i) { + getKeyInfos().push_back((*i)->cloneKeyInfo()); + } + } } IMPL_XMLOBJECT_CLONE_EX(KeyInfoConfirmationDataType); @@ -760,6 +759,7 @@ namespace opensaml { m_pos_SubjectConfirmationData=m_pos_EncryptedID; ++m_pos_SubjectConfirmationData; } + public: virtual ~SubjectConfirmationImpl() { XMLString::release(&m_Method); @@ -829,6 +829,7 @@ namespace opensaml { m_pos_EncryptedID=m_pos_NameID; ++m_pos_EncryptedID; } + public: virtual ~SubjectImpl() {} @@ -846,10 +847,9 @@ namespace opensaml { setNameID(src.getNameID()->cloneNameID()); if (src.getEncryptedID()) setEncryptedID(src.getEncryptedID()->cloneEncryptedID()); - VectorOf(SubjectConfirmation) v=getSubjectConfirmations(); for (vector::const_iterator i=src.m_SubjectConfirmations.begin(); i!=src.m_SubjectConfirmations.end(); i++) { if (*i) { - v.push_back((*i)->cloneSubjectConfirmation()); + getSubjectConfirmations().push_back((*i)->cloneSubjectConfirmation()); } } } @@ -879,6 +879,7 @@ namespace opensaml { void init() { m_Address=m_DNSName=nullptr; } + public: virtual ~SubjectLocalityImpl() { XMLString::release(&m_Address); @@ -963,6 +964,7 @@ namespace opensaml { m_pos_AuthnContextDeclRef=m_pos_AuthnContextDecl; ++m_pos_AuthnContextDeclRef; } + public: virtual ~AuthnContextImpl() {} @@ -980,10 +982,9 @@ namespace opensaml { setAuthnContextDecl(src.getAuthnContextDecl()->clone()); if (src.getAuthnContextDeclRef()) setAuthnContextDeclRef(src.getAuthnContextDeclRef()->cloneAuthnContextDeclRef()); - VectorOf(AuthenticatingAuthority) v=getAuthenticatingAuthoritys(); for (vector::const_iterator i=src.m_AuthenticatingAuthoritys.begin(); i!=src.m_AuthenticatingAuthoritys.end(); i++) { if (*i) { - v.push_back((*i)->cloneAuthenticatingAuthority()); + getAuthenticatingAuthoritys().push_back((*i)->cloneAuthenticatingAuthority()); } } } @@ -1022,6 +1023,7 @@ namespace opensaml { m_pos_AuthnContext=m_pos_SubjectLocality; ++m_pos_AuthnContext; } + public: virtual ~AuthnStatementImpl() { delete m_AuthnInstant; @@ -1090,7 +1092,7 @@ namespace opensaml { } ActionImpl(const ActionImpl& src) - : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) { + : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src), m_Namespace(nullptr) { setNamespace(src.getNamespace()); } @@ -1181,6 +1183,7 @@ namespace opensaml { m_children.push_back(nullptr); m_pos_Evidence=m_children.begin(); } + public: virtual ~AuthzDecisionStatementImpl() { XMLString::release(&m_Resource); @@ -1199,10 +1202,9 @@ namespace opensaml { setDecision(src.getDecision()); if (src.getEvidence()) setEvidence(src.getEvidence()->cloneEvidence()); - VectorOf(Action) v=getActions(); for (vector::const_iterator i=src.m_Actions.begin(); i!=src.m_Actions.end(); i++) { if (*i) { - v.push_back((*i)->cloneAction()); + getActions().push_back((*i)->cloneAction()); } } } @@ -1258,6 +1260,7 @@ namespace opensaml { void init() { m_Name=m_NameFormat=m_FriendlyName=nullptr; } + public: virtual ~AttributeImpl() { XMLString::release(&m_Name); @@ -1277,10 +1280,9 @@ namespace opensaml { setName(src.getName()); setNameFormat(src.getNameFormat()); setFriendlyName(src.getFriendlyName()); - VectorOf(XMLObject) v=getAttributeValues(); for (vector::const_iterator i=src.m_AttributeValues.begin(); i!=src.m_AttributeValues.end(); i++) { if (*i) { - v.push_back((*i)->clone()); + getAttributeValues().push_back((*i)->clone()); } } } @@ -1425,7 +1427,9 @@ namespace opensaml { continue; } - getUnknownXMLObjects().push_back((*i)->clone()); + if (*i) { + getUnknownXMLObjects().push_back((*i)->clone()); + } } } } @@ -1499,6 +1503,7 @@ namespace opensaml { m_pos_Advice=m_pos_Conditions; ++m_pos_Advice; } + public: virtual ~AssertionImpl() { XMLString::release(&m_ID); diff --git a/saml/saml2/core/impl/Protocols20Impl.cpp b/saml/saml2/core/impl/Protocols20Impl.cpp index e663161..15c4a17 100644 --- a/saml/saml2/core/impl/Protocols20Impl.cpp +++ b/saml/saml2/core/impl/Protocols20Impl.cpp @@ -87,9 +87,11 @@ namespace opensaml { ExtensionsImpl(const ExtensionsImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { - VectorOf(XMLObject) v=getUnknownXMLObjects(); - for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) - v.push_back((*i)->clone()); + for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) { + if (*i) { + getUnknownXMLObjects().push_back((*i)->clone()); + } + } } IMPL_XMLOBJECT_CLONE(Extensions); @@ -120,14 +122,15 @@ namespace opensaml { m_children.push_back(nullptr); m_pos_StatusCode=m_children.begin(); } + public: virtual ~StatusCodeImpl() { XMLString::release(&m_Value); } StatusCodeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) - : AbstractXMLObject(nsURI, localName, prefix, schemaType) { - init(); + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + init(); } StatusCodeImpl(const StatusCodeImpl& src) @@ -174,9 +177,11 @@ namespace opensaml { StatusDetailImpl(const StatusDetailImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { - VectorOf(XMLObject) v=getUnknownXMLObjects(); - for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) - v.push_back((*i)->clone()); + for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) { + if (*i) { + getUnknownXMLObjects().push_back((*i)->clone()); + } + } } IMPL_XMLOBJECT_CLONE(StatusDetail); @@ -208,6 +213,7 @@ namespace opensaml { m_pos_StatusDetail=m_pos_StatusMessage; ++m_pos_StatusDetail; } + public: virtual ~StatusImpl() { } @@ -216,8 +222,7 @@ namespace opensaml { init(); } - StatusImpl(const StatusImpl& src) - : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { + StatusImpl(const StatusImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { init(); if (src.getStatusCode()) setStatusCode(src.getStatusCode()->cloneStatusCode()); @@ -266,10 +271,12 @@ namespace opensaml { m_pos_Extensions=m_pos_Signature; ++m_pos_Extensions; } + protected: RequestAbstractTypeImpl() { init(); } + public: virtual ~RequestAbstractTypeImpl() { XMLString::release(&m_ID); @@ -386,10 +393,9 @@ namespace opensaml { void _clone(const AssertionIDRequestImpl& src) { RequestAbstractTypeImpl::_clone(src); - VectorOf(AssertionIDRef) v=getAssertionIDRefs(); for (vector::const_iterator i=src.m_AssertionIDRefs.begin(); i!=src.m_AssertionIDRefs.end(); i++) { if (*i) { - v.push_back((*i)->cloneAssertionIDRef()); + getAssertionIDRefs().push_back((*i)->cloneAssertionIDRef()); } } } @@ -412,10 +418,12 @@ namespace opensaml { m_pos_Subject = m_pos_Extensions; ++m_pos_Subject; } + protected: SubjectQueryImpl() { init(); } + public: virtual ~SubjectQueryImpl() { } @@ -456,6 +464,7 @@ namespace opensaml { void init() { m_Comparison=nullptr; } + public: virtual ~RequestedAuthnContextImpl() { XMLString::release(&m_Comparison); @@ -519,6 +528,7 @@ namespace opensaml { ++m_pos_RequestedAuthnContext; } + public: virtual ~AuthnQueryImpl() { XMLString::release(&m_SessionIndex); @@ -601,9 +611,9 @@ namespace opensaml { m_Evidence=nullptr; m_children.push_back(nullptr); m_pos_Evidence=m_pos_Subject; - ++m_pos_Evidence; - + ++m_pos_Evidence; } + public: virtual ~AuthzDecisionQueryImpl() { XMLString::release(&m_Resource); @@ -667,17 +677,16 @@ namespace opensaml { m_SPNameQualifier=nullptr; m_AllowCreate=XML_BOOL_NULL; } + public: - virtual ~NameIDPolicyImpl() - { + virtual ~NameIDPolicyImpl() { XMLString::release(&m_Format); XMLString::release(&m_SPNameQualifier); } NameIDPolicyImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) - : AbstractXMLObject(nsURI, localName, prefix, schemaType) - { - init(); + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + init(); } NameIDPolicyImpl(const NameIDPolicyImpl& src) @@ -685,7 +694,7 @@ namespace opensaml { init(); setFormat(src.getFormat()); setSPNameQualifier(src.getSPNameQualifier()); - AllowCreate(m_AllowCreate); + AllowCreate(src.m_AllowCreate); } IMPL_XMLOBJECT_CLONE(NameIDPolicy); @@ -719,22 +728,20 @@ namespace opensaml { m_Name=nullptr; m_Loc=nullptr; } + public: - virtual ~IDPEntryImpl() - { + virtual ~IDPEntryImpl() { XMLString::release(&m_ProviderID); XMLString::release(&m_Name); XMLString::release(&m_Loc); } IDPEntryImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) - : AbstractXMLObject(nsURI, localName, prefix, schemaType) - { - init(); + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + init(); } - IDPEntryImpl(const IDPEntryImpl& src) - : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) { + IDPEntryImpl(const IDPEntryImpl& src) : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) { init(); setProviderID(src.getProviderID()); setName(src.getName()); @@ -771,14 +778,13 @@ namespace opensaml { m_GetComplete=nullptr; m_children.push_back(nullptr); m_pos_GetComplete=m_children.begin(); - } + public: virtual ~IDPListImpl() { } IDPListImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) - : AbstractXMLObject(nsURI, localName, prefix, schemaType) - { + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } @@ -787,13 +793,9 @@ namespace opensaml { init(); if (src.getGetComplete()) setGetComplete(src.getGetComplete()->cloneGetComplete()); - for (list::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) { + for (vector::const_iterator i=src.m_IDPEntrys.begin(); i!=src.m_IDPEntrys.end(); ++i) { if (*i) { - IDPEntry* entry=dynamic_cast(*i); - if (entry) { - getIDPEntrys().push_back(entry->cloneIDPEntry()); - continue; - } + getIDPEntrys().push_back((*i)->cloneIDPEntry()); } } } @@ -822,32 +824,27 @@ namespace opensaml { m_IDPList=nullptr; m_children.push_back(nullptr); m_pos_IDPList=m_children.begin(); - } + public: virtual ~ScopingImpl() { XMLString::release(&m_ProxyCount); } ScopingImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) - : AbstractXMLObject(nsURI, localName, prefix, schemaType) - { + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } ScopingImpl(const ScopingImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { init(); - setProxyCount(m_ProxyCount); + setProxyCount(src.m_ProxyCount); if (src.getIDPList()) setIDPList(src.getIDPList()->cloneIDPList()); - for (list::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) { + for (vector::const_iterator i=src.m_RequesterIDs.begin(); i!=src.m_RequesterIDs.end(); ++i) { if (*i) { - RequesterID* reqid =dynamic_cast(*i); - if (reqid) { - getRequesterIDs().push_back(reqid->cloneRequesterID()); - continue; - } + getRequesterIDs().push_back((*i)->cloneRequesterID()); } } } @@ -859,7 +856,7 @@ namespace opensaml { protected: void marshallAttributes(DOMElement* domElement) const { - MARSHALL_INTEGER_ATTRIB(ProxyCount,PROXYCOUNT,nullptr); + MARSHALL_INTEGER_ATTRIB(ProxyCount,PROXYCOUNT,nullptr); } void processChildElement(XMLObject* childXMLObject, const DOMElement* root) { @@ -905,8 +902,8 @@ namespace opensaml { ++m_pos_RequestedAuthnContext; m_pos_Scoping=m_pos_RequestedAuthnContext; ++m_pos_Scoping; - } + public: virtual ~AuthnRequestImpl() { XMLString::release(&m_ProtocolBinding); @@ -927,12 +924,12 @@ namespace opensaml { void _clone(const AuthnRequestImpl& src) { RequestAbstractTypeImpl::_clone(src); - ForceAuthn(m_ForceAuthn); - IsPassive(m_IsPassive); + ForceAuthn(src.m_ForceAuthn); + IsPassive(src.m_IsPassive); setProtocolBinding(src.getProtocolBinding()); - setAssertionConsumerServiceIndex(m_AssertionConsumerServiceIndex); + setAssertionConsumerServiceIndex(src.m_AssertionConsumerServiceIndex); setAssertionConsumerServiceURL(src.getAssertionConsumerServiceURL()); - setAttributeConsumingServiceIndex(m_AttributeConsumingServiceIndex); + setAttributeConsumingServiceIndex(src.m_AttributeConsumingServiceIndex); setProviderName(src.getProviderName()); if (src.getSubject()) setSubject(src.getSubject()->cloneSubject()); @@ -1023,10 +1020,12 @@ namespace opensaml { m_pos_Status=m_pos_Extensions; ++m_pos_Status; } + protected: StatusResponseTypeImpl() { init(); } + public: virtual ~StatusResponseTypeImpl() { XMLString::release(&m_ID); @@ -1038,7 +1037,7 @@ namespace opensaml { } StatusResponseTypeImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) - : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { init(); } @@ -1168,7 +1167,6 @@ namespace opensaml { } IMPL_XMLOBJECT_CLONE_EX(Response); - IMPL_TYPED_FOREIGN_CHILDREN(Assertion,saml2,m_children.end()); IMPL_TYPED_FOREIGN_CHILDREN(EncryptedAssertion,saml2,m_children.end()); @@ -1188,6 +1186,7 @@ namespace opensaml { m_pos_Artifact=m_pos_Extensions; ++m_pos_Artifact; } + public: virtual ~ArtifactResolveImpl() { } @@ -1224,6 +1223,7 @@ namespace opensaml { m_pos_Payload=m_pos_Status; ++m_pos_Payload; } + public: virtual ~ArtifactResponseImpl() { } @@ -1239,7 +1239,7 @@ namespace opensaml { void _clone(const ArtifactResponseImpl& src) { StatusResponseTypeImpl::_clone(src); if (src.getPayload()) - setPayload(getPayload()->clone()); + setPayload(src.getPayload()->clone()); } IMPL_XMLOBJECT_CLONE_EX(ArtifactResponse); @@ -1291,19 +1291,14 @@ namespace opensaml { init(); if (src.getEncryptedData()) setEncryptedData(src.getEncryptedData()->cloneEncryptedData()); - VectorOf(xmlencryption::EncryptedKey) v=getEncryptedKeys(); for (vector::const_iterator i=src.m_EncryptedKeys.begin(); i!=src.m_EncryptedKeys.end(); i++) { if (*i) { - v.push_back((*i)->cloneEncryptedKey()); + getEncryptedKeys().push_back((*i)->cloneEncryptedKey()); } } } - IMPL_XMLOBJECT_CLONE(NewEncryptedID); - EncryptedElementType* cloneEncryptedElementType() const { - return cloneNewEncryptedID(); - } - + IMPL_XMLOBJECT_CLONE2(NewEncryptedID,EncryptedElementType); IMPL_TYPED_FOREIGN_CHILD(EncryptedData,xmlencryption); IMPL_TYPED_FOREIGN_CHILDREN(EncryptedKey,xmlencryption,m_children.end()); @@ -1360,8 +1355,8 @@ namespace opensaml { ++m_pos_NewEncryptedID; m_pos_Terminate=m_pos_NewEncryptedID; ++m_pos_Terminate; - } + public: virtual ~ManageNameIDRequestImpl() { } @@ -1437,8 +1432,8 @@ namespace opensaml { ++m_pos_NameID; m_pos_EncryptedID=m_pos_NameID; ++m_pos_EncryptedID; - } + public: virtual ~LogoutRequestImpl() { XMLString::release(&m_Reason); @@ -1465,13 +1460,9 @@ namespace opensaml { if (src.getEncryptedID()) setEncryptedID(src.getEncryptedID()->cloneEncryptedID()); - for (list::const_iterator i=src.m_children.begin(); i!=src.m_children.end(); i++) { + for (vector::const_iterator i=src.m_SessionIndexs.begin(); i!=src.m_SessionIndexs.end(); ++i) { if (*i) { - SessionIndex* si = dynamic_cast(*i); - if (si) { - getSessionIndexs().push_back(si->cloneSessionIndex()); - continue; - } + getSessionIndexs().push_back((*i)->cloneSessionIndex()); } } } @@ -1539,8 +1530,8 @@ namespace opensaml { ++m_pos_EncryptedID; m_pos_NameIDPolicy=m_pos_EncryptedID; ++m_pos_NameIDPolicy; - } + public: virtual ~NameIDMappingRequestImpl() { } @@ -1593,6 +1584,7 @@ namespace opensaml { m_pos_EncryptedID=m_pos_NameID; ++m_pos_EncryptedID; } + public: virtual ~NameIDMappingResponseImpl() { } @@ -1608,9 +1600,9 @@ namespace opensaml { void _clone(const NameIDMappingResponseImpl& src) { StatusResponseTypeImpl::_clone(src); if (src.getNameID()) - setNameID(getNameID()->cloneNameID()); + setNameID(src.getNameID()->cloneNameID()); if (src.getEncryptedID()) - setEncryptedID(getEncryptedID()->cloneEncryptedID()); + setEncryptedID(src.getEncryptedID()->cloneEncryptedID()); } IMPL_XMLOBJECT_CLONE_EX(NameIDMappingResponse); diff --git a/saml/saml2/metadata/impl/MetadataImpl.cpp b/saml/saml2/metadata/impl/MetadataImpl.cpp index ecef5e3..be7815e 100644 --- a/saml/saml2/metadata/impl/MetadataImpl.cpp +++ b/saml/saml2/metadata/impl/MetadataImpl.cpp @@ -292,9 +292,11 @@ namespace opensaml { ExtensionsImpl(const ExtensionsImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { - VectorOf(XMLObject) v=getUnknownXMLObjects(); - for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) - v.push_back((*i)->clone()); + for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) { + if (*i) { + getUnknownXMLObjects().push_back((*i)->clone()); + } + } } IMPL_XMLOBJECT_CLONE(Extensions); @@ -334,6 +336,7 @@ namespace opensaml { m_pos_OrganizationURL=m_pos_OrganizationDisplayName; ++m_pos_OrganizationURL; } + public: virtual ~OrganizationImpl() {} @@ -348,22 +351,19 @@ namespace opensaml { init(); if (src.getExtensions()) setExtensions(src.getExtensions()->cloneExtensions()); - VectorOf(OrganizationName) v=getOrganizationNames(); for (vector::const_iterator i=src.m_OrganizationNames.begin(); i!=src.m_OrganizationNames.end(); i++) { if (*i) { - v.push_back((*i)->cloneOrganizationName()); + getOrganizationNames().push_back((*i)->cloneOrganizationName()); } } - VectorOf(OrganizationDisplayName) w=getOrganizationDisplayNames(); for (vector::const_iterator j=src.m_OrganizationDisplayNames.begin(); j!=src.m_OrganizationDisplayNames.end(); j++) { if (*j) { - w.push_back((*j)->cloneOrganizationDisplayName()); + getOrganizationDisplayNames().push_back((*j)->cloneOrganizationDisplayName()); } } - VectorOf(OrganizationURL) x=getOrganizationURLs(); for (vector::const_iterator k=src.m_OrganizationURLs.begin(); k!=src.m_OrganizationURLs.end(); k++) { if (*k) { - x.push_back((*k)->cloneOrganizationURL()); + getOrganizationURLs().push_back((*k)->cloneOrganizationURL()); } } } @@ -422,6 +422,7 @@ namespace opensaml { m_pos_TelephoneNumber=m_pos_SurName; ++m_pos_TelephoneNumber; } + public: virtual ~ContactPersonImpl() { XMLString::release(&m_ContactType); @@ -445,16 +446,14 @@ namespace opensaml { if (src.getSurName()) setSurName(src.getSurName()->cloneSurName()); - VectorOf(EmailAddress) v=getEmailAddresss(); for (vector::const_iterator i=src.m_EmailAddresss.begin(); i!=src.m_EmailAddresss.end(); i++) { if (*i) { - v.push_back((*i)->cloneEmailAddress()); + getEmailAddresss().push_back((*i)->cloneEmailAddress()); } } - VectorOf(TelephoneNumber) w=getTelephoneNumbers(); for (vector::const_iterator j=src.m_TelephoneNumbers.begin(); j!=src.m_TelephoneNumbers.end(); j++) { if (*j) { - w.push_back((*j)->cloneTelephoneNumber()); + getTelephoneNumbers().push_back((*j)->cloneTelephoneNumber()); } } } @@ -522,6 +521,7 @@ namespace opensaml { AdditionalMetadataLocationImpl(const AdditionalMetadataLocationImpl& src) : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) { init(); + setNamespace(src.getNamespace()); } IMPL_XMLOBJECT_CLONE(AdditionalMetadataLocation); @@ -550,6 +550,7 @@ namespace opensaml { m_children.push_back(nullptr); m_pos_KeyInfo=m_children.begin(); } + public: virtual ~KeyDescriptorImpl() { XMLString::release(&m_Use); @@ -566,10 +567,9 @@ namespace opensaml { setUse(src.getUse()); if (src.getKeyInfo()) setKeyInfo(src.getKeyInfo()->cloneKeyInfo()); - VectorOf(EncryptionMethod) v=getEncryptionMethods(); for (vector::const_iterator i=src.m_EncryptionMethods.begin(); i!=src.m_EncryptionMethods.end(); i++) { if (*i) { - v.push_back((*i)->cloneEncryptionMethod()); + getEncryptionMethods().push_back((*i)->cloneEncryptionMethod()); } } } @@ -636,9 +636,11 @@ namespace opensaml { setBinding(src.getBinding()); setLocation(src.getLocation()); setResponseLocation(src.getResponseLocation()); - VectorOf(XMLObject) v=getUnknownXMLObjects(); - for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) - v.push_back((*i)->clone()); + for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) { + if (*i) { + getUnknownXMLObjects().push_back((*i)->clone()); + } + } } IMPL_XMLOBJECT_CLONE_EX(EndpointType); @@ -941,16 +943,14 @@ namespace opensaml { if (src.getOrganization()) setOrganization(src.getOrganization()->cloneOrganization()); - VectorOf(KeyDescriptor) v=getKeyDescriptors(); for (vector::const_iterator i=src.m_KeyDescriptors.begin(); i!=src.m_KeyDescriptors.end(); i++) { if (*i) { - v.push_back((*i)->cloneKeyDescriptor()); + getKeyDescriptors().push_back((*i)->cloneKeyDescriptor()); } } - VectorOf(ContactPerson) w=getContactPersons(); for (vector::const_iterator j=src.m_ContactPersons.begin(); j!=src.m_ContactPersons.end(); j++) { if (*j) { - w.push_back((*j)->cloneContactPerson()); + getContactPersons().push_back((*j)->cloneContactPerson()); } } } @@ -1113,9 +1113,11 @@ namespace opensaml { void _clone(const RoleDescriptorTypeImpl& src) { RoleDescriptorImpl::_clone(src); - VectorOf(XMLObject) v=getUnknownXMLObjects(); - for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) - v.push_back((*i)->clone()); + for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) { + if (*i) { + getUnknownXMLObjects().push_back((*i)->clone()); + } + } } IMPL_XMLOBJECT_CLONE_EX(RoleDescriptorType); @@ -1168,28 +1170,24 @@ namespace opensaml { void _clone(const SSODescriptorTypeImpl& src) { RoleDescriptorImpl::_clone(src); - VectorOf(ArtifactResolutionService) v=getArtifactResolutionServices(); for (vector::const_iterator i=src.m_ArtifactResolutionServices.begin(); i!=src.m_ArtifactResolutionServices.end(); i++) { if (*i) { - v.push_back((*i)->cloneArtifactResolutionService()); + getArtifactResolutionServices().push_back((*i)->cloneArtifactResolutionService()); } } - VectorOf(SingleLogoutService) w=getSingleLogoutServices(); for (vector::const_iterator j=src.m_SingleLogoutServices.begin(); j!=src.m_SingleLogoutServices.end(); j++) { if (*j) { - w.push_back((*j)->cloneSingleLogoutService()); + getSingleLogoutServices().push_back((*j)->cloneSingleLogoutService()); } } - VectorOf(ManageNameIDService) x=getManageNameIDServices(); for (vector::const_iterator k=src.m_ManageNameIDServices.begin(); k!=src.m_ManageNameIDServices.end(); k++) { if (*k) { - x.push_back((*k)->cloneManageNameIDService()); + getManageNameIDServices().push_back((*k)->cloneManageNameIDService()); } } - VectorOf(NameIDFormat) y=getNameIDFormats(); for (vector::const_iterator m=src.m_NameIDFormats.begin(); m!=src.m_NameIDFormats.end(); m++) { if (*m) { - y.push_back((*m)->cloneNameIDFormat()); + getNameIDFormats().push_back((*m)->cloneNameIDFormat()); } } } @@ -1251,34 +1249,29 @@ namespace opensaml { void _clone(const IDPSSODescriptorImpl& src) { SSODescriptorTypeImpl::_clone(src); WantAuthnRequestsSigned(src.m_WantAuthnRequestsSigned); - VectorOf(SingleSignOnService) v=getSingleSignOnServices(); for (vector::const_iterator i=src.m_SingleSignOnServices.begin(); i!=src.m_SingleSignOnServices.end(); i++) { if (*i) { - v.push_back((*i)->cloneSingleSignOnService()); + getSingleSignOnServices().push_back((*i)->cloneSingleSignOnService()); } } - VectorOf(NameIDMappingService) w=getNameIDMappingServices(); for (vector::const_iterator j=src.m_NameIDMappingServices.begin(); j!=src.m_NameIDMappingServices.end(); j++) { if (*j) { - w.push_back((*j)->cloneNameIDMappingService()); + getNameIDMappingServices().push_back((*j)->cloneNameIDMappingService()); } } - VectorOf(AssertionIDRequestService) x=getAssertionIDRequestServices(); for (vector::const_iterator k=src.m_AssertionIDRequestServices.begin(); k!=src.m_AssertionIDRequestServices.end(); k++) { if (*k) { - x.push_back((*k)->cloneAssertionIDRequestService()); + getAssertionIDRequestServices().push_back((*k)->cloneAssertionIDRequestService()); } } - VectorOf(AttributeProfile) y=getAttributeProfiles(); for (vector::const_iterator m=src.m_AttributeProfiles.begin(); m!=src.m_AttributeProfiles.end(); m++) { if (*m) { - y.push_back((*m)->cloneAttributeProfile()); + getAttributeProfiles().push_back((*m)->cloneAttributeProfile()); } } - VectorOf(Attribute) z=getAttributes(); for (vector::const_iterator n=src.m_Attributes.begin(); n!=src.m_Attributes.end(); n++) { if (*n) { - z.push_back((*n)->cloneAttribute()); + getAttributes().push_back((*n)->cloneAttribute()); } } } @@ -1328,6 +1321,7 @@ namespace opensaml { m_Name=m_NameFormat=m_FriendlyName=nullptr; m_isRequired=XML_BOOL_NULL; } + public: virtual ~RequestedAttributeImpl() { XMLString::release(&m_Name); @@ -1348,10 +1342,9 @@ namespace opensaml { setNameFormat(src.getNameFormat()); setFriendlyName(src.getFriendlyName()); isRequired(src.m_isRequired); - VectorOf(XMLObject) v=getAttributeValues(); for (vector::const_iterator i=src.m_AttributeValues.begin(); i!=src.m_AttributeValues.end(); i++) { if (*i) { - v.push_back((*i)->clone()); + getAttributeValues().push_back((*i)->clone()); } } } @@ -1437,22 +1430,19 @@ namespace opensaml { init(); setIndex(src.m_Index); isDefault(src.m_isDefault); - VectorOf(ServiceName) v=getServiceNames(); for (vector::const_iterator i=src.m_ServiceNames.begin(); i!=src.m_ServiceNames.end(); i++) { if (*i) { - v.push_back((*i)->cloneServiceName()); + getServiceNames().push_back((*i)->cloneServiceName()); } } - VectorOf(ServiceDescription) w=getServiceDescriptions(); for (vector::const_iterator j=src.m_ServiceDescriptions.begin(); j!=src.m_ServiceDescriptions.end(); j++) { if (*j) { - w.push_back((*j)->cloneServiceDescription()); + getServiceDescriptions().push_back((*j)->cloneServiceDescription()); } } - VectorOf(RequestedAttribute) x=getRequestedAttributes(); for (vector::const_iterator k=src.m_RequestedAttributes.begin(); k!=src.m_RequestedAttributes.end(); k++) { if (*k) { - x.push_back((*k)->cloneRequestedAttribute()); + getRequestedAttributes().push_back((*k)->cloneRequestedAttribute()); } } } @@ -1512,16 +1502,14 @@ namespace opensaml { SSODescriptorTypeImpl::_clone(src); AuthnRequestsSigned(src.m_AuthnRequestsSigned); WantAssertionsSigned(src.m_WantAssertionsSigned); - VectorOf(AssertionConsumerService) v=getAssertionConsumerServices(); for (vector::const_iterator i=src.m_AssertionConsumerServices.begin(); i!=src.m_AssertionConsumerServices.end(); i++) { if (*i) { - v.push_back((*i)->cloneAssertionConsumerService()); + getAssertionConsumerServices().push_back((*i)->cloneAssertionConsumerService()); } } - VectorOf(AttributeConsumingService) w=getAttributeConsumingServices(); for (vector::const_iterator j=src.m_AttributeConsumingServices.begin(); j!=src.m_AttributeConsumingServices.end(); j++) { if (*j) { - w.push_back((*j)->cloneAttributeConsumingService()); + getAttributeConsumingServices().push_back((*j)->cloneAttributeConsumingService()); } } } @@ -1588,22 +1576,19 @@ namespace opensaml { void _clone(const AuthnAuthorityDescriptorImpl& src) { RoleDescriptorImpl::_clone(src); - VectorOf(AuthnQueryService) v=getAuthnQueryServices(); for (vector::const_iterator i=src.m_AuthnQueryServices.begin(); i!=src.m_AuthnQueryServices.end(); i++) { if (*i) { - v.push_back((*i)->cloneAuthnQueryService()); + getAuthnQueryServices().push_back((*i)->cloneAuthnQueryService()); } } - VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices(); for (vector::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) { if (*j) { - w.push_back((*j)->cloneAssertionIDRequestService()); + getAssertionIDRequestServices().push_back((*j)->cloneAssertionIDRequestService()); } } - VectorOf(NameIDFormat) x=getNameIDFormats(); for (vector::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) { if (*k) { - x.push_back((*k)->cloneNameIDFormat()); + getNameIDFormats().push_back((*k)->cloneNameIDFormat()); } } } @@ -1650,22 +1635,19 @@ namespace opensaml { void _clone(const PDPDescriptorImpl& src) { RoleDescriptorImpl::_clone(src); - VectorOf(AuthzService) v=getAuthzServices(); for (vector::const_iterator i=src.m_AuthzServices.begin(); i!=src.m_AuthzServices.end(); i++) { if (*i) { - v.push_back((*i)->cloneAuthzService()); + getAuthzServices().push_back((*i)->cloneAuthzService()); } } - VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices(); for (vector::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) { if (*j) { - w.push_back((*j)->cloneAssertionIDRequestService()); + getAssertionIDRequestServices().push_back((*j)->cloneAssertionIDRequestService()); } } - VectorOf(NameIDFormat) x=getNameIDFormats(); for (vector::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) { if (*k) { - x.push_back((*k)->cloneNameIDFormat()); + getNameIDFormats().push_back((*k)->cloneNameIDFormat()); } } } @@ -1720,34 +1702,29 @@ namespace opensaml { void _clone(const AttributeAuthorityDescriptorImpl& src) { RoleDescriptorImpl::_clone(src); - VectorOf(AttributeService) v=getAttributeServices(); for (vector::const_iterator i=src.m_AttributeServices.begin(); i!=src.m_AttributeServices.end(); i++) { if (*i) { - v.push_back((*i)->cloneAttributeService()); + getAttributeServices().push_back((*i)->cloneAttributeService()); } } - VectorOf(AssertionIDRequestService) w=getAssertionIDRequestServices(); for (vector::const_iterator j=src.m_AssertionIDRequestServices.begin(); j!=src.m_AssertionIDRequestServices.end(); j++) { if (*j) { - w.push_back((*j)->cloneAssertionIDRequestService()); + getAssertionIDRequestServices().push_back((*j)->cloneAssertionIDRequestService()); } } - VectorOf(NameIDFormat) x=getNameIDFormats(); for (vector::const_iterator k=src.m_NameIDFormats.begin(); k!=src.m_NameIDFormats.end(); k++) { if (*k) { - x.push_back((*k)->cloneNameIDFormat()); + getNameIDFormats().push_back((*k)->cloneNameIDFormat()); } } - VectorOf(AttributeProfile) y=getAttributeProfiles(); for (vector::const_iterator m=src.m_AttributeProfiles.begin(); m!=src.m_AttributeProfiles.end(); m++) { if (*m) { - y.push_back((*m)->cloneAttributeProfile()); + getAttributeProfiles().push_back((*m)->cloneAttributeProfile()); } } - VectorOf(Attribute) z=getAttributes(); for (vector::const_iterator n=src.m_Attributes.begin(); n!=src.m_Attributes.end(); n++) { if (*n) { - z.push_back((*n)->cloneAttribute()); + getAttributes().push_back((*n)->cloneAttribute()); } } } @@ -1801,10 +1778,9 @@ namespace opensaml { void _clone(const QueryDescriptorTypeImpl& src) { RoleDescriptorImpl::_clone(src); WantAssertionsSigned(src.m_WantAssertionsSigned); - VectorOf(NameIDFormat) y=getNameIDFormats(); for (vector::const_iterator m=src.m_NameIDFormats.begin(); m!=src.m_NameIDFormats.end(); m++) { if (*m) { - y.push_back((*m)->cloneNameIDFormat()); + getNameIDFormats().push_back((*m)->cloneNameIDFormat()); } } } @@ -1864,10 +1840,9 @@ namespace opensaml { void _clone(const AttributeQueryDescriptorTypeImpl& src) { QueryDescriptorTypeImpl::_clone(src); - VectorOf(AttributeConsumingService) w=getAttributeConsumingServices(); for (vector::const_iterator j=src.m_AttributeConsumingServices.begin(); j!=src.m_AttributeConsumingServices.end(); j++) { if (*j) { - w.push_back((*j)->cloneAttributeConsumingService()); + getAttributeConsumingServices().push_back((*j)->cloneAttributeConsumingService()); } } } @@ -1895,10 +1870,9 @@ namespace opensaml { void _clone(const AuthzDecisionQueryDescriptorTypeImpl& src) { QueryDescriptorTypeImpl::_clone(src); - VectorOf(ActionNamespace) w=getActionNamespaces(); for (vector::const_iterator j=src.m_ActionNamespaces.begin(); j!=src.m_ActionNamespaces.end(); j++) { if (*j) { - w.push_back((*j)->cloneActionNamespace()); + getActionNamespaces().push_back((*j)->cloneActionNamespace()); } } } @@ -1964,16 +1938,14 @@ namespace opensaml { if (src.getExtensions()) setExtensions(src.getExtensions()->cloneExtensions()); - VectorOf(KeyDescriptor) v=getKeyDescriptors(); for (vector::const_iterator i=src.m_KeyDescriptors.begin(); i!=src.m_KeyDescriptors.end(); i++) { if (*i) { - v.push_back((*i)->cloneKeyDescriptor()); + getKeyDescriptors().push_back((*i)->cloneKeyDescriptor()); } } - VectorOf(AffiliateMember) w=getAffiliateMembers(); for (vector::const_iterator j=src.m_AffiliateMembers.begin(); j!=src.m_AffiliateMembers.end(); j++) { if (*j) { - w.push_back((*j)->cloneAffiliateMember()); + getAffiliateMembers().push_back((*j)->cloneAffiliateMember()); } } } @@ -2177,16 +2149,14 @@ namespace opensaml { } } - VectorOf(ContactPerson) v=getContactPersons(); for (vector::const_iterator j=src.m_ContactPersons.begin(); j!=src.m_ContactPersons.end(); j++) { if (*j) { - v.push_back((*j)->cloneContactPerson()); + getContactPersons().push_back((*j)->cloneContactPerson()); } } - VectorOf(AdditionalMetadataLocation) w=getAdditionalMetadataLocations(); for (vector::const_iterator k=src.m_AdditionalMetadataLocations.begin(); k!=src.m_AdditionalMetadataLocations.end(); k++) { if (*k) { - w.push_back((*k)->cloneAdditionalMetadataLocation()); + getAdditionalMetadataLocations().push_back((*k)->cloneAdditionalMetadataLocation()); } } } @@ -2515,16 +2485,17 @@ namespace opensaml { } DigestMethodImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) - : AbstractXMLObject(nsURI, localName, prefix, schemaType) { - m_Algorithm = nullptr; + : AbstractXMLObject(nsURI, localName, prefix, schemaType), m_Algorithm(nullptr) { } DigestMethodImpl(const DigestMethodImpl& src) - : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { + : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src), m_Algorithm(nullptr) { setAlgorithm(src.getAlgorithm()); - VectorOf(XMLObject) v=getUnknownXMLObjects(); - for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) - v.push_back((*i)->clone()); + for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) { + if (*i) { + getUnknownXMLObjects().push_back((*i)->clone()); + } + } } IMPL_XMLOBJECT_CLONE(DigestMethod); @@ -2552,6 +2523,10 @@ namespace opensaml { public AbstractXMLObjectMarshaller, public AbstractXMLObjectUnmarshaller { + void init() { + m_Algorithm = m_MinKeySize = m_MaxKeySize = nullptr; + } + public: virtual ~SigningMethodImpl() { XMLString::release(&m_Algorithm); @@ -2560,20 +2535,21 @@ namespace opensaml { } SigningMethodImpl(const XMLCh* nsURI, const XMLCh* localName, const XMLCh* prefix, const xmltooling::QName* schemaType) - : AbstractXMLObject(nsURI, localName, prefix, schemaType) { - m_Algorithm = nullptr; - m_MinKeySize = nullptr; - m_MaxKeySize = nullptr; + : AbstractXMLObject(nsURI, localName, prefix, schemaType) { + init(); } SigningMethodImpl(const SigningMethodImpl& src) : AbstractXMLObject(src), AbstractComplexElement(src), AbstractDOMCachingXMLObject(src) { + init(); setAlgorithm(src.getAlgorithm()); setMinKeySize(src.m_MinKeySize); setMaxKeySize(src.m_MaxKeySize); - VectorOf(XMLObject) v=getUnknownXMLObjects(); - for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) - v.push_back((*i)->clone()); + for (vector::const_iterator i=src.m_UnknownXMLObjects.begin(); i!=src.m_UnknownXMLObjects.end(); ++i) { + if (*i) { + getUnknownXMLObjects().push_back((*i)->clone()); + } + } } IMPL_XMLOBJECT_CLONE(SigningMethod); @@ -2747,8 +2723,7 @@ namespace opensaml { init(); } - LogoImpl(const LogoImpl& src) - : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) { + LogoImpl(const LogoImpl& src) : AbstractXMLObject(src), AbstractSimpleElement(src), AbstractDOMCachingXMLObject(src) { init(); setLang(src.getLang()); if (src.m_LangPrefix) @@ -2844,7 +2819,9 @@ namespace opensaml { continue; } - getUnknownXMLObjects().push_back((*i)->clone()); + if (*i) { + getUnknownXMLObjects().push_back((*i)->clone()); + } } } } @@ -2913,7 +2890,9 @@ namespace opensaml { continue; } - getUnknownXMLObjects().push_back((*i)->clone()); + if (*i) { + getUnknownXMLObjects().push_back((*i)->clone()); + } } } } -- 2.1.4