Fix StepParsePreload 91/208091/2
authorSangyoon Jang <jeremy.jang@samsung.com>
Tue, 18 Jun 2019 07:04:50 +0000 (16:04 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Tue, 18 Jun 2019 07:29:31 +0000 (16:29 +0900)
Allow handle readonly package when ReadonlyUpdateUninstall mode.
ReadonlyUpdateUninstall mode makes the package as readonly package back.

Change-Id: I0a0fc007e73b3497b125833c7904192c3024aec3
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/common/step/configuration/step_parse_preload.cc

index 80db897..6d5491a 100644 (file)
@@ -24,6 +24,7 @@ namespace common_installer {
 namespace configuration {
 
 ci::Step::Status StepParsePreload::process() {
+  RequestType req_type = context_->request_type.get();
   const char* readonly_val = context_->manifest_data.get()->readonly;
   if (!readonly_val || (readonly_val && strlen(readonly_val) == 0)) {
     if (readonly_val)
@@ -31,7 +32,7 @@ ci::Step::Status StepParsePreload::process() {
     if (context_->is_readonly_package.get()) {
       context_->manifest_data.get()->readonly = strdup("true");
 
-      if (getuid() != 0) {
+      if (getuid() != 0 && req_type != RequestType::ReadonlyUpdateUninstall) {
         LOG(ERROR) << "You're not authorized to install readonly app: "
             << context_->pkgid.get().c_str();
         return Status::OPERATION_NOT_ALLOWED;
@@ -42,7 +43,6 @@ ci::Step::Status StepParsePreload::process() {
   }
 
   PkgQueryInterface pkg_query(context_->pkgid.get(), context_->uid.get());
-  RequestType req_type = context_->request_type.get();
   const char* preload_val = context_->manifest_data.get()->preload;
   if (!preload_val || (preload_val && strlen(preload_val) == 0)) {
     if (preload_val)