allow authenticated/complete to be optional
authorLuke Howard <lukeh@padl.com>
Sun, 19 Sep 2010 12:12:58 +0000 (14:12 +0200)
committerLuke Howard <lukeh@padl.com>
Sun, 19 Sep 2010 12:12:58 +0000 (14:12 +0200)
mech_eap/util_saml.cpp
mech_eap/util_shib.cpp

index c4cdd98..cdac5c8 100644 (file)
@@ -189,8 +189,10 @@ gss_eap_saml_assertion_provider::getAttribute(const gss_buffer_t attr,
     if (*more != -1)
         return false;
 
-    *authenticated = m_authenticated;
-    *complete = false;
+    if (authenticated != NULL)
+        *authenticated = m_authenticated;
+    if (complete != NULL)
+        *complete = true;
 
     XMLHelper::serialize(m_assertion->marshall((DOMDocument *)NULL), str);
 
@@ -280,18 +282,22 @@ gss_eap_saml_attr_provider::getAssertion(int *authenticated,
 {
     const gss_eap_saml_assertion_provider *saml;
 
-    *authenticated = false;
-    *pAssertion = NULL;
+    if (authenticated != NULL)
+        *authenticated = false;
+    if (pAssertion != NULL)
+        *pAssertion = NULL;
 
     saml = static_cast<const gss_eap_saml_assertion_provider *>
         (m_manager->getProvider(ATTR_TYPE_SAML_ASSERTION));
     if (saml == NULL)
         return false;
 
-    *authenticated = saml->authenticated();
-    *pAssertion = saml->getAssertion();
+    if (authenticated != NULL)
+        *authenticated = saml->authenticated();
+    if (pAssertion != NULL)
+        *pAssertion = saml->getAssertion();
 
-    return (*pAssertion != NULL);
+    return (saml->getAssertion() != NULL);
 }
 
 gss_eap_saml_attr_provider::~gss_eap_saml_attr_provider(void)
@@ -389,8 +395,10 @@ gss_eap_saml_attr_provider::getAttribute(const gss_buffer_t attr,
 {
     const saml2::Assertion *assertion;
 
-    *authenticated = false;
-    *complete = true;
+    if (authenticated != NULL)
+        *authenticated = false;
+    if (complete != NULL)
+        *complete = true;
     *pAttribute = NULL;
 
     if (!getAssertion(authenticated, &assertion) ||
index 815b57a..8a26b1b 100644 (file)
@@ -333,9 +333,11 @@ gss_eap_shib_attr_provider::getAttribute(const gss_buffer_t attr,
         if (display_value != NULL)
             duplicateBuffer(buf, display_value);
     }
-    *authenticated = m_authenticated;
-    *complete = false;
+
+    if (authenticated != NULL) 
+        *authenticated = m_authenticated;
+    if (complete != NULL)
+        *complete = false;
 
     if (nvalues > ++i)
         *more = i;