diff --git a/plugins/redfish/fu-redfish-backend.c b/plugins/redfish/fu-redfish-backend.c index 239efe024..930cf79fb 100644 --- a/plugins/redfish/fu-redfish-backend.c +++ b/plugins/redfish/fu-redfish-backend.c @@ -24,6 +24,9 @@ struct _FuRedfishBackend { gchar *username; gchar *password; guint port; + gchar *vendor; + gchar *version; + gchar *uuid; gchar *update_uri_path; gchar *push_uri_path; gboolean use_https; @@ -37,6 +40,24 @@ struct _FuRedfishBackend { G_DEFINE_TYPE(FuRedfishBackend, fu_redfish_backend, FU_TYPE_BACKEND) +const gchar * +fu_redfish_backend_get_vendor(FuRedfishBackend *self) +{ + return self->vendor; +} + +const gchar * +fu_redfish_backend_get_version(FuRedfishBackend *self) +{ + return self->version; +} + +const gchar * +fu_redfish_backend_get_uuid(FuRedfishBackend *self) +{ + return self->uuid; +} + FuRedfishRequest * fu_redfish_backend_request_new(FuRedfishBackend *self) { @@ -334,7 +355,6 @@ fu_redfish_backend_setup(FuBackend *backend, FuProgress *progress, GError **erro JsonObject *json_update_service = NULL; const gchar *data_id; const gchar *version = NULL; - const gchar *uuid = NULL; g_autoptr(FuRedfishRequest) request = fu_redfish_backend_request_new(self); /* sanity check */ @@ -359,10 +379,18 @@ fu_redfish_backend_setup(FuBackend *backend, FuProgress *progress, GError **erro } else if (json_object_has_member(json_obj, "RedfishVersion")) { version = json_object_get_string_member(json_obj, "RedfishVersion"); } - if (json_object_has_member(json_obj, "UUID")) - uuid = json_object_get_string_member(json_obj, "UUID"); - g_debug("Version: %s", version); - g_debug("UUID: %s", uuid); + if (version != NULL) { + g_free(self->version); + self->version = g_strdup(version); + } + if (json_object_has_member(json_obj, "UUID")) { + g_free(self->uuid); + self->uuid = g_strdup(json_object_get_string_member(json_obj, "UUID")); + } + if (json_object_has_member(json_obj, "Vendor")) { + g_free(self->vendor); + self->vendor = g_strdup(json_object_get_string_member(json_obj, "Vendor")); + } if (json_object_has_member(json_obj, "UpdateService")) json_update_service = json_object_get_object_member(json_obj, "UpdateService"); @@ -477,6 +505,9 @@ fu_redfish_backend_finalize(GObject *object) g_free(self->hostname); g_free(self->username); g_free(self->password); + g_free(self->vendor); + g_free(self->version); + g_free(self->uuid); G_OBJECT_CLASS(fu_redfish_backend_parent_class)->finalize(object); } diff --git a/plugins/redfish/fu-redfish-backend.h b/plugins/redfish/fu-redfish-backend.h index b4168ce98..76eb8b598 100644 --- a/plugins/redfish/fu-redfish-backend.h +++ b/plugins/redfish/fu-redfish-backend.h @@ -16,6 +16,12 @@ G_DECLARE_FINAL_TYPE(FuRedfishBackend, fu_redfish_backend, FU, REDFISH_BACKEND, FuRedfishBackend * fu_redfish_backend_new(FuContext *ctx); +const gchar * +fu_redfish_backend_get_vendor(FuRedfishBackend *self); +const gchar * +fu_redfish_backend_get_version(FuRedfishBackend *self); +const gchar * +fu_redfish_backend_get_uuid(FuRedfishBackend *self); void fu_redfish_backend_set_hostname(FuRedfishBackend *self, const gchar *hostname); void diff --git a/plugins/redfish/fu-redfish-plugin.c b/plugins/redfish/fu-redfish-plugin.c index d630de17c..3556d4cde 100644 --- a/plugins/redfish/fu-redfish-plugin.c +++ b/plugins/redfish/fu-redfish-plugin.c @@ -36,6 +36,9 @@ fu_redfish_plugin_to_string(FuPlugin *plugin, guint idt, GString *str) g_autofree gchar *smbios = fu_firmware_to_string(FU_FIRMWARE(self->smbios)); fu_string_append(str, idt, "Smbios", smbios); } + fu_string_append(str, idt, "Vendor", fu_redfish_backend_get_vendor(self->backend)); + fu_string_append(str, idt, "Version", fu_redfish_backend_get_version(self->backend)); + fu_string_append(str, idt, "UUID", fu_redfish_backend_get_uuid(self->backend)); } static gchar * @@ -345,9 +348,14 @@ fu_redfish_plugin_ipmi_create_user(FuPlugin *plugin, GError **error) /* wait for Redfish to sync */ g_usleep(2 * G_USEC_PER_SEC); + /* XCC is the only BMC implementation that does not map the user_ids 1:1 */ + if (fu_context_has_hwid_guid(fu_plugin_get_context(plugin), + "42f00735-c9ab-5374-bd63-a5deee5881e0")) + user_id -= 1; + /* now use Redfish to change the temporary password to the actual password */ request = fu_redfish_backend_request_new(self->backend); - uri = g_strdup_printf("/redfish/v1/AccountService/Accounts/%u", (guint)user_id - 1); + uri = g_strdup_printf("/redfish/v1/AccountService/Accounts/%u", (guint)user_id); json_builder_begin_object(builder); json_builder_set_member_name(builder, "Password"); json_builder_add_string_value(builder, password_new);