user_channel:Remove unused ipmiUserSetUserName API
ipmiUserSetUserName API signature is changed to use string variable.
So removed unused API
Tested:
Verified using ipmitool commands.
Command: ipmitool user set name 4 user4
Response: //Success
Command: ipmitool user set password 4 asdf1234
Response: Set User Password command successful (user 4)
Command: ipmitool user priv 4 0x03 1
Response: Set Privilege Level command successful (user 4)
Command: ipmitool user set name 14 user13asdfghkjlqwert
Response: Username is too long (> 16 bytes)
Command: ipmitool -I lanplus -C 17 -p 623 -U root -P <password> -H
<BMC-IP> user set name 8 WIJGueNKd
Response: //Success
Command: ipmitool user list 1 //User list for channel 1
Response:
ID Name Callin Link Auth IPMI Msg Channel Priv Limit
1 root false true true ADMINISTRATOR
2 true false false NO ACCESS
3 true false false NO ACCESS
4 user4 true false false OPERATOR
5 WIJGueNKda true false false NO ACCESS
6 true false false NO ACCESS
7 true false false NO ACCESS
8 WIJGueNKd true false false NO ACCESS
9 true false false NO ACCESS
Signed-off-by: jayaprakash Mutyala <mutyalax.jayaprakash@intel.com>
Change-Id: I6ae8349f61fc658d4e74d923711325eae6f8088a
diff --git a/user_channel/user_layer.hpp b/user_channel/user_layer.hpp
index 0639474..01b6634 100644
--- a/user_channel/user_layer.hpp
+++ b/user_channel/user_layer.hpp
@@ -135,13 +135,10 @@
uint8_t ipmiUserGetUserId(const std::string& userName);
/** @brief set's user name
- *
- * @param[in] userId - user id
- * @param[in] userName - user name
- *
- * @return ccSuccess for success, others for failure.
+ * This API is deprecated
*/
-Cc ipmiUserSetUserName(const uint8_t userId, const char* userName);
+Cc ipmiUserSetUserName(const uint8_t userId, const char* userName)
+ __attribute__((deprecated));
/** @brief set's user name
*
diff --git a/user_channel/usercommands.cpp b/user_channel/usercommands.cpp
index 36c6ebc..bda4027 100644
--- a/user_channel/usercommands.cpp
+++ b/user_channel/usercommands.cpp
@@ -292,8 +292,12 @@
return ccParmOutOfRange;
}
- return ipmiUserSetUserName(req->userId,
- reinterpret_cast<const char*>(req->userName));
+ size_t nameLen = strnlen(reinterpret_cast<const char*>(req->userName),
+ sizeof(req->userName));
+ const std::string strUserName(reinterpret_cast<const char*>(req->userName),
+ nameLen);
+
+ return ipmiUserSetUserName(req->userId, strUserName);
}
/** @brief implementes the get user name command