Heimdal build fixes
[mech_eap.git] / mech_eap / util_attr.cpp
index 3bfe785..beb283c 100644 (file)
@@ -58,16 +58,16 @@ GSSEAP_ONCE_CALLBACK(gssEapAttrProvidersInitInternal)
     if (GSS_ERROR(major))
         goto cleanup;
 
-#ifdef HAVE_OPENSAML
-    major = gssEapSamlAttrProvidersInit(&minor);
-    if (GSS_ERROR(major))
-        goto cleanup;
-#endif
 
 #ifdef HAVE_SHIBRESOLVER
     /* Allow Shibboleth initialization failure to be non-fatal */
     gssEapLocalAttrProviderInit(&minor);
 #endif
+#ifdef HAVE_OPENSAML
+    major = gssEapSamlAttrProvidersInit(&minor);
+    if (GSS_ERROR(major))
+        goto cleanup;
+#endif
 
 cleanup:
 #ifdef GSSEAP_DEBUG
@@ -90,24 +90,29 @@ gssEapAttrProvidersInit(OM_uint32 *minor)
     return gssEapAttrProvidersInitStatus;
 }
 
-OM_uint32
-gssEapAttrProvidersFinalize(OM_uint32 *minor)
-{
-    if (gssEapAttrProvidersInitStatus == GSS_S_COMPLETE) {
+namespace {
+    class finalize_class {
+    public:
+      ~finalize_class()
+           {
+               OM_uint32 minor = 0;
+               if (gssEapAttrProvidersInitStatus == GSS_S_COMPLETE) {
 #ifdef HAVE_SHIBRESOLVER
-        gssEapLocalAttrProviderFinalize(minor);
+                   gssEapLocalAttrProviderFinalize(&minor);
 #endif
 #ifdef HAVE_OPENSAML
-        gssEapSamlAttrProvidersFinalize(minor);
+                   gssEapSamlAttrProvidersFinalize(&minor);
 #endif
-        gssEapRadiusAttrProviderFinalize(minor);
+                   gssEapRadiusAttrProviderFinalize(&minor);
 
-        gssEapAttrProvidersInitStatus = GSS_S_UNAVAILABLE;
-    }
-
-    return GSS_S_COMPLETE;
+                   gssEapAttrProvidersInitStatus = GSS_S_UNAVAILABLE;
+               }
+           }
+    } finalizer;
 }
 
+           
+       
 static gss_eap_attr_create_provider gssEapAttrFactories[ATTR_TYPE_MAX + 1];
 
 /*
@@ -980,7 +985,7 @@ gssEapSetNameAttribute(OM_uint32 *minor,
 
 OM_uint32
 gssEapExportAttrContext(OM_uint32 *minor,
-                        gss_name_t name,
+                        gss_const_name_t name,
                         gss_buffer_t buffer)
 {
     if (name->attrCtx == NULL) {
@@ -1044,7 +1049,7 @@ gssEapImportAttrContext(OM_uint32 *minor,
 
 OM_uint32
 gssEapDuplicateAttrContext(OM_uint32 *minor,
-                           gss_name_t in,
+                           gss_const_name_t in,
                            gss_name_t out)
 {
     gss_eap_attr_ctx *ctx = NULL;