Handle skip-check-reference option 70/140470/4
authorSangyoon Jang <jeremy.jang@samsung.com>
Tue, 25 Jul 2017 06:11:10 +0000 (15:11 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Thu, 27 Jul 2017 06:48:35 +0000 (06:48 +0000)
A new installer option is introduced. When skip-check-reference flag is
set, installer will skip checking reference at signature validation step.

Requires:
 - https://review.tizen.org/gerrit/139436

Change-Id: If1a14a199456fb2a5aa200485626d75aa7f2222d
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/common/installer_context.h
src/common/pkgmgr_interface.cc
src/common/pkgmgr_interface.h
src/common/step/configuration/step_configure.cc
src/common/step/configuration/step_configure.h
src/common/step/security/step_check_signature.cc

index 348a199..95b1000 100644 (file)
@@ -357,6 +357,11 @@ class InstallerContext {
    * @brief External package mount object if delta update with external
    */
   std::unique_ptr<ExternalMount> external_mount;
+
+  /**
+   * @brief skip-check-reference flag received from pkgmgr_installer
+   */
+  Property<bool> skip_check_reference;
 };
 
 }  // namespace common_installer
index a001fb6..3040fe1 100644 (file)
@@ -273,4 +273,8 @@ bool PkgMgrInterface::GetDebugMode() const {
   return (pkgmgr_installer_get_debug_mode(pi_) == 1);
 }
 
+bool PkgMgrInterface::GetIsSkipCheckReference() const {
+  return (pkgmgr_installer_get_skip_check_reference(pi_) == 1);
+}
+
 }  // namespace common_installer
index 86beb19..202ce6c 100644 (file)
@@ -170,6 +170,15 @@ class PkgMgrInterface {
   bool GetDebugMode() const;
 
   /**
+   * Returns True if the request has skip-check-reference flag.
+   *         Otherwise, return false;
+   *
+   * \return True if the request has skip-check-reference flag.
+   *         Otherwise, return false;
+   */
+  bool GetIsSkipCheckReference() const;
+
+  /**
    * Get Raw pointer to pkgmgr_installer object
    * NOTE: It should not be used (PkgMgrInterface can destroy it
    *
index e8018fd..79ab53e 100644 (file)
@@ -38,6 +38,7 @@ Step::Status StepConfigure::process() {
   SetupRequestType();
   SetupFileCreationMask();
   SetupDebugMode();
+  SetupSkipCheckReference();
 
   if (!SetupRootAppDirectory())
     return Status::CONFIG_ERROR;
@@ -287,5 +288,9 @@ void StepConfigure::SetupDebugMode() {
   context_->debug_mode.set(pkgmgr_->GetDebugMode());
 }
 
+void StepConfigure::SetupSkipCheckReference() {
+  context_->skip_check_reference.set(pkgmgr_->GetIsSkipCheckReference());
+}
+
 }  // namespace configuration
 }  // namespace common_installer
index 45bffb0..a8894fd 100644 (file)
@@ -66,6 +66,7 @@ class StepConfigure : public Step {
   void SetupIsKeepRWData();
   void SetupIsPartialRW();
   void SetupDebugMode();
+  void SetupSkipCheckReference();
 
   PkgMgrPtr pkgmgr_;
 
index a5bcaf4..d2411ca 100644 (file)
@@ -151,7 +151,8 @@ Step::Status StepCheckSignature::process() {
       context_->request_type.get() ==
           ci::RequestType::ReadonlyUpdateUninstall ||
       (getuid() == 0 &&
-      (context_->request_type.get() == ci::RequestType::ManifestDirectInstall ||
+      (context_->skip_check_reference.get() ||
+      context_->request_type.get() == ci::RequestType::ManifestDirectInstall ||
       context_->request_type.get() == ci::RequestType::ManifestDirectUpdate ||
       context_->request_type.get() == ci::RequestType::ManifestPartialInstall ||
       context_->request_type.get() == ci::RequestType::ManifestPartialUpdate)))