Forbid installation for superuser 85/44085/2
authorTomasz Iwanek <t.iwanek@samsung.com>
Thu, 16 Jul 2015 09:11:58 +0000 (11:11 +0200)
committerPawel Sikorski <p.sikorski@samsung.com>
Thu, 16 Jul 2015 15:16:39 +0000 (08:16 -0700)
App-installers binaries should be run with
normal user or tizenglobalapp.

Change-Id: I0b13457e6760678fe21843a60bb98f035d5f50f8

src/common/step/step_configure.cc
src/common/step/step_configure.h

index e17981f..802ac60 100644 (file)
@@ -50,6 +50,14 @@ Step::Status StepConfigure::process() {
   return Status::OK;
 }
 
+Step::Status StepConfigure::precheck() {
+  if (getuid() == 0) {
+    LOG(ERROR) << "App-installer should not run with superuser!";
+    return Status::ERROR;
+  }
+  return Status::OK;
+}
+
 bool StepConfigure::SetupRootAppDirectory() {
   if (context_->root_application_path.get().empty()) {
     std::string root_app_path =
index e0dcce3..251064d 100644 (file)
@@ -26,7 +26,7 @@ class StepConfigure : public Step {
   Status process() override;
   Status clean() override { return Status::OK; }
   Status undo() override { return Status::OK; }
-  Status precheck() override { return Status::OK; }
+  Status precheck() override;
  private:
   bool SetupRootAppDirectory();