[cpp-xmltooling COMMIT] /branches/REL_1/xmltooling/security/impl/InlineKeyResolver.cpp

noreply at shibboleth.net noreply at shibboleth.net
Fri Oct 5 20:10:26 EDT 2012


Author: scantor
Date: Fri Oct  5 20:10:25 2012
New Revision: 998

URL: http://svn.shibboleth.net/view/cpp-xmltooling?rev=998&view=rev
Log:
https://issues.shibboleth.net/jira/browse/CPPXT-91

Modified:
    branches/REL_1/xmltooling/security/impl/InlineKeyResolver.cpp

Modified: branches/REL_1/xmltooling/security/impl/InlineKeyResolver.cpp
URL: http://svn.shibboleth.net/view/cpp-xmltooling/branches/REL_1/xmltooling/security/impl/InlineKeyResolver.cpp?rev=998&r1=997&r2=998&view=diff
==============================================================================
--- branches/REL_1/xmltooling/security/impl/InlineKeyResolver.cpp (original)
+++ branches/REL_1/xmltooling/security/impl/InlineKeyResolver.cpp Fri Oct  5 20:10:25 2012
@@ -115,6 +115,11 @@
         void resolve(const KeyInfo* keyInfo, int types=0, bool followRefs=false);
         void resolve(DSIGKeyInfoList* keyInfo, int types=0, bool followRefs=false);
 
+        bool isEmpty() const {
+            return (!m_key && m_xseccerts.empty() && m_crls.empty() &&
+                m_keyNames.empty() && m_serial.empty() && m_issuerName.empty());
+        }
+
     private:
         bool resolveCerts(const KeyInfo* keyInfo, bool followRefs=false);
         bool resolveKey(const KeyInfo* keyInfo, bool followRefs=false);
@@ -141,7 +146,7 @@
                 types = Credential::RESOLVE_KEYS|X509Credential::RESOLVE_CERTS|X509Credential::RESOLVE_CRLS;
             auto_ptr<InlineCredential> credential(new InlineCredential(keyInfo));
             credential->resolve(keyInfo, types, m_followRefs);
-            return credential.release();
+            return credential->isEmpty() ? nullptr : credential.release();
         }
         Credential* resolve(DSIGKeyInfoList* keyInfo, int types=0) const {
             if (!keyInfo)
@@ -150,7 +155,7 @@
                 types = Credential::RESOLVE_KEYS|X509Credential::RESOLVE_CERTS|X509Credential::RESOLVE_CRLS;
             auto_ptr<InlineCredential> credential(new InlineCredential(keyInfo));
             credential->resolve(keyInfo, types, m_followRefs);
-            return credential.release();
+            return credential->isEmpty() ? nullptr : credential.release();
         }
         Credential* resolve(KeyInfoCredentialContext* context, int types=0) const {
             if (!context)
@@ -162,7 +167,9 @@
                 credential->resolve(context->getKeyInfo(), types, m_followRefs);
             else if (context->getNativeKeyInfo())
                 credential->resolve(context->getNativeKeyInfo(), types, m_followRefs);
-            credential->setCredentialContext(context);
+            if (credential->isEmpty())
+                return nullptr;
+            credential->setCredentialContext(context);  // transfers ownership to credential
             return credential.release();
         }
 



More information about the commits mailing list