plug leaks in 898862478f9adecfc5580814cf1296464c448b1b
[mech_eap.orig] / util_attr.h
index 347842a..e3f3567 100644 (file)
@@ -41,9 +41,7 @@
 #include <string>
 #include <new>
 
-#include <shibsp/remoting/ddf.h>
-
-using namespace shibsp;
+using namespace gss_eap_util;
 
 struct gss_eap_attr_provider;
 struct gss_eap_attr_ctx;
@@ -79,13 +77,13 @@ public:
         return true;
     }
 
-    virtual bool initFromExistingContext(const gss_eap_attr_ctx *manager,
+    virtual bool initWithExistingContext(const gss_eap_attr_ctx *manager,
                                          const gss_eap_attr_provider *ctx GSSEAP_UNUSED)
     {
         return initWithManager(manager);
     }
 
-    virtual bool initFromGssContext(const gss_eap_attr_ctx *manager,
+    virtual bool initWithGssContext(const gss_eap_attr_ctx *manager,
                                     const gss_cred_id_t cred GSSEAP_UNUSED,
                                     const gss_ctx_id_t ctx GSSEAP_UNUSED)
     {
@@ -131,25 +129,28 @@ public:
     {
     }
 
+    /* prefix to be prepended to attributes emitted by gss_get_name_attribute */
     virtual const char *prefix(void) const
     {
         return NULL;
     }
 
-    virtual const char *marshallingKey(void) const
+    /* optional key for storing JSON dictionary */
+    virtual const char *name(void) const
     {
         return NULL;
     }
 
-    virtual bool unmarshallAndInit(const gss_eap_attr_ctx *manager,
-                                   DDF &object GSSEAP_UNUSED)
+    virtual bool initWithJsonObject(const gss_eap_attr_ctx *manager,
+                                    JSONObject &object GSSEAP_UNUSED)
     {
         return initWithManager(manager);
     }
 
-    virtual DDF marshall(void) const
+
+    virtual JSONObject jsonRepresentation(void) const
     {
-        return DDF(NULL);
+        return JSONObject::null();
     }
 
     virtual time_t getExpiryTime(void) const { return 0; }
@@ -186,8 +187,8 @@ public:
     gss_eap_attr_ctx(void);
     ~gss_eap_attr_ctx(void);
 
-    bool initFromExistingContext(const gss_eap_attr_ctx *manager);
-    bool initFromGssContext(const gss_cred_id_t cred,
+    bool initWithExistingContext(const gss_eap_attr_ctx *manager);
+    bool initWithGssContext(const gss_cred_id_t cred,
                             const gss_ctx_id_t ctx);
 
     bool getAttributeTypes(gss_eap_attr_enumeration_cb, void *data) const;
@@ -209,7 +210,7 @@ public:
                                gss_any_t input) const;
 
     void exportToBuffer(gss_buffer_t buffer) const;
-    bool initFromBuffer(const gss_buffer_t buffer);
+    bool initWithBuffer(const gss_buffer_t buffer);
 
     static std::string
     composeAttributeName(const gss_buffer_t prefix,
@@ -253,8 +254,8 @@ private:
     unsigned int attributePrefixToType(const gss_buffer_t prefix) const;
     gss_buffer_desc attributeTypeToPrefix(unsigned int type) const;
 
-    bool unmarshallAndInit(DDF &object);
-    DDF marshall(void) const;
+    bool initWithJsonObject(JSONObject &object);
+    JSONObject jsonRepresentation(void) const;
 
     gss_eap_attr_provider *getPrimaryProvider(void) const;
 
@@ -280,7 +281,7 @@ duplicateBuffer(gss_buffer_desc &src, gss_buffer_t dst)
     OM_uint32 minor;
 
     if (GSS_ERROR(duplicateBuffer(&minor, &src, dst)))
-        throw new std::bad_alloc();
+        throw std::bad_alloc();
 }
 
 static inline void