diff options
author | Radoslaw Bartosiak <r.bartosiak@samsung.com> | 2017-03-08 18:24:59 +0100 |
---|---|---|
committer | jin-gyu.kim <jin-gyu.kim@samsung.com> | 2017-06-23 15:29:20 +0900 |
commit | 53164a2bf5f6b8caea19e2db5f5b5c246ffddd9b (patch) | |
tree | e4e5bd071f394ef73a56a4148f70d8456f8a007a | |
parent | 7b93050144b04fb24de49c70fc788448f2482306 (diff) | |
download | security-manager-53164a2bf5f6b8caea19e2db5f5b5c246ffddd9b.tar.gz security-manager-53164a2bf5f6b8caea19e2db5f5b5c246ffddd9b.tar.bz2 security-manager-53164a2bf5f6b8caea19e2db5f5b5c246ffddd9b.zip |
Change labelPaths logic for FOTAsubmit/tizen_3.0/20170623.063036accepted/tizen/3.0/wearable/20170630.081757accepted/tizen/3.0/tv/20170630.081750accepted/tizen/3.0/mobile/20170630.081745accepted/tizen/3.0/ivi/20170630.081805accepted/tizen/3.0/common/20170630.144106
pkgBasePath is labeled only if there is at least one path argument for labelPaths
that points to pkgBasePath.
Change-Id: I81763a8a38aa89700e87daf708a5e85c37b6dd20
Signed-off-by: Radoslaw Bartosiak <r.bartosiak@samsung.com>
-rw-r--r-- | src/common/include/service_impl.h | 2 | ||||
-rw-r--r-- | src/common/service_impl.cpp | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/common/include/service_impl.h b/src/common/include/service_impl.h index 46c9f247..bc75e50c 100644 --- a/src/common/include/service_impl.h +++ b/src/common/include/service_impl.h @@ -256,6 +256,8 @@ private: static bool isSubDir(const std::string &parent, const std::string &subdir); + static bool containSubDir(const std::string &parent, const pkg_paths &paths); + static bool getUserPkgDir(const uid_t &uid, const std::string &pkgName, app_install_type installType, diff --git a/src/common/service_impl.cpp b/src/common/service_impl.cpp index 2681700e..bec00605 100644 --- a/src/common/service_impl.cpp +++ b/src/common/service_impl.cpp @@ -263,6 +263,16 @@ bool ServiceImpl::isSubDir(const std::string &parent, const std::string &subdir) return (*str2 == '/' || *str1 == *str2); } +bool ServiceImpl::containSubDir(const std::string &parent, const pkg_paths &paths) +{ + + for(auto path : paths) { + if (isSubDir(parent, path.first)) + return true; + } + return false; +} + std::string ServiceImpl::realPath(const std::string &path) { auto real_pathPtr = makeUnique(realpath(path.c_str(), nullptr), free); @@ -417,7 +427,7 @@ int ServiceImpl::labelPaths(const pkg_paths &paths, if (!pathsOK) return SECURITY_MANAGER_ERROR_AUTHENTICATION_FAILED; - if (!paths.empty()) + if (containSubDir(pkgBasePath, paths)) SmackLabels::setupPkgBasePath(pkgBasePath); // register paths |