summaryrefslogtreecommitdiffstats
path: root/user_channel/user_mgmt.cpp
diff options
context:
space:
mode:
authorRichard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>2018-12-06 13:20:38 +0530
committerRichard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>2018-12-13 00:40:55 +0000
commit8550b60fc2f3ef91e430298afaca018a6917192b (patch)
treec60772d123b99e38cfcb795afd61d5d3b270dc6d /user_channel/user_mgmt.cpp
parent812e44c7b6ff1e25b8cf79e8595db86bae7a98a5 (diff)
downloadphosphor-host-ipmid-8550b60fc2f3ef91e430298afaca018a6917192b.tar.gz
phosphor-host-ipmid-8550b60fc2f3ef91e430298afaca018a6917192b.zip
SetUserName to return success - for same user name
Updated code to return IPMI_CC_OK, if set user name is requested to update with the same name for the user id. Unit-Test: Verified set user name for same user id with same name succeeds twice Verified negative case too. ipmitool -I lanplus -H xx.xx.xx.xx -U root -P 0penBmc user set name 2 test ipmitool -I lanplus -H xx.xx.xx.xx -U root -P 0penBmc user set name 2 test Change-Id: I31c45a3f02ea5de535a27ddfd159b1b6fa4a4b1a Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
Diffstat (limited to 'user_channel/user_mgmt.cpp')
-rw-r--r--user_channel/user_mgmt.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/user_channel/user_mgmt.cpp b/user_channel/user_mgmt.cpp
index 8ba4a94..641abf0 100644
--- a/user_channel/user_mgmt.cpp
+++ b/user_channel/user_mgmt.cpp
@@ -769,12 +769,17 @@ ipmi_ret_t UserAccess::setUserName(const uint8_t userId,
boost::interprocess::scoped_lock<boost::interprocess::named_recursive_mutex>
userLock{*userMutex};
- bool validUser = isValidUserName(userNameInChar);
std::string oldUser;
getUserName(userId, oldUser);
- UserInfo* userInfo = getUserInfo(userId);
std::string newUser(userNameInChar, 0, ipmiMaxUserName);
+ if (oldUser == newUser)
+ {
+ // requesting to set the same user name, return success.
+ return IPMI_CC_OK;
+ }
+ bool validUser = isValidUserName(userNameInChar);
+ UserInfo* userInfo = getUserInfo(userId);
if (newUser.empty() && !oldUser.empty())
{
// Delete existing user
OpenPOWER on IntegriCloud