From: Radoslaw Bartosiak Date: Thu, 23 Jun 2016 14:33:12 +0000 (+0200) Subject: Fix global apps deinstallation X-Git-Tag: accepted/tizen/common/20160627.191623~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=32e9c15dd44db3f82aa1a5e747394f3836e74d75;p=platform%2Fcore%2Fsecurity%2Fsecurity-manager.git Fix global apps deinstallation Change-Id: I374ad96218304714af15f23dbfdf1173fbd56c3a Signed-off-by: Radoslaw Bartosiak --- diff --git a/src/client/client-security-manager.cpp b/src/client/client-security-manager.cpp index 55109fc..97d8854 100644 --- a/src/client/client-security-manager.cpp +++ b/src/client/client-security-manager.cpp @@ -266,7 +266,14 @@ int security_manager_app_uninstall(const app_inst_req *p_req) //put data into buffer Serialization::Serialize(send, (int)SecurityModuleCall::APP_UNINSTALL, - p_req->appName); + p_req->appName, + p_req->pkgName, + p_req->privileges, + p_req->pkgPaths, + p_req->uid, + p_req->tizenVersion, + p_req->authorName, + p_req->installationType); //send buffer to server int retval = sendToServer(SERVICE_SOCKET, send.Pop(), recv); diff --git a/src/common/service_impl.cpp b/src/common/service_impl.cpp index 2016607..085c3a8 100644 --- a/src/common/service_impl.cpp +++ b/src/common/service_impl.cpp @@ -276,7 +276,8 @@ void ServiceImpl::setRequestDefaultValues(uid_t& uid, int& installationType) uid_t globalUid = getGlobalUserId(); if (installationType == SM_APP_INSTALL_NONE) - installationType = (uid == 0) ? SM_APP_INSTALL_GLOBAL : SM_APP_INSTALL_LOCAL; + installationType = ((uid == 0) || (uid == globalUid)) ? SM_APP_INSTALL_GLOBAL : + SM_APP_INSTALL_LOCAL; if ((installationType == SM_APP_INSTALL_GLOBAL) || (installationType == SM_APP_INSTALL_PRELOADED)) uid = globalUid; @@ -310,6 +311,10 @@ bool ServiceImpl::authCheck(const Credentials &creds, LogError("Caller is not permitted to manage applications for other users"); return false; } + if (uid == getGlobalUserId()) { + LogError("Request local installation for global uid=" << uid); + return false; + } } else { if (!authenticate(creds, Config::PRIVILEGE_APPINST_ADMIN)) { LogError("Caller is not permitted to manage global applications"); diff --git a/src/server/service/service.cpp b/src/server/service/service.cpp index 510f0b0..dc3d268 100644 --- a/src/server/service/service.cpp +++ b/src/server/service/service.cpp @@ -178,8 +178,14 @@ void Service::processAppUninstall(MessageBuffer &buffer, MessageBuffer &send, co { app_inst_req req; - req.uid = creds.uid; Deserialization::Deserialize(buffer, req.appName); + Deserialization::Deserialize(buffer, req.pkgName); + Deserialization::Deserialize(buffer, req.privileges); + Deserialization::Deserialize(buffer, req.pkgPaths); + Deserialization::Deserialize(buffer, req.uid); + Deserialization::Deserialize(buffer, req.tizenVersion); + Deserialization::Deserialize(buffer, req.authorName); + Deserialization::Deserialize(buffer, req.installationType); Serialization::Serialize(send, serviceImpl.appUninstall(creds, std::move(req))); }