Fix global apps deinstallation 84/76384/2
authorRadoslaw Bartosiak <r.bartosiak@samsung.com>
Thu, 23 Jun 2016 14:33:12 +0000 (16:33 +0200)
committerTomasz Swierczek <t.swierczek@samsung.com>
Thu, 23 Jun 2016 14:43:51 +0000 (07:43 -0700)
Change-Id: I374ad96218304714af15f23dbfdf1173fbd56c3a
Signed-off-by: Radoslaw Bartosiak <r.bartosiak@samsung.com>
src/client/client-security-manager.cpp
src/common/service_impl.cpp
src/server/service/service.cpp

index 55109fc..97d8854 100644 (file)
@@ -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);
index 2016607..085c3a8 100644 (file)
@@ -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");
index 510f0b0..dc3d268 100644 (file)
@@ -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)));
 }