From 23a5ce599a85820625250456d1f770ffb835d46a Mon Sep 17 00:00:00 2001 From: Yunjin Lee Date: Thu, 17 Mar 2016 17:55:23 -0700 Subject: [PATCH] Revert "Add installation types (global, local, preloaded)." This reverts commit 46fb8b487d05fc36959e8595c742fc10e5fc2ff2. Change-Id: I67496a1682467ba45a4d368ca8924804f414cc58 --- src/client/client-security-manager.cpp | 20 +------------------- src/cmd/security-manager-cmd.cpp | 13 ++----------- src/common/include/protocols.h | 1 - src/common/include/service_impl.h | 2 +- src/common/service_impl.cpp | 23 +++++++---------------- src/include/app-manager.h | 12 ------------ src/include/security-manager-types.h | 9 --------- src/server/service/service.cpp | 1 - 8 files changed, 11 insertions(+), 70 deletions(-) diff --git a/src/client/client-security-manager.cpp b/src/client/client-security-manager.cpp index 472781f..1e0fbcf 100755 --- a/src/client/client-security-manager.cpp +++ b/src/client/client-security-manager.cpp @@ -91,12 +91,6 @@ int security_manager_app_inst_req_new(app_inst_req **pp_req) } (*pp_req)->uid = geteuid(); - uid_t globalUid = tzplatform_getuid(TZ_SYS_GLOBALAPP_USER); - if ((*pp_req)->uid == 0 || (*pp_req)->uid == globalUid) - (*pp_req)->installationType = static_cast(SM_APP_INSTALL_GLOBAL); - else - (*pp_req)->installationType = static_cast(SM_APP_INSTALL_LOCAL); - return SECURITY_MANAGER_SUCCESS; } @@ -184,17 +178,6 @@ int security_manager_app_inst_req_add_path(app_inst_req *p_req, const char *path } SECURITY_MANAGER_API -int security_manager_app_inst_req_set_install_type(app_inst_req *p_req, const enum app_install_type type) -{ - if (!p_req || (type <= SM_APP_INSTALL_NONE) || (type >= SM_APP_INSTALL_END)) - return SECURITY_MANAGER_ERROR_INPUT_PARAM; - - p_req->installationType = static_cast(type); - - return SECURITY_MANAGER_SUCCESS; -} - -SECURITY_MANAGER_API int security_manager_app_install(const app_inst_req *p_req) { using namespace SecurityManager; @@ -222,8 +205,7 @@ int security_manager_app_install(const app_inst_req *p_req) p_req->appPaths, p_req->uid, p_req->tizenVersion, - p_req->authorName, - p_req->installationType); + p_req->authorName); //send buffer to server retval = sendToServer(SERVICE_SOCKET, send.Pop(), recv); diff --git a/src/cmd/security-manager-cmd.cpp b/src/cmd/security-manager-cmd.cpp index 0e9b5c5..a1f55e5 100644 --- a/src/cmd/security-manager-cmd.cpp +++ b/src/cmd/security-manager-cmd.cpp @@ -55,12 +55,6 @@ static std::map user_type_map = { {"normal", SM_USER_TYPE_NORMAL} }; -static std::map install_type_map = { - {"local", SM_APP_INSTALL_LOCAL}, - {"global", SM_APP_INSTALL_GLOBAL}, - {"preloaded", SM_APP_INSTALL_PRELOADED} -}; - static po::options_description getGenericOptions() { po::options_description opts("Generic options"); @@ -101,8 +95,6 @@ static po::options_description getInstallOptions() "user identifier number (required)") ("author-id,c", po::value(), "unique author's identifier (required for trusted_rw paths)") - ("install-type", po::value(), - "type of installation (local, global, preloaded") ; return opts; } @@ -244,10 +236,9 @@ static void parseInstallOptions(int argc, char *argv[], } if (vm.count("uid")) req.uid = vm["uid"].as(); - if (vm.count("author-id")) + if (vm.count("author-id")) { req.authorName = vm["author-id"].as(); - if (vm.count("install-type")) - req.installationType = install_type_map.at(vm["install-type"].as()); + } } diff --git a/src/common/include/protocols.h b/src/common/include/protocols.h index 984a5ab..940564b 100644 --- a/src/common/include/protocols.h +++ b/src/common/include/protocols.h @@ -40,7 +40,6 @@ struct app_inst_req { uid_t uid; std::string tizenVersion; std::string authorName; - int installationType; }; struct user_req { diff --git a/src/common/include/service_impl.h b/src/common/include/service_impl.h index def5618..296fd83 100644 --- a/src/common/include/service_impl.h +++ b/src/common/include/service_impl.h @@ -41,7 +41,7 @@ private: static bool isSubDir(const char *parent, const char *subdir); - static bool getUserAppDir(const uid_t &uid, const app_install_type &installType, std::string &userAppDir); + static bool getUserAppDir(const uid_t &uid, std::string &userAppDir); static bool installRequestAuthCheck(const app_inst_req &req, uid_t uid, std::string &appPath); diff --git a/src/common/service_impl.cpp b/src/common/service_impl.cpp index b551dca..0e06326 100755 --- a/src/common/service_impl.cpp +++ b/src/common/service_impl.cpp @@ -208,7 +208,7 @@ bool ServiceImpl::isSubDir(const char *parent, const char *subdir) return (*subdir == '/' || *parent == *subdir); } -bool ServiceImpl::getUserAppDir(const uid_t &uid, const app_install_type &installType, std::string &userAppDir) +bool ServiceImpl::getUserAppDir(const uid_t &uid, std::string &userAppDir) { struct tzplatform_context *tz_ctx = nullptr; @@ -221,15 +221,8 @@ bool ServiceImpl::getUserAppDir(const uid_t &uid, const app_install_type &instal if (tzplatform_context_set_user(tz_ctxPtr.get(), uid)) return false; - enum tzplatform_variable id; - - if (installType == SM_APP_INSTALL_LOCAL) - id = TZ_USER_APP; - else if (installType == SM_APP_INSTALL_GLOBAL) - id = TZ_SYS_RW_APP; - else - id = TZ_SYS_RO_APP; - + enum tzplatform_variable id = + (uid == getGlobalUserId()) ? TZ_SYS_RW_APP : TZ_USER_APP; const char *appDir = tzplatform_context_getenv(tz_ctxPtr.get(), id); if (!appDir) return false; @@ -249,14 +242,12 @@ bool ServiceImpl::installRequestAuthCheck(const app_inst_req &req, uid_t uid, st std::string userAppDir; std::stringstream correctPath; - if (static_cast(req.installationType) == SM_APP_INSTALL_LOCAL) - LogDebug("Installation type: local"); - else if (static_cast(req.installationType) == SM_APP_INSTALL_GLOBAL) - LogDebug("Installation type: global"); + if (uid != getGlobalUserId()) + LogDebug("Installation type: single user"); else - LogDebug("Installation type: preloaded"); + LogDebug("Installation type: global installation"); - if (!getUserAppDir(uid, static_cast(req.installationType), userAppDir)) { + if (!getUserAppDir(uid, userAppDir)) { LogError("Failed getting app dir for user uid: " << uid); return false; } diff --git a/src/include/app-manager.h b/src/include/app-manager.h index b4fb36b..1d90b6a 100644 --- a/src/include/app-manager.h +++ b/src/include/app-manager.h @@ -112,18 +112,6 @@ int security_manager_app_inst_req_set_uid(app_inst_req *p_req, int security_manager_app_inst_req_set_author_id(app_inst_req *p_req, const char *author_id); /* - * This function is used to set up installation type (global, local, preloaded). - * If type is not set and if installation is performed by global user, type is set to - * 'SM_APP_INSTALL_GLOBAL'. Otherwise installation type is set to 'SM_APP_INSTALL_LOCAL'. - * - * \param[in] Pointer handling app_inst_req structure - * \param[in] Installation type - * \return API return code or error code - * - */ -int security_manager_app_inst_req_set_install_type(app_inst_req *p_req, const enum app_install_type type); - -/* * This function is used to install application based on * using filled up app_inst_req data structure * diff --git a/src/include/security-manager-types.h b/src/include/security-manager-types.h index df17a5a..0acf328 100644 --- a/src/include/security-manager-types.h +++ b/src/include/security-manager-types.h @@ -66,15 +66,6 @@ enum app_install_path_type { SECURITY_MANAGER_ENUM_END }; -enum app_install_type : int { - SM_APP_INSTALL_NONE = 0, - SM_APP_INSTALL_LOCAL, - SM_APP_INSTALL_GLOBAL, - SM_APP_INSTALL_PRELOADED, - SM_APP_INSTALL_END -}; -typedef enum app_install_type app_install_type; - /** * This enum has values equivalent to gumd user type. * The gum-utils help states that diff --git a/src/server/service/service.cpp b/src/server/service/service.cpp index d5ac17a..50e5635 100644 --- a/src/server/service/service.cpp +++ b/src/server/service/service.cpp @@ -175,7 +175,6 @@ void Service::processAppInstall(MessageBuffer &buffer, MessageBuffer &send, uid_ Deserialization::Deserialize(buffer, req.uid); Deserialization::Deserialize(buffer, req.tizenVersion); Deserialization::Deserialize(buffer, req.authorName); - Deserialization::Deserialize(buffer, req.installationType); Serialization::Serialize(send, serviceImpl.appInstall(req, uid)); } -- 2.7.4