diff options
author | Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com> | 2018-07-31 13:41:36 +0530 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-10-01 20:28:57 -0400 |
commit | 7ba3c71cb31c6316e364d1c3c8abde249a6724d1 (patch) | |
tree | cb76320070b828a2ea7fa21cccf6379d203c1a70 /user_mgr.cpp | |
parent | f977b1af1ffc20407377ea98fe6586fac11756a1 (diff) | |
download | phosphor-user-manager-7ba3c71cb31c6316e364d1c3c8abde249a6724d1.tar.gz phosphor-user-manager-7ba3c71cb31c6316e364d1c3c8abde249a6724d1.zip |
Fix to include user id 0 in users list.
Fix to include user id 0 in users list of user manager service.
This enables to list out the user present in /etc/passwd file
even if it is root user with user id 0.
Unit test:
1. Made sure phosphor-user-manager service loads successfully
2. It listed root user / any user already present in /etc/passwd file.
Change-Id: I060d9581b7f433411e313b745d9d1b32e8680b7d
Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
Diffstat (limited to 'user_mgr.cpp')
-rw-r--r-- | user_mgr.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/user_mgr.cpp b/user_mgr.cpp index f407133..cba9366 100644 --- a/user_mgr.cpp +++ b/user_mgr.cpp @@ -456,8 +456,10 @@ UserSSHLists UserMgr::getUserAndSshGrpList() // Any error, break the loop. break; } - // All users whose UID >= 1000 and < 65534 - if ((pwp->pw_uid >= 1000) && (pwp->pw_uid < 65534)) + // Add all users whose UID >= 1000 and < 65534 + // and special UID 0. + if ((pwp->pw_uid == 0) || + ((pwp->pw_uid >= 1000) && (pwp->pw_uid < 65534))) { std::string userName(pwp->pw_name); userList.emplace_back(userName); |