Return an error if attribute context initialisation fails
[mech_eap.orig] / util_shib.cpp
index a37329f..c02abfb 100644 (file)
  * limitations under the License.
  */
 
+/*
+ * Local attribute provider implementation.
+ */
+
+#include <xmltooling/XMLObject.h>
+
+#include <saml/saml2/core/Assertions.h>
+
 #include <shibsp/exceptions.h>
 #include <shibsp/attribute/SimpleAttribute.h>
-
 #include <shibresolver/resolver.h>
 
 #include <sstream>
@@ -180,10 +187,12 @@ gss_eap_shib_attr_provider::initFromGssContext(const gss_eap_attr_ctx *manager,
             m_authenticated = saml->authenticated();
     }
 
-    resolver->resolve();
-
-    m_attributes = resolver->getResolvedAttributes();
-    resolver->getResolvedAttributes().clear();
+    try {
+        resolver->resolve();
+        m_attributes = resolver->getResolvedAttributes();
+        resolver->getResolvedAttributes().clear();
+    } catch (exception &e) {
+    }
 
     gss_release_buffer(&minor, &nameBuf);
 
@@ -192,7 +201,7 @@ gss_eap_shib_attr_provider::initFromGssContext(const gss_eap_attr_ctx *manager,
     return true;
 }
 
-int
+ssize_t
 gss_eap_shib_attr_provider::getAttributeIndex(const gss_buffer_t attr) const
 {
     int i = 0;
@@ -214,7 +223,7 @@ gss_eap_shib_attr_provider::getAttributeIndex(const gss_buffer_t attr) const
     return -1;
 }
 
-void
+bool
 gss_eap_shib_attr_provider::setAttribute(int complete,
                                          const gss_buffer_t attr,
                                          const gss_buffer_t value)
@@ -231,9 +240,11 @@ gss_eap_shib_attr_provider::setAttribute(int complete,
 
     m_attributes.push_back(a);
     m_authenticated = false;
+
+    return true;
 }
 
-void
+bool
 gss_eap_shib_attr_provider::deleteAttribute(const gss_buffer_t attr)
 {
     int i;
@@ -243,6 +254,8 @@ gss_eap_shib_attr_provider::deleteAttribute(const gss_buffer_t attr)
         m_attributes.erase(m_attributes.begin() + i);
 
     m_authenticated = false;
+
+    return true;
 }
 
 bool