From: Scott Cantor Date: Wed, 12 Apr 2006 03:34:40 +0000 (+0000) Subject: Log error when user used as Alias. X-Git-Tag: 2.0-alpha1~215 X-Git-Url: http://www.project-moonshot.org/gitweb/?a=commitdiff_plain;h=89fcea02330655386679babbdddc5517423856d4;p=shibboleth%2Fcpp-sp.git Log error when user used as Alias. --- diff --git a/xmlproviders/XMLAAP.cpp b/xmlproviders/XMLAAP.cpp index c492d0d..9d2a27b 100644 --- a/xmlproviders/XMLAAP.cpp +++ b/xmlproviders/XMLAAP.cpp @@ -26,8 +26,8 @@ #include #include -using namespace saml; using namespace shibboleth; +using namespace saml; using namespace log4cpp; using namespace std; @@ -163,7 +163,7 @@ void XMLAAPImpl::init() // Loop over the AttributeRule elements. DOMNodeList* nlist = m_root->getElementsByTagNameNS(::XML::SHIB_NS,SHIB_L(AttributeRule)); - for (unsigned int i=0; nlist && igetLength(); i++) + for (XMLSize_t i=0; nlist && igetLength(); i++) { AttributeRule* rule=new AttributeRule(static_cast(nlist->item(i))); #ifdef HAVE_GOOD_STL @@ -183,8 +183,12 @@ void XMLAAPImpl::init() #endif m_attrMap[key]=rule; m_attrs.push_back(rule); - if (rule->getAlias()) - m_aliasMap[rule->getAlias()]=rule; + if (rule->getAlias()) { + if (!strcmp(rule->getAlias(),"user")) + m_aliasMap[rule->getAlias()]=rule; + else + log.error(" cannot specify Alias of 'user', please use alternate value"); + } } } catch (SAMLException& e) @@ -235,7 +239,7 @@ XMLAAPImpl::AttributeRule::AttributeRule(const DOMElement* e) : { // Process Scope elements. DOMNodeList* vlist = static_cast(anysite)->getElementsByTagNameNS(::XML::SHIB_NS,SHIB_L(Scope)); - for (unsigned int i=0; vlist && igetLength(); i++) + for (XMLSize_t i=0; vlist && igetLength(); i++) { m_scoped=true; DOMElement* se=static_cast(vlist->item(i)); @@ -260,7 +264,7 @@ XMLAAPImpl::AttributeRule::AttributeRule(const DOMElement* e) : { // Process each Value element. vlist = static_cast(anysite)->getElementsByTagNameNS(::XML::SHIB_NS,SHIB_L(Value)); - for (unsigned int j=0; vlist && jgetLength(); j++) + for (XMLSize_t j=0; vlist && jgetLength(); j++) { DOMElement* ve=static_cast(vlist->item(j)); DOMNode* valnode=ve->getFirstChild(); @@ -277,7 +281,7 @@ XMLAAPImpl::AttributeRule::AttributeRule(const DOMElement* e) : // Loop over the SiteRule elements. DOMNodeList* slist = e->getElementsByTagNameNS(::XML::SHIB_NS,SHIB_L(SiteRule)); - for (unsigned int k=0; slist && kgetLength(); k++) + for (XMLSize_t k=0; slist && kgetLength(); k++) { const XMLCh* srulename=static_cast(slist->item(k))->getAttributeNS(NULL,SHIB_L(Name)); #ifdef HAVE_GOOD_STL @@ -291,7 +295,7 @@ XMLAAPImpl::AttributeRule::AttributeRule(const DOMElement* e) : // Process Scope elements. DOMNodeList* vlist = static_cast(slist->item(k))->getElementsByTagNameNS(::XML::SHIB_NS,SHIB_L(Scope)); - for (unsigned int i=0; vlist && igetLength(); i++) + for (XMLSize_t i=0; vlist && igetLength(); i++) { m_scoped=true; DOMElement* se=static_cast(vlist->item(i)); @@ -316,7 +320,7 @@ XMLAAPImpl::AttributeRule::AttributeRule(const DOMElement* e) : { // Process each Value element. vlist = static_cast(slist->item(k))->getElementsByTagNameNS(::XML::SHIB_NS,SHIB_L(Value)); - for (unsigned int j=0; vlist && jgetLength(); j++) + for (XMLSize_t j=0; vlist && jgetLength(); j++) { DOMElement* ve=static_cast(vlist->item(j)); DOMNode* valnode=ve->getFirstChild(); @@ -601,7 +605,7 @@ void XMLAAPImpl::AttributeRule::apply(SAMLAttribute& attribute, const IEntityDes // Check each value. DOMNodeList* vals=attribute.getValueElements(); int i2=0; - for (unsigned int i=0; vals && i < vals->getLength(); i++) { + for (XMLSize_t i=0; vals && i < vals->getLength(); i++) { if (!accept(static_cast(vals->item(i)),source ? dynamic_cast(source) : NULL)) attribute.removeValue(i2); else