summaryrefslogtreecommitdiffstats
path: root/user_channel/usercommands.cpp
diff options
context:
space:
mode:
authorRichard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>2018-12-08 17:38:25 +0530
committerVernon Mauery <vernon.mauery@linux.intel.com>2018-12-20 00:01:53 +0000
commit06df8765c586d03211177efd4aa095a5418dbf91 (patch)
treedf9d13a1ae0429f251d0dcc13acbfd6e8062df08 /user_channel/usercommands.cpp
parentf1d0e23b8f133d817896ce1cb2f288aefc61a81f (diff)
downloadphosphor-host-ipmid-06df8765c586d03211177efd4aa095a5418dbf91.tar.gz
phosphor-host-ipmid-06df8765c586d03211177efd4aa095a5418dbf91.zip
User commands updated to handle channel request
User commands updated to handle channel request properly. 1. Self channel number 0xE will be converted properly as per the interfaces 2. Will handle commands to set / get access for session based channels only. Unit-test: Verfied get / set user access command works on self-channel and session based channels accordingly. 0xCC will returned for session-less channels Change-Id: I91f610e5a70ba648a90191b7aad6ae09d4e0acdc Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
Diffstat (limited to 'user_channel/usercommands.cpp')
-rw-r--r--user_channel/usercommands.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/user_channel/usercommands.cpp b/user_channel/usercommands.cpp
index b0997d5..3bed8c5 100644
--- a/user_channel/usercommands.cpp
+++ b/user_channel/usercommands.cpp
@@ -17,6 +17,7 @@
#include "usercommands.hpp"
#include "apphandler.hpp"
+#include "channel_layer.hpp"
#include "user_layer.hpp"
#include <host-ipmid/ipmid-api.h>
@@ -196,12 +197,11 @@ ipmi_ret_t ipmiSetUserAccess(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
log<level::DEBUG>("Set user access - Invalid Length");
return IPMI_CC_REQ_DATA_LEN_INVALID;
}
+ uint8_t chNum = convertCurrentChannelNum(req->chNum);
if (req->reserved1 != 0 || req->reserved2 != 0 || req->reserved3 != 0 ||
- req->sessLimit != 0 ||
- (!ipmiUserIsValidChannel(req->chNum) ||
- (!ipmiUserIsValidPrivilege(req->privilege))))
- // TODO: Need to check for session support and return invalid field in
- // request
+ req->sessLimit != 0 || (!isValidChannel(chNum)) ||
+ (!ipmiUserIsValidPrivilege(req->privilege)) ||
+ (EChannelSessSupported::none == getChannelSessionSupport(chNum)))
{
log<level::DEBUG>("Set user access - Invalid field in request");
return IPMI_CC_INVALID_FIELD_REQUEST;
@@ -211,8 +211,7 @@ ipmi_ret_t ipmiSetUserAccess(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
log<level::DEBUG>("Set user access - Parameter out of range");
return IPMI_CC_PARM_OUT_OF_RANGE;
}
- // TODO: Determine the Channel number 0xE (Self Channel number ?)
- uint8_t chNum = req->chNum;
+
PrivAccess privAccess = {0};
if (req->bitsUpdate)
{
@@ -240,10 +239,10 @@ ipmi_ret_t ipmiGetUserAccess(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
log<level::DEBUG>("Get user access - Invalid Length");
return IPMI_CC_REQ_DATA_LEN_INVALID;
}
+ uint8_t chNum = convertCurrentChannelNum(req->chNum);
if (req->reserved1 != 0 || req->reserved2 != 0 ||
- (!ipmiUserIsValidChannel(req->chNum)))
- // TODO: Need to check for session support and return invalid field in
- // request
+ (!isValidChannel(chNum)) ||
+ (EChannelSessSupported::none == getChannelSessionSupport(chNum)))
{
log<level::DEBUG>("Get user access - Invalid field in request");
return IPMI_CC_INVALID_FIELD_REQUEST;
@@ -256,8 +255,6 @@ ipmi_ret_t ipmiGetUserAccess(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
uint8_t maxChUsers = 0, enabledUsers = 0, fixedUsers = 0;
bool enabledState = false;
- // TODO: Determine the Channel number 0xE (Self Channel number ?)
- uint8_t chNum = req->chNum;
GetUserAccessResp* resp = static_cast<GetUserAccessResp*>(response);
std::fill(reinterpret_cast<uint8_t*>(resp),
OpenPOWER on IntegriCloud