+const char *
+gss_eap_shib_attr_provider::prefix(void) const
+{
+ return NULL;
+}
+
+const char *
+gss_eap_shib_attr_provider::name(void) const
+{
+ return "local";
+}
+
+static json_t *
+ddfToJson(DDF &ddf)
+{
+ json_t *json;
+
+ if (ddf.isstruct()) {
+ DDF elem = ddf.first();
+ json = json_array();
+ if (json == NULL)
+ throw new std::bad_alloc;
+
+ while (!elem.isnull()) {
+ if (json_array_append_new(json, ddfToJson(elem)) != 0) {
+ json_decref(json);
+ throw new std::bad_alloc;
+ }
+
+ elem = ddf.next();
+ }
+ } else if (ddf.islist()) {
+ DDF elem = ddf.first();
+ json = json_object();
+ if (json == NULL)
+ throw new std::bad_alloc;
+
+ while (!elem.isnull()) {
+ if (json_object_set(json, elem.name(), ddfToJson(elem)) != 0) {
+ json_decref(json);
+ throw new std::bad_alloc;
+ }
+
+ elem = ddf.next();
+ }
+ } else if (ddf.isstring()) {
+ json = json_string(ddf.string());
+ } else if (ddf.isint()) {
+ json = json_integer(ddf.integer());
+ } else if (ddf.isfloat()) {
+ json = json_real(ddf.floating());
+ } else if (ddf.isempty() || ddf.ispointer()) {
+ json = json_object();
+ } else if (ddf.isnull()) {
+ json = json_null();
+ } else {
+ assert(0 && "Invalid DDF object");
+ }
+
+ if (json == NULL)
+ throw new std::bad_alloc;
+
+ return json;
+}
+
+static DDF
+jsonToDdf(json_t *json)