summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch')
-rw-r--r--meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch161
1 files changed, 69 insertions, 92 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch
index e87995aca..9a2fada9e 100644
--- a/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch
+++ b/meta-openbmc-mods/meta-common/recipes-phosphor/interfaces/bmcweb/biosconfig/0004-Add-support-to-ChangePassword-action.patch
@@ -1,7 +1,7 @@
-From 0ce94f6caf5d76d7f1abc71f6f8f7dc320517984 Mon Sep 17 00:00:00 2001
-From: Kuiying Wang <kuiying.wang@intel.com>
-Date: Wed, 23 Dec 2020 14:41:23 +0800
-Subject: [PATCH] Add support to ChangePassword action
+From 34f8680b21a134e2133bdcf41e1e83e4b4a05d28 Mon Sep 17 00:00:00 2001
+From: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
+Date: Wed, 30 Jun 2021 15:37:47 +0000
+Subject: [PATCH 4/5] Add support to ChangePassword action
Tested:
@@ -32,108 +32,85 @@ root@intel-obmc:~# cat /var/lib/bios-settings-manager/passwordData
Change-Id: I90319a68da0b0a7f9c5cd65a8cb8cf52269a5f52
Signed-off-by: Kuiying Wang <kuiying.wang@intel.com>
---
- redfish-core/include/redfish.hpp | 1 +
- redfish-core/lib/bios.hpp | 70 ++++++++++++++++++++++++++++++++
- 2 files changed, 71 insertions(+)
+ redfish-core/lib/bios.hpp | 58 +++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 58 insertions(+)
-diff --git a/redfish-core/include/redfish.hpp b/redfish-core/include/redfish.hpp
-index 298ebb8..4418c3d 100644
---- a/redfish-core/include/redfish.hpp
-+++ b/redfish-core/include/redfish.hpp
-@@ -159,6 +159,7 @@ class RedfishService
- nodes.emplace_back(std::make_unique<BiosSettings>(app));
- nodes.emplace_back(std::make_unique<BiosAttributeRegistry>(app));
- nodes.emplace_back(std::make_unique<BiosReset>(app));
-+ nodes.emplace_back(std::make_unique<BiosChangePassword>(app));
- #ifdef BMCWEB_ENABLE_VM_NBDPROXY
- nodes.emplace_back(std::make_unique<VirtualMedia>(app));
- nodes.emplace_back(std::make_unique<VirtualMediaCollection>(app));
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
-index 1eb7bef..12ec472 100644
+index 49c0fd0..0250c59 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
-@@ -184,6 +184,9 @@ class BiosService : public Node
- asyncResp->res.jsonValue["Actions"]["#Bios.ResetBios"] = {
- {"target",
- "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios"}};
-+ asyncResp->res.jsonValue["Actions"]["#Bios.ChangePassword"] = {
-+ {"target",
-+ "/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword"}};
+@@ -180,6 +180,9 @@ inline void requestRoutesBiosService(App& app)
+ asyncResp->res.jsonValue["Actions"]["#Bios.ResetBios"] = {
+ {"target",
+ "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios"}};
++ asyncResp->res.jsonValue["Actions"]["#Bios.ChangePassword"] = {
++ {"target", "/redfish/v1/Systems/system/Bios/Actions/"
++ "Bios.ChangePassword"}};
+
+ // Get the ActiveSoftwareImage and SoftwareImages
+ fw_util::populateFirmwareInformation(
+@@ -283,6 +286,61 @@ inline void requestRoutesBiosService(App& app)
+ });
+ }
- // Get the ActiveSoftwareImage and SoftwareImages
- fw_util::populateFirmwareInformation(asyncResp, fw_util::biosPurpose,
-@@ -669,4 +672,71 @@ class BiosReset : public Node
- std::variant<std::string>(resetFlag));
- }
- };
-+
+/**
+ * BiosChangePassword class supports handle POST method for change bios
+ * password. The class retrieves and sends data directly to D-Bus.
+ */
-+class BiosChangePassword : public Node
++inline void requestRoutesBiosChangePassword(App& app)
+{
-+ public:
-+ BiosChangePassword(App& app) :
-+ Node(app,
-+ "/redfish/v1/Systems/system/Bios/Actions/Bios.ChangePassword/")
-+ {
-+ entityPrivileges = {
-+ {boost::beast::http::verb::post, {{"ConfigureComponents"}}}};
-+ }
-+
-+ private:
-+ /**
-+ * Function handles POST method request.
-+ * Analyzes POST body message before sends Reset request data to D-Bus.
-+ */
-+ void doPost(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-+ const crow::Request& req,
-+ const std::vector<std::string>&) override
-+ {
-+ std::string currentPassword, newPassword, userName;
-+ if (!json_util::readJson(req, asyncResp->res, "NewPassword",
-+ newPassword, "OldPassword", currentPassword,
-+ "PasswordName", userName))
-+ {
-+ return;
-+ }
-+ if (currentPassword.empty())
-+ {
-+ messages::actionParameterUnknown(asyncResp->res, "ChangePassword",
-+ "OldPassword");
-+ return;
-+ }
-+ if (newPassword.empty())
-+ {
-+ messages::actionParameterUnknown(asyncResp->res, "ChangePassword",
-+ "NewPassword");
-+ return;
-+ }
-+ if (userName.empty())
-+ {
-+ messages::actionParameterUnknown(asyncResp->res, "ChangePassword",
-+ "PasswordName");
-+ return;
-+ }
-+ crow::connections::systemBus->async_method_call(
-+ [asyncResp](const boost::system::error_code ec) {
-+ if (ec)
++ BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Bios/")
++ .privileges({{"ConfigureComponents"}})
++ .methods(boost::beast::http::verb::post)(
++ [](const crow::Request& req,
++ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
++ std::string currentPassword, newPassword, userName;
++ if (!json_util::readJson(req, asyncResp->res, "NewPassword",
++ newPassword, "OldPassword",
++ currentPassword, "PasswordName",
++ userName))
++ {
++ return;
++ }
++ if (currentPassword.empty())
++ {
++ messages::actionParameterUnknown(
++ asyncResp->res, "ChangePassword", "OldPassword");
++ return;
++ }
++ if (newPassword.empty())
++ {
++ messages::actionParameterUnknown(
++ asyncResp->res, "ChangePassword", "NewPassword");
++ return;
++ }
++ if (userName.empty())
+ {
-+ BMCWEB_LOG_CRITICAL
-+ << "Failed in doPost(BiosChangePassword) " << ec;
-+ messages::internalError(asyncResp->res);
++ messages::actionParameterUnknown(
++ asyncResp->res, "ChangePassword", "PasswordName");
+ return;
+ }
-+ },
-+ "xyz.openbmc_project.BIOSConfigPassword",
-+ "/xyz/openbmc_project/bios_config/password",
-+ "xyz.openbmc_project.BIOSConfig.Password", "ChangePassword",
-+ userName, currentPassword, newPassword);
-+ }
-+};
++ crow::connections::systemBus->async_method_call(
++ [asyncResp](const boost::system::error_code ec) {
++ if (ec)
++ {
++ BMCWEB_LOG_CRITICAL
++ << "Failed in doPost(BiosChangePassword) "
++ << ec;
++ messages::internalError(asyncResp->res);
++ return;
++ }
++ },
++ "xyz.openbmc_project.BIOSConfigPassword",
++ "/xyz/openbmc_project/bios_config/password",
++ "xyz.openbmc_project.BIOSConfig.Password", "ChangePassword",
++ userName, currentPassword, newPassword);
++ });
++}
+
- } // namespace redfish
+ /**
+ * BiosSettings class supports handle GET/PATCH method for
+ * BIOS configuration pending settings.
--
2.17.1