Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions redfish-core/lib/log_services.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include "bmcweb_config.h"

#include "account_service.hpp"
#include "app.hpp"
#include "async_resp.hpp"
#include "dbus_singleton.hpp"
Expand Down Expand Up @@ -1111,6 +1112,22 @@ inline void createDump(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
}
if (resourceDumpParams.size() == 3)
{
// Check if admin user is initiating resource dump with
// non-empty pwd
std::string roleId =
getRoleIdFromPrivilege(req.session->userRole);
if (roleId == "Administrator")
{
if (std::holds_alternative<std::string>(
resourceDumpParams[2]) &&
!std::get<std::string>(resourceDumpParams[2]).empty())
{
BMCWEB_LOG_WARNING(
"Request to create resource dump failed. User has insufficient privilege.");
messages::insufficientPrivilege(asyncResp->res);
return;
}
}
createDumpParams.emplace_back(
"com.ibm.Dump.Create.CreateParameters.Password",
resourceDumpParams[2]);
Expand All @@ -1125,6 +1142,7 @@ inline void createDump(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
"/redfish/v1/Systems/system/LogServices/Dump/Actions/LogService.CollectDiagnosticData"));
return;
}

createDumpParams.emplace_back(
"com.ibm.Dump.Create.CreateParameters.DumpType",
"com.ibm.Dump.Create.DumpType.Resource");
Expand Down