diff options
author | Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com> | 2019-04-14 15:12:47 +0530 |
---|---|---|
committer | Vernon Mauery <vernon.mauery@linux.intel.com> | 2019-04-22 18:29:40 +0000 |
commit | 788362ce51d45977292e34c28c27d03523b14024 (patch) | |
tree | 8277e39c2adc9d004a248e322b303c91634caedc /user_channel/user_mgmt.cpp | |
parent | f442e119aed2dc87f320bf230ad39e7dc5c72524 (diff) | |
download | phosphor-host-ipmid-788362ce51d45977292e34c28c27d03523b14024.tar.gz phosphor-host-ipmid-788362ce51d45977292e34c28c27d03523b14024.zip |
API support to update password for special user
Provide API support to update password for special user.
This API will be used by OEM Command to update the special
user password - linux uid 0 (root user).
More details can be referred from
https://github.com/openbmc/docs/blob/master/user_management.md#deployment---out-of-factory
Tested:
1. Verified the API with OEM command implementation, and able to
configure the password for user exists in the system /etc/passwd.
2. Verified the negative case for failure
Change-Id: I3c2a7007587e52c7e713f0cd976f249dd84a5f75
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.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/user_channel/user_mgmt.cpp b/user_channel/user_mgmt.cpp index 6f4a79f..5ca2884 100644 --- a/user_channel/user_mgmt.cpp +++ b/user_channel/user_mgmt.cpp @@ -715,6 +715,17 @@ bool pamUpdatePasswd(const char* username, const char* password) return true; } +ipmi_ret_t UserAccess::setSpecialUserPassword(const std::string& userName, + const std::string& userPassword) +{ + if (!pamUpdatePasswd(userName.c_str(), userPassword.c_str())) + { + log<level::DEBUG>("Failed to update password"); + return IPMI_CC_UNSPECIFIED_ERROR; + } + return IPMI_CC_OK; +} + ipmi_ret_t UserAccess::setUserPassword(const uint8_t userId, const char* userPassword) { |