+ if (!gss_eap_attr_provider::initFromBuffer(ctx, buffer))
+ return false;
+
+ if (buffer->length == 0)
+ return true;
+
+ assert(m_authenticated == false);
+ assert(m_attributes.size() == 0);
+
+ DDF obj(NULL);
+ string str((const char *)buffer->value, buffer->length);
+ istringstream source(str);
+
+ source >> obj;
+
+ if (obj["version"].integer() != 1)
+ return false;
+
+ m_authenticated = (obj["authenticated"].integer() != 0);
+
+ DDF attrs = obj["attributes"];
+ DDF attr = attrs.first();
+ while (!attr.isnull()) {
+ Attribute *attribute = Attribute::unmarshall(attr);
+ m_attributes.push_back(attribute);
+ attr = attrs.next();
+ }
+
+ attrs.destroy();
+