Fixed crash when removing lone assertion due to condition check (bug 111)
authorcantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Thu, 5 Aug 2004 20:32:44 +0000 (20:32 +0000)
committercantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Thu, 5 Aug 2004 20:32:44 +0000 (20:32 +0000)
git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@1134 cb58f699-b61c-0410-a6fe-9272a202ed29

shib/ShibBinding.cpp

index 7226619..67c778c 100644 (file)
@@ -133,8 +133,10 @@ SAMLResponse* ShibBinding::send(
             auto_ptr<SAMLResponse> r(m_binding->send(*ab, req, conf));
             if (r->isSigned() && !t.validate(m_revocations,m_AA,*r))
                 throw TrustException("ShibBinding::send() unable to verify signed response");
+                
+            unsigned long i;
             Iterator<SAMLAssertion*> _a=r->getAssertions();
-            for (unsigned long i=0; i < _a.size(); i++) {
+            for (i=0; i < _a.size(); i++) {
                 // Check any conditions.
                 Iterator<SAMLCondition*> conds=_a[i]->getConditions();
                 while (conds.hasNext()) {
@@ -146,7 +148,9 @@ SAMLResponse* ShibBinding::send(
                         break;
                     }
                 }
-                
+            }
+            
+            for (i=0; i < _a.size(); i++) {
                 // Check signature.
                 if (_a[i]->isSigned() && !t.validate(m_revocations,m_AA,*(_a[i]))) {
                     log.warn("signed assertion failed to validate, removing it");
@@ -190,8 +194,9 @@ SAMLResponse* ShibBinding::send(
             if (r->isSigned() && !t.validate(m_revocations,m_AA,*r))
                 throw TrustException("ShibBinding::send() unable to verify signed response");
 
+            unsigned long i;
             Iterator<SAMLAssertion*> _a=r->getAssertions();
-            for (unsigned long i=0; i < _a.size(); i++) {
+            for (i=0; i < _a.size(); i++) {
                 // Check any conditions.
                 Iterator<SAMLCondition*> conds=_a[i]->getConditions();
                 while (conds.hasNext()) {
@@ -202,7 +207,9 @@ SAMLResponse* ShibBinding::send(
                         i--;
                     }
                 }
-                
+            }
+            
+            for (i=0; i < _a.size(); i++) {
                 // Check signature.
                 if (_a[i]->isSigned() && !t.validate(m_revocations,m_AA,*(_a[i]))) {
                     log.warn("signed assertion failed to validate, removing it");