force load of global dictionary in RADIUS attr provider initialisation
authorLuke Howard <lukeh@padl.com>
Tue, 8 Mar 2011 13:29:40 +0000 (00:29 +1100)
committerLuke Howard <lukeh@padl.com>
Tue, 8 Mar 2011 13:38:49 +0000 (00:38 +1100)
util_radius.cpp

index 9d9df42..fb62c43 100644 (file)
@@ -446,9 +446,25 @@ gss_eap_radius_attr_provider::releaseAnyNameMapping(gss_buffer_t type_id,
 bool
 gss_eap_radius_attr_provider::init(void)
 {
+    struct rs_context *radContext;
+
     gss_eap_attr_ctx::registerProvider(ATTR_TYPE_RADIUS,
                                        "urn:ietf:params:gss-eap:radius-avp",
                                        createAttrContext);
+
+#if 1
+    /*
+     * This hack is necessary in order to force the loading of the global
+     * dictionary, otherwise accepting reauthentication tokens fails unless
+     * the acceptor has already accepted a normal authentication token.
+     */
+    if (rs_context_create(&radContext, RS_DICT_FILE) != 0) {
+        return false;
+    }
+
+    rs_context_destroy(radContext);
+#endif
+
     return true;
 }
 
@@ -710,6 +726,7 @@ avpImport(VALUE_PAIR **pVp,
 fail:
     if (vp != NULL)
         pairbasicfree(vp);
+    *pVp = NULL;
     return false;
 }