From: Luke Howard Date: Sun, 19 Sep 2010 12:12:58 +0000 (+0200) Subject: allow authenticated/complete to be optional X-Git-Url: http://www.project-moonshot.org/gitweb/?p=cyrus-sasl.git;a=commitdiff_plain;h=bd2031ea257ffb615295bc91cf13acc361f83a46 allow authenticated/complete to be optional --- diff --git a/mech_eap/util_saml.cpp b/mech_eap/util_saml.cpp index c4cdd98..cdac5c8 100644 --- a/mech_eap/util_saml.cpp +++ b/mech_eap/util_saml.cpp @@ -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 (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) || diff --git a/mech_eap/util_shib.cpp b/mech_eap/util_shib.cpp index 815b57a..8a26b1b 100644 --- a/mech_eap/util_shib.cpp +++ b/mech_eap/util_shib.cpp @@ -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;