diff options
author | Tomasz Swierczek <t.swierczek@samsung.com> | 2024-07-08 09:42:44 +0200 |
---|---|---|
committer | Tomasz Swierczek <t.swierczek@samsung.com> | 2024-07-08 09:54:22 +0200 |
commit | 6fb3b38cdd65f104de1c61321bc15ce5c9a6672d (patch) | |
tree | 976a307741dfa84f3d13ee8d40b402c4d0cfb8f0 | |
parent | e7b3e8adba022c6cf7514581d024e8654089fbbe (diff) | |
download | security-manager-6fb3b38cdd65f104de1c61321bc15ce5c9a6672d.tar.gz security-manager-6fb3b38cdd65f104de1c61321bc15ce5c9a6672d.tar.bz2 security-manager-6fb3b38cdd65f104de1c61321bc15ce5c9a6672d.zip |
Remove pkg existance check in labelPaths function
The function is called 2 out of 3 times in places
where the package was already added (appInstall, appUpdate),
so no check is needed.
Added the check manually before function call in registering paths API,
where in fact we need to return invalid param for backward compatibility.
Change-Id: I7fb8b967409972ef1f0734f40320682b6bf6cc1b
-rw-r--r-- | src/common/service_impl.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/common/service_impl.cpp b/src/common/service_impl.cpp index fd612f4f..71e748c3 100644 --- a/src/common/service_impl.cpp +++ b/src/common/service_impl.cpp @@ -349,11 +349,6 @@ int ServiceImpl::labelPaths(const pkg_paths &paths, bool isSharedRO) { try { - if (!m_privilegeDb.PkgNameExists(pkgName)) { - LogError("No such package: " << pkgName); - return SECURITY_MANAGER_ERROR_INPUT_PARAM; - } - std::string authorHash; m_privilegeDb.GetPkgAuthorHash(pkgName, authorHash); @@ -1934,6 +1929,11 @@ int ServiceImpl::pathsRegister(const Credentials &creds, path_req req) if (req.pkgPaths.empty()) return SECURITY_MANAGER_SUCCESS; + if (!m_privilegeDb.PkgNameExists(req.pkgName)) { + LogError("No such package: " << req.pkgName); + return SECURITY_MANAGER_ERROR_INPUT_PARAM; + } + try { setRequestDefaultValues(req.uid, req.installationType); |