summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2021-12-20 20:17:28 +0300
committerEd Tanous <ed@tanous.net>2021-12-22 02:52:57 +0300
commit5dc924dd1f311df41fab0b48f853ff6ad50e81ef (patch)
tree3cfd3f1361dde0ed0da2631d234f3ff4b830fdae
parent62cd45af311e7741064c114581ba34186d6e508c (diff)
downloadbmcweb-5dc924dd1f311df41fab0b48f853ff6ad50e81ef.tar.xz
Make routing capture by const reference
Where possible, we should avoid doing async_method_calls that capture by mutable value. Tested: Ran redfish/v1 and webui. Both appear to function. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I3065a230568ac13f63ce030b6f19eabba1ece5fe
-rw-r--r--http/routing.hpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/http/routing.hpp b/http/routing.hpp
index 0a0dc74752..eca1b3a76e 100644
--- a/http/routing.hpp
+++ b/http/routing.hpp
@@ -1308,8 +1308,9 @@ class Router
crow::connections::systemBus->async_method_call(
[&req, asyncResp, &rules, ruleIndex, found](
const boost::system::error_code ec,
- std::map<std::string, std::variant<bool, std::string,
- std::vector<std::string>>>
+ const std::map<
+ std::string,
+ std::variant<bool, std::string, std::vector<std::string>>>&
userInfo) {
if (ec)
{
@@ -1335,7 +1336,7 @@ class Router
<< " userRole = " << *userRolePtr;
}
- bool* remoteUserPtr = nullptr;
+ const bool* remoteUserPtr = nullptr;
auto remoteUserIter = userInfo.find("RemoteUser");
if (remoteUserIter != userInfo.end())
{
@@ -1354,7 +1355,7 @@ class Router
bool passwordExpired = false; // default for remote user
if (!remoteUser)
{
- bool* passwordExpiredPtr = nullptr;
+ const bool* passwordExpiredPtr = nullptr;
auto passwordExpiredIter =
userInfo.find("UserPasswordExpired");
if (passwordExpiredIter != userInfo.end())