string vals_str(vals);
int j = 0;
- for (int i = 0; i < vals_str.length(); i++) {
+ for (unsigned int i = 0; i < vals_str.length(); i++) {
if (vals_str.at(i) == ';') {
if (i == 0) {
st->log(ShibTarget::LogLevelError, string("htAccessControl plugin found invalid header encoding (") +
if (p.get()) m_port=p.get();
if (p2.get()) m_sslport=p2.get();
DOMNodeList* nlist=e->getElementsByTagNameNS(shibtarget::XML::SHIBTARGET_NS,Alias);
- for (int i=0; nlist && i<nlist->getLength(); i++) {
+ for (unsigned int i=0; nlist && i<nlist->getLength(); i++) {
if (nlist->item(i)->hasChildNodes()) {
auto_ptr_char alias(nlist->item(i)->getFirstChild()->getNodeValue());
m_aliases.insert(alias.get());
const string& content_type="text/html",
const Iterator<header_t>& headers=EMPTY(header_t)) {
string hdr = string ("Connection: close\r\nContent-type: ") + content_type + "\r\n";
- for (int k = 0; k < headers.size(); k++) {
+ for (unsigned int k = 0; k < headers.size(); k++) {
hdr += headers[k].first + ": " + headers[k].second + "\r\n";
}
hdr += "\r\n";
// Handle nested Paths.
DOMNodeList* nlist=e->getElementsByTagNameNS(shibtarget::XML::SHIBTARGET_NS,SHIBT_L(Path));
- for (int i=0; nlist && i<nlist->getLength(); i++) {
+ for (unsigned int i=0; nlist && i<nlist->getLength(); i++) {
DOMElement* path=static_cast<DOMElement*>(nlist->item(i));
const XMLCh* n=path->getAttributeNS(NULL,SHIBT_L(name));
if (!n || !*n) {
// Loop over the Host elements.
DOMNodeList* nlist = ReloadableXMLFileImpl::m_root->getElementsByTagNameNS(shibtarget::XML::SHIBTARGET_NS,SHIBT_L(Host));
- for (int i=0; nlist && i<nlist->getLength(); i++) {
+ for (unsigned int i=0; nlist && i<nlist->getLength(); i++) {
DOMElement* host=static_cast<DOMElement*>(nlist->item(i));
const XMLCh* n=host->getAttributeNS(NULL,SHIBT_L(name));
if (!n || !*n) {
}
// Process general configuration elements.
- int i;
+ unsigned int i;
DOMNodeList* nlist=e->getElementsByTagNameNS(saml::XML::SAML_NS,L(AttributeDesignator));
for (i=0; nlist && i<nlist->getLength(); i++)
if (nlist->item(i)->getParentNode()->isSameNode(e))
DOMNodeList* nlist;
if (conf.isEnabled(ShibTargetConfig::Credentials)) {
nlist=ReloadableXMLFileImpl::m_root->getElementsByTagNameNS(shibtarget::XML::SHIBTARGET_NS,SHIBT_L(CredentialsProvider));
- for (int i=0; nlist && i<nlist->getLength(); i++) {
+ for (unsigned int i=0; nlist && i<nlist->getLength(); i++) {
auto_ptr_char type(static_cast<DOMElement*>(nlist->item(i))->getAttributeNS(NULL,SHIBT_L(type)));
log.info("building credentials provider of type %s...",type.get());
try {
// Now we load any attribute factories
nlist=ReloadableXMLFileImpl::m_root->getElementsByTagNameNS(shibtarget::XML::SHIBTARGET_NS,SHIBT_L(AttributeFactory));
- for (int i=0; nlist && i<nlist->getLength(); i++) {
+ for (unsigned int i=0; nlist && i<nlist->getLength(); i++) {
auto_ptr_char type(static_cast<DOMElement*>(nlist->item(i))->getAttributeNS(NULL,SHIBT_L(type)));
log.info("building Attribute factory of type %s...",type.get());
try {
// Load any overrides.
nlist=app->getElementsByTagNameNS(shibtarget::XML::SHIBTARGET_NS,SHIBT_L(Application));
- for (int j=0; nlist && j<nlist->getLength(); j++) {
+ for (unsigned int j=0; nlist && j<nlist->getLength(); j++) {
XMLApplication* iapp=new XMLApplication(m_outer,m_creds,static_cast<DOMElement*>(nlist->item(j)),defapp);
if (m_appmap.find(iapp->getId())!=m_appmap.end()) {
log.fatal("found conf:Application element with duplicate Id attribute");
string sockacl=temp.get();
if (sockacl.length()) {
int j = 0;
- for (int i=0; i < sockacl.length(); i++) {
+ for (unsigned int i=0; i < sockacl.length(); i++) {
if (sockacl.at(i)==' ') {
m_acl.push_back(sockacl.substr(j, i-j));
j = i+1;
// Check each attribute, applying any matching rules.
Iterator<SAMLAttribute*> attrs=s->getAttributes();
- for (long acount=0; acount < attrs.size();) {
+ for (unsigned long acount=0; acount < attrs.size();) {
SAMLAttribute* a=attrs[acount];
bool ruleFound=false;
aaps.reset();
// Finally, discard any assertions not issued by the same entity that issued the authn.
Iterator<SAMLAssertion*> assertions=bpr.response->getAssertions();
- for (int a=0; a<assertions.size();) {
+ for (unsigned int a=0; a<assertions.size();) {
if (XMLString::compareString(bpr.assertion->getIssuer(),assertions[a]->getIssuer())) {
auto_ptr_char bad(assertions[a]->getIssuer());
log.warn("discarding assertion not issued by authenticating IdP, instead by (%s)",bad.get());
if (!URI || !*URI || (*URI==chPound &&
!XMLString::compareString(&URI[1],static_cast<DOMElement*>(sigNode->getParentNode())->getAttributeNS(NULL,ID)))) {
DSIGTransformList* tlist=ref->getTransforms();
- for (int i=0; tlist && i<tlist->getSize(); i++) {
+ for (unsigned int i=0; tlist && i<tlist->getSize(); i++) {
if (tlist->item(i)->getTransformType()==TRANSFORM_ENVELOPED_SIGNATURE)
valid=true;
else if (tlist->item(i)->getTransformType()!=TRANSFORM_EXC_C14N) {
// Verify all signatures.
DOMNodeList* siglist=doc->getElementsByTagNameNS(saml::XML::XMLSIG_NS,L(Signature));
- for (int i=0; siglist && i<siglist->getLength(); i++)
+ for (unsigned int i=0; siglist && i<siglist->getLength(); i++)
verifySignature(doc,siglist->item(i),cert_param);
if (out_param) {
// Load any extra CA files.
DOMNodeList* nlist=e->getElementsByTagNameNS(::XML::CREDS_NS,SHIB_L(CAPath));
- for (int i=0; nlist && i<nlist->getLength(); i++) {
+ for (unsigned int i=0; nlist && i<nlist->getLength(); i++) {
if (!nlist->item(i)->hasChildNodes())
continue;
auto_ptr_char capath(static_cast<DOMElement*>(nlist->item(i))->getFirstChild()->getNodeValue());
// Loop over the AttributeRule elements.
DOMNodeList* nlist = m_root->getElementsByTagNameNS(::XML::SHIB_NS,SHIB_L(AttributeRule));
- for (int i=0; nlist && i<nlist->getLength(); i++)
+ for (unsigned int i=0; nlist && i<nlist->getLength(); i++)
{
AttributeRule* rule=new AttributeRule(static_cast<DOMElement*>(nlist->item(i)));
#ifdef HAVE_GOOD_STL
{
// Process Scope elements.
DOMNodeList* vlist = static_cast<DOMElement*>(anysite)->getElementsByTagNameNS(::XML::SHIB_NS,SHIB_L(Scope));
- for (int i=0; vlist && i<vlist->getLength(); i++)
+ for (unsigned int i=0; vlist && i<vlist->getLength(); i++)
{
m_scoped=true;
DOMElement* se=static_cast<DOMElement*>(vlist->item(i));
{
// Process each Value element.
vlist = static_cast<DOMElement*>(anysite)->getElementsByTagNameNS(::XML::SHIB_NS,SHIB_L(Value));
- for (int j=0; vlist && j<vlist->getLength(); j++)
+ for (unsigned int j=0; vlist && j<vlist->getLength(); j++)
{
DOMElement* ve=static_cast<DOMElement*>(vlist->item(j));
DOMNode* valnode=ve->getFirstChild();
// Loop over the SiteRule elements.
DOMNodeList* slist = e->getElementsByTagNameNS(::XML::SHIB_NS,SHIB_L(SiteRule));
- for (int k=0; slist && k<slist->getLength(); k++)
+ for (unsigned int k=0; slist && k<slist->getLength(); k++)
{
const XMLCh* srulename=static_cast<DOMElement*>(slist->item(k))->getAttributeNS(NULL,SHIB_L(Name));
#ifdef HAVE_GOOD_STL
// Process Scope elements.
DOMNodeList* vlist = static_cast<DOMElement*>(slist->item(k))->getElementsByTagNameNS(::XML::SHIB_NS,SHIB_L(Scope));
- for (int i=0; vlist && i<vlist->getLength(); i++)
+ for (unsigned int i=0; vlist && i<vlist->getLength(); i++)
{
m_scoped=true;
DOMElement* se=static_cast<DOMElement*>(vlist->item(i));
{
// Process each Value element.
vlist = static_cast<DOMElement*>(slist->item(k))->getElementsByTagNameNS(::XML::SHIB_NS,SHIB_L(Value));
- for (int j=0; vlist && j<vlist->getLength(); j++)
+ for (unsigned int j=0; vlist && j<vlist->getLength(); j++)
{
DOMElement* ve=static_cast<DOMElement*>(vlist->item(j));
DOMNode* valnode=ve->getFirstChild();
// Check each value.
DOMNodeList* vals=attribute.getValueElements();
int i2=0;
- for (int i=0; vals && i < vals->getLength(); i++) {
+ for (unsigned int i=0; vals && i < vals->getLength(); i++) {
if (!accept(static_cast<DOMElement*>(vals->item(i)),role ? dynamic_cast<const IScopedRoleDescriptor*>(role) : NULL))
attribute.removeValue(i2);
else
// Old metadata or new?
if (saml::XML::isElementNamed(e,::XML::SHIB_NS,SHIB_L(Contact))) {
type=e->getAttributeNS(NULL,SHIB_L(Type));
- m_surName=auto_ptr<char>(toUTF8(e->getAttributeNS(NULL,SHIB_L(Name))));
+ auto_ptr<char> wrapper(toUTF8(e->getAttributeNS(NULL,SHIB_L(Name))));
+ m_surName=wrapper;
if (e->hasAttributeNS(NULL,SHIB_L(Email))) {
auto_ptr<char> temp(toUTF8(e->getAttributeNS(NULL,SHIB_L(Email))));
if (temp.get())
}
else if (saml::XML::isElementNamed(e,::XML::SAML2META_NS,SHIB_L(ContactPerson))) {
type=e->getAttributeNS(NULL,SHIB_L(contactType));
- DOMNode* n=NULL;
e=saml::XML::getFirstChildElement(e);
while (e) {
- if (saml::XML::isElementNamed(e,::XML::SAML2META_NS,SHIB_L(Company))) {
- n=e->getFirstChild();
- if (n) m_company=auto_ptr<char>(toUTF8(n->getNodeValue()));
+ if (saml::XML::isElementNamed(e,::XML::SAML2META_NS,SHIB_L(Company)) && e->hasChildNodes()) {
+ auto_ptr<char> wrapper(toUTF8(e->getFirstChild()->getNodeValue()));
+ m_company=wrapper;
}
- else if (saml::XML::isElementNamed(e,::XML::SAML2META_NS,SHIB_L(GivenName))) {
- n=e->getFirstChild();
- if (n) m_givenName=auto_ptr<char>(toUTF8(n->getNodeValue()));
+ else if (saml::XML::isElementNamed(e,::XML::SAML2META_NS,SHIB_L(GivenName)) && e->hasChildNodes()) {
+ auto_ptr<char> wrapper(toUTF8(e->getFirstChild()->getNodeValue()));
+ m_givenName=wrapper;
}
- else if (saml::XML::isElementNamed(e,::XML::SAML2META_NS,SHIB_L(SurName))) {
- n=e->getFirstChild();
- if (n) m_surName=auto_ptr<char>(toUTF8(n->getNodeValue()));
+ else if (saml::XML::isElementNamed(e,::XML::SAML2META_NS,SHIB_L(SurName)) && e->hasChildNodes()) {
+ auto_ptr<char> wrapper(toUTF8(e->getFirstChild()->getNodeValue()));
+ m_surName=wrapper;
}
- else if (saml::XML::isElementNamed(e,::XML::SAML2META_NS,SHIB_L(EmailAddress))) {
- n=e->getFirstChild();
- if (n) {
- auto_ptr<char> temp(toUTF8(n->getNodeValue()));
- if (temp.get()) m_emails.push_back(temp.get());
- }
+ else if (saml::XML::isElementNamed(e,::XML::SAML2META_NS,SHIB_L(EmailAddress)) && e->hasChildNodes()) {
+ auto_ptr<char> temp(toUTF8(e->getFirstChild()->getNodeValue()));
+ if (temp.get()) m_emails.push_back(temp.get());
}
- else if (saml::XML::isElementNamed(e,::XML::SAML2META_NS,SHIB_L(TelephoneNumber))) {
- n=e->getFirstChild();
- if (n) {
- auto_ptr<char> temp(toUTF8(n->getNodeValue()));
- if (temp.get()) m_phones.push_back(temp.get());
- }
+ else if (saml::XML::isElementNamed(e,::XML::SAML2META_NS,SHIB_L(TelephoneNumber)) && e->hasChildNodes()) {
+ auto_ptr<char> temp(toUTF8(e->getFirstChild()->getNodeValue()));
+ if (temp.get()) m_phones.push_back(temp.get());
}
e=saml::XML::getNextSiblingElement(e);
}
{
// Check the root element namespace. If SAML2, assume it's the std schema.
if (!XMLString::compareString(e->getNamespaceURI(),::XML::SAML2META_NS)) {
- int i;
+ unsigned int i;
DOMNodeList* nlist=e->getElementsByTagNameNS(::XML::SAML2META_NS,SHIB_L(ArtifactResolutionService));
for (i=0; nlist && i<nlist->getLength(); i++)
m_artifact.add(new IndexedEndpoint(static_cast<DOMElement*>(nlist->item(i))));
nlist=e->getElementsByTagNameNS(::XML::SHIB_NS,SHIB_L(Domain));
}
- for (int i=0; nlist && i < nlist->getLength(); i++) {
+ for (unsigned int i=0; nlist && i < nlist->getLength(); i++) {
const XMLCh* dom=(nlist->item(i)->hasChildNodes()) ? nlist->item(i)->getFirstChild()->getNodeValue() : NULL;
if (dom && *dom) {
const XMLCh* regexp=static_cast<DOMElement*>(nlist->item(i))->getAttributeNS(NULL,SHIB_L(regexp));
m_sourceId=ext->getFirstChild()->getNodeValue();
}
- int i;
+ unsigned int i;
DOMNodeList* nlist=e->getElementsByTagNameNS(::XML::SAML2META_NS,SHIB_L(SingleSignOnService));
for (i=0; nlist && i<nlist->getLength(); i++)
m_sso.add(new Endpoint(static_cast<DOMElement*>(nlist->item(i))));
src=saml::XML::getNextSiblingElement(src,::XML::SAML2ASSERT_NS,L(AttributeValue));
DOMElement* val=e->getOwnerDocument()->createElementNS(saml::XML::SAML_NS,L(AttributeValue));
DOMNamedNodeMap* attrs = src->getAttributes();
- for (int j=0; j<attrs->getLength(); j++)
+ for (unsigned int j=0; j<attrs->getLength(); j++)
val->setAttributeNodeNS(static_cast<DOMAttr*>(e->getOwnerDocument()->importNode(attrs->item(j),true)));
while (src->hasChildNodes())
val->appendChild(src->getFirstChild());
else {
m_protocolEnum.push_back(Constants::SHIB_NS);
m_attrprofs.push_back(Constants::SHIB_ATTRIBUTE_NAMESPACE_URI);
- int i;
+ unsigned int i;
DOMNodeList* nlist=e->getElementsByTagNameNS(::XML::SHIB_NS,SHIB_L(HandleService));
for (i=0; nlist && i<nlist->getLength(); i++) {
// Manufacture an endpoint for the "Shib" binding.
{
// Check the root element namespace. If SAML2, assume it's the std schema.
if (!XMLString::compareString(e->getNamespaceURI(),::XML::SAML2META_NS)) {
- int i;
+ unsigned int i;
DOMNodeList* nlist=e->getElementsByTagNameNS(::XML::SAML2META_NS,SHIB_L(AttributeService));
for (i=0; nlist && i<nlist->getLength(); i++)
m_query.add(new Endpoint(static_cast<DOMElement*>(nlist->item(i))));
src=saml::XML::getNextSiblingElement(src,::XML::SAML2ASSERT_NS,L(AttributeValue));
DOMElement* val=e->getOwnerDocument()->createElementNS(saml::XML::SAML_NS,L(AttributeValue));
DOMNamedNodeMap* attrs = src->getAttributes();
- for (int j=0; j<attrs->getLength(); j++)
+ for (unsigned int j=0; j<attrs->getLength(); j++)
val->setAttributeNodeNS(static_cast<DOMAttr*>(e->getOwnerDocument()->importNode(attrs->item(j),true)));
while (src->hasChildNodes())
val->appendChild(src->getFirstChild());
m_protocolEnum.push_back(saml::XML::SAML11_PROTOCOL_ENUM);
m_formats.push_back(Constants::SHIB_NAMEID_FORMAT_URI);
m_attrprofs.push_back(Constants::SHIB_ATTRIBUTE_NAMESPACE_URI);
- int i;
+ unsigned int i;
DOMNodeList* nlist=e->getElementsByTagNameNS(::XML::SHIB_NS,SHIB_L(AttributeAuthority));
for (i=0; nlist && i<nlist->getLength(); i++) {
// Manufacture an endpoint for the SOAP binding.
}
else {
m_id=e->getAttributeNS(NULL,SHIB_L(Name));
- m_errorURL=auto_ptr<char>(toUTF8(e->getAttributeNS(NULL,SHIB_L(ErrorURL))));
+ auto_ptr<char> wrapper(toUTF8(e->getAttributeNS(NULL,SHIB_L(ErrorURL))));
+ m_errorURL=wrapper;
bool idp=false,aa=false; // only want to build a role once
DOMElement* child=saml::XML::getFirstChildElement(e);
if (e->hasAttributeNS(NULL,uri)) {
// First check for explicit enablement of entities.
DOMNodeList* nlist=e->getElementsByTagName(SHIB_L(Include));
- for (int i=0; nlist && i<nlist->getLength(); i++) {
+ for (unsigned int i=0; nlist && i<nlist->getLength(); i++) {
if (nlist->item(i)->hasChildNodes()) {
auto_ptr_char temp(nlist->item(i)->getFirstChild()->getNodeValue());
if (temp.get()) {
// If there was no explicit enablement, build a set of exclusions.
if (m_exclusions) {
nlist=e->getElementsByTagName(SHIB_L(Exclude));
- for (int j=0; nlist && j<nlist->getLength(); j++) {
+ for (unsigned int j=0; nlist && j<nlist->getLength(); j++) {
if (nlist->item(j)->hasChildNodes()) {
auto_ptr_char temp(nlist->item(j)->getFirstChild()->getNodeValue());
if (temp.get())
if (!URI || !*URI || (*URI==chPound &&
!XMLString::compareString(&URI[1],static_cast<DOMElement*>(sigNode->getParentNode())->getAttributeNS(NULL,ID)))) {
DSIGTransformList* tlist=ref->getTransforms();
- for (int i=0; tlist && i<tlist->getSize(); i++) {
+ for (unsigned int i=0; tlist && i<tlist->getSize(); i++) {
if (tlist->item(i)->getTransformType()==TRANSFORM_ENVELOPED_SIGNATURE)
valid=true;
else if (tlist->item(i)->getTransformType()!=TRANSFORM_EXC_C14N &&
// Loop over the KeyAuthority elements.
DOMNodeList* nlist=m_root->getElementsByTagNameNS(::XML::TRUST_NS,SHIB_L(KeyAuthority));
- for (int i=0; nlist && i<nlist->getLength(); i++) {
+ for (unsigned int i=0; nlist && i<nlist->getLength(); i++) {
auto_ptr<KeyAuthority> ka(new KeyAuthority());
const DOMElement* e=static_cast<DOMElement*>(nlist->item(i));
// Very rudimentary, grab up all the in-band X509Certificate elements, and flatten into one list.
DOMNodeList* certlist=k_child->getElementsByTagNameNS(saml::XML::XMLSIG_NS,L(X509Certificate));
- for (int j=0; certlist && j<certlist->getLength(); j++) {
+ for (unsigned int j=0; certlist && j<certlist->getLength(); j++) {
auto_ptr_char blob(certlist->item(j)->getFirstChild()->getNodeValue());
X509* x=B64_to_X509(blob.get());
if (x)
// Now look for externally referenced objects.
certlist=k_child->getElementsByTagNameNS(saml::XML::XMLSIG_NS,SHIB_L(RetrievalMethod));
- for (int k=0; certlist && k<certlist->getLength(); k++) {
+ for (unsigned int k=0; certlist && k<certlist->getLength(); k++) {
DOMElement* cert=static_cast<DOMElement*>(certlist->item(k));
if (!XMLString::compareString(cert->getAttributeNS(NULL,SHIB_L(Type)),::XML::XMLSIG_RETMETHOD_RAWX509)) {
// DER format
// Very rudimentary, grab up all the in-band X509CRL elements, and flatten into one list.
certlist=k_child->getElementsByTagNameNS(saml::XML::XMLSIG_NS,SHIB_L(X509CRL));
- for (int r=0; certlist && r<certlist->getLength(); r++) {
+ for (unsigned int r=0; certlist && r<certlist->getLength(); r++) {
auto_ptr_char blob(certlist->item(r)->getFirstChild()->getNodeValue());
X509_CRL* x=B64_to_CRL(blob.get());
if (x)