summaryrefslogtreecommitdiffstats
path: root/user_channel
diff options
context:
space:
mode:
authorRichard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>2019-05-09 00:37:55 +0530
committerRichard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>2019-05-15 01:54:22 +0000
commite004e221800a43b2569c0a337674433ffa61e7a4 (patch)
treeb76ba19d21337d93421915200692b85a0f86073c /user_channel
parent5f7ac71048ed04e6f4f2a5ff04f0da8f0722635e (diff)
downloadphosphor-host-ipmid-e004e221800a43b2569c0a337674433ffa61e7a4.tar.gz
phosphor-host-ipmid-e004e221800a43b2569c0a337674433ffa61e7a4.zip
user-mgmt: Update user data file, only for sync.
IPMI user configuration is cross synced with phosphor-user-manager and written to the non-volatile data on every boot. This commit limits the write only when there is real sync issue, and update required. Tested: 1. Verified the ipmitool user list & commands 2. Verified that file write happens only when there is real sync update with phosphor-user-manager Change-Id: Ia40be91f281656288ca96ca44bc9699daee7c3b4 Signed-off-by: Richard Marian Thomaiyar <richard.marian.thomaiyar@linux.intel.com>
Diffstat (limited to 'user_channel')
-rw-r--r--user_channel/user_mgmt.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/user_channel/user_mgmt.cpp b/user_channel/user_mgmt.cpp
index 41ec5fa..a1d2443 100644
--- a/user_channel/user_mgmt.cpp
+++ b/user_channel/user_mgmt.cpp
@@ -1365,7 +1365,7 @@ void UserAccess::initUserDataFile()
entry("PATH=%s", userMgrObjBasePath));
return;
}
-
+ bool updateRequired = false;
UsersTbl* userData = &usersTbl;
// user index 0 is reserved, starts with 1
for (size_t usrIdx = 1; usrIdx <= ipmiMaxUsers; ++usrIdx)
@@ -1392,6 +1392,7 @@ void UserAccess::initUserDataFile()
if (std::find(usrGrps.begin(), usrGrps.end(), ipmiGrpName) ==
usrGrps.end())
{
+ updateRequired = true;
// Group "ipmi" is removed so lets remove user in IPMI
deleteUserIndex(usrIdx);
}
@@ -1407,6 +1408,7 @@ void UserAccess::initUserDataFile()
.userPrivAccess[getUsrMgmtSyncIndex()]
.privilege != priv)
{
+ updateRequired = true;
for (size_t chIndex = 0; chIndex < ipmiMaxChannels;
++chIndex)
{
@@ -1417,6 +1419,7 @@ void UserAccess::initUserDataFile()
}
if (userData->user[usrIdx].userEnabled != usrEnabled)
{
+ updateRequired = true;
userData->user[usrIdx].userEnabled = usrEnabled;
}
}
@@ -1426,6 +1429,7 @@ void UserAccess::initUserDataFile()
}
else
{
+ updateRequired = true;
deleteUserIndex(usrIdx);
}
}
@@ -1449,6 +1453,7 @@ void UserAccess::initUserDataFile()
if (std::find(usrGrps.begin(), usrGrps.end(), ipmiGrpName) !=
usrGrps.end())
{
+ updateRequired = true;
// CREATE NEW USER
if (true != addUserEntry(userName, usrPriv, usrEnabled))
{
@@ -1457,8 +1462,11 @@ void UserAccess::initUserDataFile()
}
}
- // All userData slots update done. Lets write the data
- writeUserData();
+ if (updateRequired)
+ {
+ // All userData slots update done. Lets write the data
+ writeUserData();
+ }
return;
}
OpenPOWER on IntegriCloud