blob: 06cdd68bf5dda52c4c8ae9fa5944d8036e4280ba [file] [log] [blame]
Richard Marian Thomaiyar4654d992018-04-19 05:38:37 +05301/*
2// Copyright (c) 2018 Intel Corporation
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15*/
16
17#include "user_layer.hpp"
18
19#include "passwd_mgr.hpp"
20namespace
21{
22ipmi::PasswdMgr passwdMgr;
23}
24
25namespace ipmi
26{
27std::string ipmiUserGetPassword(const std::string& userName)
28{
29 return passwdMgr.getPasswdByUserName(userName);
30}
31
Richard Marian Thomaiyar42bed642018-09-21 12:28:57 +053032ipmi_ret_t ipmiClearUserEntryPassword(const std::string& userName)
AppaRao Pulib29b5ab2018-05-17 10:28:48 +053033{
Richard Marian Thomaiyar42bed642018-09-21 12:28:57 +053034 if (passwdMgr.updateUserEntry(userName, "") != 0)
35 {
36 return IPMI_CC_UNSPECIFIED_ERROR;
37 }
38 return IPMI_CC_OK;
39}
40
41ipmi_ret_t ipmiRenameUserEntryPassword(const std::string& userName,
42 const std::string& newUserName)
43{
44 if (passwdMgr.updateUserEntry(userName, newUserName) != 0)
45 {
46 return IPMI_CC_UNSPECIFIED_ERROR;
47 }
AppaRao Pulib29b5ab2018-05-17 10:28:48 +053048 return IPMI_CC_OK;
49}
50
Richard Marian Thomaiyar4654d992018-04-19 05:38:37 +053051} // namespace ipmi