remove debugging statement
[moonshot.git] / mech_eap / util_saml.cpp
index 5346cc4..0c64752 100644 (file)
@@ -304,42 +304,6 @@ gss_eap_saml_assertion_provider::releaseAnyNameMapping(gss_buffer_t type_id GSSE
     delete ((saml2::Assertion *)input);
 }
 
-void
-gss_eap_saml_assertion_provider::exportToBuffer(gss_buffer_t buffer) const
-{
-    ostringstream sink;
-    string str;
-
-    buffer->length = 0;
-    buffer->value = NULL;
-
-    if (m_assertion == NULL)
-        return;
-
-    sink << *m_assertion;
-    str = sink.str();
-
-    duplicateBuffer(str, buffer);
-}
-
-bool
-gss_eap_saml_assertion_provider::initFromBuffer(const gss_eap_attr_ctx *ctx,
-                                                const gss_buffer_t buffer)
-{
-    if (!gss_eap_attr_provider::initFromBuffer(ctx, buffer))
-        return false;
-
-    if (buffer->length == 0)
-        return true;
-
-    assert(m_assertion == NULL);
-
-    setAssertion(buffer);
-    /* TODO XXX how to propagate authenticated flag? */
-
-    return true;
-}
-
 bool
 gss_eap_saml_assertion_provider::init(void)
 {
@@ -444,13 +408,17 @@ gss_eap_saml_attr_provider::getAttributeTypes(gss_eap_attr_enumeration_cb addAtt
             const_cast<const saml2::AttributeStatement*>(*s)->getAttributes();
 
         for (vector<saml2::Attribute*>::const_iterator a = attrs.begin(); a != attrs.end(); ++a) {
-            const XMLCh *attributeName = (*a)->getName();
-            const XMLCh *attributeNameFormat = (*a)->getNameFormat();
+            const XMLCh *attributeName, *attributeNameFormat;
             XMLCh *qualifiedName;
             XMLCh space[2] = { ' ', 0 };
             gss_buffer_desc utf8;
             bool ret;
 
+            attributeName = (*a)->getName();
+            attributeNameFormat = (*a)->getNameFormat();
+            if (attributeNameFormat == NULL || attributeNameFormat[0] == '\0')
+                attributeNameFormat = saml2::Attribute::UNSPECIFIED;
+
             qualifiedName = new XMLCh[XMLString::stringLen(attributeNameFormat) + 1 +
                                       XMLString::stringLen(attributeName) + 1];
             XMLString::copyString(qualifiedName, attributeNameFormat);
@@ -619,8 +587,15 @@ gss_eap_saml_attr_provider::getAttribute(const gss_buffer_t attr,
             const_cast<const saml2::AttributeStatement*>(*s)->getAttributes();
 
         for (vector<saml2::Attribute *>::const_iterator a = attrs.begin(); a != attrs.end(); ++a) {
-            if (XMLString::equals((*a)->getNameFormat(), components->elementAt(0)) &&
-                XMLString::equals((*a)->getName(), components->elementAt(1))) {
+            const XMLCh *attributeName, *attributeNameFormat;
+
+            attributeName = (*a)->getName();
+            attributeNameFormat = (*a)->getNameFormat();
+            if (attributeNameFormat == NULL || attributeNameFormat[0] == '\0')
+                attributeNameFormat = saml2::Attribute::UNSPECIFIED;
+
+            if (XMLString::equals(attributeNameFormat, components->elementAt(0)) &&
+                XMLString::equals(attributeName, components->elementAt(1))) {
                 ret = *a;
                 break;
             }
@@ -695,20 +670,6 @@ gss_eap_saml_attr_provider::releaseAnyNameMapping(gss_buffer_t type_id GSSEAP_UN
 {
 }
 
-void
-gss_eap_saml_attr_provider::exportToBuffer(gss_buffer_t buffer) const
-{
-    buffer->length = 0;
-    buffer->value = NULL;
-}
-
-bool
-gss_eap_saml_attr_provider::initFromBuffer(const gss_eap_attr_ctx *ctx,
-                                           const gss_buffer_t buffer)
-{
-    return gss_eap_attr_provider::initFromBuffer(ctx, buffer);
-}
-
 bool
 gss_eap_saml_attr_provider::init(void)
 {