Skip to content

Commit

Permalink
shadowlock: disable until proper unit tests are run
Browse files Browse the repository at this point in the history
Commit 8eb5397 fixed an issue where the shadowlock objects were not
being created or used. That brought to light an issue with the
implementation of that class. For now, comment out the use of the
shadowlock to get us back to where we were prior to the commit and give
us some time to fix it and ensure all tests pass as expected.

See #10 for more details.

Signed-off-by: Andrew Geissler <[email protected]>
Change-Id: I570dd6bd3a308e3608525f5e08182c6491fbb7a3
  • Loading branch information
geissonator committed May 14, 2021
1 parent 8eb5397 commit a260f18
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions user_mgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ void UserMgr::createUser(std::string userName,
throwForInvalidPrivilege(priv);
throwForInvalidGroups(groupNames);
// All user management lock has to be based on /etc/shadow
phosphor::user::shadow::Lock lock{};
// TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{};
throwForUserExists(userName);
throwForUserNameConstraints(userName, groupNames);
throwForMaxGrpUserCount(groupNames);
Expand Down Expand Up @@ -346,7 +346,7 @@ void UserMgr::createUser(std::string userName,
void UserMgr::deleteUser(std::string userName)
{
// All user management lock has to be based on /etc/shadow
phosphor::user::shadow::Lock lock{};
// TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{};
throwForUserDoesNotExist(userName);
try
{
Expand All @@ -369,7 +369,7 @@ void UserMgr::deleteUser(std::string userName)
void UserMgr::renameUser(std::string userName, std::string newUserName)
{
// All user management lock has to be based on /etc/shadow
phosphor::user::shadow::Lock lock{};
// TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{};
throwForUserDoesNotExist(userName);
throwForUserExists(newUserName);
throwForUserNameConstraints(newUserName,
Expand Down Expand Up @@ -410,7 +410,7 @@ void UserMgr::updateGroupsAndPriv(const std::string& userName,
throwForInvalidPrivilege(priv);
throwForInvalidGroups(groupNames);
// All user management lock has to be based on /etc/shadow
phosphor::user::shadow::Lock lock{};
// TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{};
throwForUserDoesNotExist(userName);
const std::vector<std::string>& oldGroupNames =
usersList[userName].get()->userGroups();
Expand Down Expand Up @@ -645,7 +645,7 @@ int UserMgr::setPamModuleArgValue(const std::string& moduleName,
void UserMgr::userEnable(const std::string& userName, bool enabled)
{
// All user management lock has to be based on /etc/shadow
phosphor::user::shadow::Lock lock{};
// TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{};
throwForUserDoesNotExist(userName);
try
{
Expand Down Expand Up @@ -678,7 +678,7 @@ static constexpr size_t t2OutputIndex = 1;
bool UserMgr::userLockedForFailedAttempt(const std::string& userName)
{
// All user management lock has to be based on /etc/shadow
phosphor::user::shadow::Lock lock{};
// TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{};
std::vector<std::string> output;

output = executeCmd("/usr/sbin/pam_tally2", "-u", userName.c_str());
Expand Down Expand Up @@ -716,7 +716,7 @@ bool UserMgr::userLockedForFailedAttempt(const std::string& userName,
const bool& value)
{
// All user management lock has to be based on /etc/shadow
phosphor::user::shadow::Lock lock{};
// TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{};
std::vector<std::string> output;
if (value == true)
{
Expand All @@ -735,7 +735,7 @@ bool UserMgr::userLockedForFailedAttempt(const std::string& userName,
bool UserMgr::userPasswordExpired(const std::string& userName)
{
// All user management lock has to be based on /etc/shadow
phosphor::user::shadow::Lock lock{};
// TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{};

struct spwd spwd
{};
Expand Down Expand Up @@ -780,7 +780,7 @@ bool UserMgr::userPasswordExpired(const std::string& userName)
UserSSHLists UserMgr::getUserAndSshGrpList()
{
// All user management lock has to be based on /etc/shadow
phosphor::user::shadow::Lock lock{};
// TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{};

std::vector<std::string> userList;
std::vector<std::string> sshUsersList;
Expand Down Expand Up @@ -838,7 +838,7 @@ size_t UserMgr::getIpmiUsersCount()
bool UserMgr::isUserEnabled(const std::string& userName)
{
// All user management lock has to be based on /etc/shadow
phosphor::user::shadow::Lock lock{};
// TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{};
std::array<char, 4096> buffer{};
struct spwd spwd;
struct spwd* resultPtr = nullptr;
Expand Down Expand Up @@ -1105,7 +1105,7 @@ UserInfoMap UserMgr::getUserInfo(std::string userName)
void UserMgr::initUserObjects(void)
{
// All user management lock has to be based on /etc/shadow
phosphor::user::shadow::Lock lock{};
// TODO phosphor-user-manager#10 phosphor::user::shadow::Lock lock{};
std::vector<std::string> userNameList;
std::vector<std::string> sshGrpUsersList;
UserSSHLists userSSHLists = getUserAndSshGrpList();
Expand Down

0 comments on commit a260f18

Please sign in to comment.