void dmz::ArchivePluginObject::link_objects ( const Handle LinkHandle, const Handle AttributeHandle, const UUID &SuperIdentity, const Handle SuperHandle, const UUID &SubIdentity, const Handle SubHandle) { Config config; if (_get_attr_config (AttributeHandle, ObjectLinkMask, config)) { Config links; if (!config.lookup_config ("links", links)) { Config tmp ("links"); links = tmp; config.add_config (links); } Config obj ("object"); obj.store_attribute ("name", SubIdentity.to_string ()); ObjectModule *objMod (get_object_module ()); if (objMod) { const Handle LinkAttrHandle = objMod->lookup_link_attribute_object (LinkHandle); UUID uuid; if (LinkAttrHandle && objMod->lookup_uuid (LinkAttrHandle, uuid)) { obj.store_attribute ("attribute", uuid.to_string ()); } } links.add_config (obj); } }
std::string format_url(const UUID& uuid, TPM_Storage_Type storage) { std::string storage_str = (storage == TPM_Storage_Type::User) ? "user" : "system"; return "tpmkey:uuid=" + uuid.to_string() + ";storage=" + storage_str; }
void dmz::ArchivePluginObject::_config_to_object (Config &objData) { ObjectModule *objMod (get_object_module ()); if (objMod) { const UUID ObjUUID (config_to_string ("uuid", objData)); String objectName (config_to_string ("name", objData)); if (!objectName) { objectName = ObjUUID.to_string (); } const String TypeName (config_to_string ("type", objData)); const ObjectType Type (TypeName, get_plugin_runtime_context ()); Boolean filterObject (False); if (_currentFilterList) { FilterStruct *filter = _currentFilterList->list; while (filter) { if (filter->mode & LocalImportMask) { if (filter->exTypes.get_count () && filter->exTypes.contains_type (Type)) { filterObject = True; filter = 0; } if (filter && filter->inTypes.get_count () && !filter->inTypes.contains_type (Type)) { filterObject = True; filter = 0; } } if (filter) { filter = filter->next; } } } if (Type && !filterObject) { Handle objectHandle (0); if (ObjUUID) { objectHandle = objMod->lookup_handle_from_uuid (ObjUUID); } if (!objectHandle) { objectHandle = objMod->create_object (Type, ObjectLocal); } if (objectHandle) { if (ObjUUID) { objMod->store_uuid (objectHandle, ObjUUID); } ObjectLinkStruct *links (0); if (objectName) { links = new ObjectLinkStruct (objectHandle); if (links && !_linkTable.store (objectName, links)) { delete links; links = 0; } } Config attrList; if (objData.lookup_all_config ("attributes", attrList)) { ConfigIterator it; Config attrData; Boolean found (attrList.get_first_config (it, attrData)); while (found) { _store_object_attributes (objectHandle, attrData, links); found = attrList.get_next_config (it, attrData); } } objMod->activate_object (objectHandle); } else { _log.error << "Unable to create object of type: " << TypeName << endl; } } else if (!Type) { _log.error << "Unable to create object of unknown type: " << TypeName << endl; } else { _log.info << "Filtering object with type: " << TypeName << endl; } } }
dmz::Config dmz::ArchivePluginObject::_archive_object (const Handle ObjectHandle) { Config result; ObjectModule *objMod (get_object_module ()); if (objMod) { Config tmp ("object"); Boolean archiveObject (True); const ObjectType Type (objMod->lookup_object_type (ObjectHandle)); if (Type) { if (_currentFilterList) { FilterStruct *filter = _currentFilterList->list; while (filter) { if (filter->mode & LocalExportMask) { if (filter->exTypes.get_count () && filter->exTypes.contains_type (Type)) { archiveObject = False; filter = 0; } if (filter && filter->inTypes.get_count () && !filter->inTypes.contains_type (Type)) { archiveObject = False; filter = 0; } } if (filter) { filter = filter->next; } } } } else { archiveObject = False; } if (archiveObject) { tmp.store_attribute ("type", Type.get_name ()); UUID uuid; if (objMod->lookup_uuid (ObjectHandle, uuid)) { tmp.store_attribute ("uuid", uuid.to_string ()); } _currentConfig = result = tmp; objMod->dump_all_object_attributes (ObjectHandle, *this); } } _attrTable.empty (); _currentConfig.set_config_context (0); return result; }
QLatin1String dmz::to_qstring (const UUID &Identity) { QLatin1String result (Identity.to_string ().get_buffer ()); return result; }
/*! \brief Store a dmz::UUID as a String in an attribute element. \note The UUID is converted and stored as a String. \param[in] AttrHandle Attribute handle. \param[in] Element Index of attribute element. \param[in] Value Variable to be stored. \return Returns dmz::True if the element was successfully stored. */ dmz::Boolean dmz::Data::store_uuid (const Handle AttrHandle, const Int32 Element, const UUID &Value) { return store_string (AttrHandle, Element, Value.to_string ()); }