summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjin-gyu.kim <jin-gyu.kim@samsung.com>2017-01-16 19:08:19 +0900
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>2017-01-17 13:32:14 +0100
commit45effbf75d78b9e519a904285ede885e7aad851b (patch)
tree2d914d2f925137a60c15567a36bf720ea761ec12
parentbe1210db31d8a4586c5791da2157be21a789d1ec (diff)
downloadsecurity-manager-45effbf75d78b9e519a904285ede885e7aad851b.tar.gz
security-manager-45effbf75d78b9e519a904285ede885e7aad851b.tar.bz2
security-manager-45effbf75d78b9e519a904285ede885e7aad851b.zip
Use real path of skel dir.
- Real path of skel dir can be diffrent based on target types. - Convert skel dir in getSkelPkgDir to the real path. - Add error handling in getSkelPkgDir Change-Id: Ifdd94a07f69da091a8f07b7fd55223fd157284b6
-rw-r--r--src/common/config.cpp2
-rw-r--r--src/common/include/service_impl.h2
-rw-r--r--src/common/service_impl.cpp14
3 files changed, 13 insertions, 5 deletions
diff --git a/src/common/config.cpp b/src/common/config.cpp
index 75b7f4a2..2f38867c 100644
--- a/src/common/config.cpp
+++ b/src/common/config.cpp
@@ -39,7 +39,7 @@ const std::string PRIVILEGE_APPSHARING_ADMIN = "http://tizen.org/privilege/notex
const std::string PRIVILEGE_SHM = "http://tizen.org/privilege/internal/shm";
const std::string APPS_LABELS_FILE = "apps-labels";
-const std::string SKEL_DIR = "/opt/etc/skel";
+const std::string SKEL_DIR = "/etc/skel";
const std::string PRIVACY_POLICY_DESC = "Ask user";
#ifdef ASKUSER_ENABLED
diff --git a/src/common/include/service_impl.h b/src/common/include/service_impl.h
index 3cb51a2c..46c9f247 100644
--- a/src/common/include/service_impl.h
+++ b/src/common/include/service_impl.h
@@ -261,7 +261,7 @@ private:
app_install_type installType,
std::string &userPkgDir);
- static void getSkelPkgDir(const std::string &pkgName,
+ static bool getSkelPkgDir(const std::string &pkgName,
std::string &skelPkgDir);
static void setRequestDefaultValues(uid_t& uid, int& installationType);
diff --git a/src/common/service_impl.cpp b/src/common/service_impl.cpp
index 1951ef49..e180f0ad 100644
--- a/src/common/service_impl.cpp
+++ b/src/common/service_impl.cpp
@@ -307,15 +307,22 @@ bool ServiceImpl::getUserPkgDir(const uid_t &uid,
return true;
}
-void ServiceImpl::getSkelPkgDir(const std::string &pkgName,
+bool ServiceImpl::getSkelPkgDir(const std::string &pkgName,
std::string &skelPkgDir)
{
std::string app = TizenPlatformConfig::getEnv(TZ_USER_APP);
std::string home = TizenPlatformConfig::getEnv(TZ_USER_HOME);
+ std::string real_skel_dir = std::move(realPath(Config::SKEL_DIR));
+ if (app.empty() || home.empty() || real_skel_dir.empty()) {
+ LogError("Unable to get skel pkg dir.");
+ return false;
+ }
skelPkgDir.assign(app);
- skelPkgDir.replace(0, home.length(), Config::SKEL_DIR);
+ skelPkgDir.replace(0, home.length(), real_skel_dir);
skelPkgDir.append("/").append(pkgName);
+
+ return true;
}
void ServiceImpl::setRequestDefaultValues(uid_t& uid, int& installationType)
@@ -402,7 +409,8 @@ int ServiceImpl::labelPaths(const pkg_paths &paths,
pathsOK = pathsCheck(paths, {pkgBasePath});
else {
std::string skelPkgBasePath;
- getSkelPkgDir(pkgName, skelPkgBasePath);
+ if (!getSkelPkgDir(pkgName, skelPkgBasePath))
+ return SECURITY_MANAGER_ERROR_SERVER_ERROR;
pathsOK = pathsCheck(paths, {pkgBasePath, skelPkgBasePath});
}