Enable encoding object paths of User Name
Any string used to form a Dbus object path needs to be encoded.
This commit enables encoding the User Name before using it in the
Object path.
This commit also replaces the old method of
std::filesystem::path(path).filename() with object_path.filename()
which correctly decodes and gets the User name from the Object
path.
Tested:
- busctl call xyz.openbmc_project.User.Manager
/xyz/openbmc_project/user xyz.openbmc_project.User.Manager
CreateUser sassb _test_6566 4 "ipmi" "redfish" "ssh" "web"
priv-admin true
- Successfully created /xyz/openbmc_project/user/_5ftest_5f6566
Object Path
- ipmitool user list 3
Displayed "_5ftest_5f6566" (Due to Absence of Decoding in
phosphor-host-ipmid)
With the changes in ipmid at https://gerrit.openbmc-project.xyz
/c/openbmc/phosphor-host-ipmid/+/49621 this name will be
correctly decoded to _test_6566.
- ipmitool user set name "_test_123"
- Successfully created /xyz/openbmc_project/user/_5ftest_5f123
Object Path
- ipmitool user list 3
Displayed the user _test_123 (Due to Absence of Decoding in
phosphor-host-ipmid)
- busctl call xyz.openbmc_project.User.Manager
/xyz/openbmc_project/user xyz.openbmc_project.User.Manager
RenameUser ss _test_6566 _test_7576
- Successfully created /xyz/openbmc_project/user/_5ftest_5f7576
Object Path
- ipmitool user list 3
Displayed "_5ftest_5f7576" (Due to Absence of Decoding in
phosphor-host-ipmid)
Signed-off-by: P Dheeraj Srujan Kumar <p.dheeraj.srujan.kumar@intel.com>
Change-Id: If39bdc74b67fa1931ea451d3cb5befa77daee83c
3 files changed