Remove checking cert mismatch from Signature class 27/213227/1
authorSangyoon Jang <jeremy.jang@samsung.com>
Tue, 3 Sep 2019 05:27:53 +0000 (14:27 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Tue, 3 Sep 2019 05:27:53 +0000 (14:27 +0900)
This should be done at StepCheckOldCertificate step.

Change-Id: I9923c55f02f476cee57e90ed91e470bdf318231b
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/common/signature.cc

index 15da992..78e7ac1 100644 (file)
@@ -22,34 +22,6 @@ namespace ci = common_installer;
 
 namespace common_installer {
 
-bool CheckPkgCertificateMismatch(const std::string& pkgid,
-                                 const std::string& certificate) {
-  bool certificate_mismatch = false;
-  uid_t uid = G_MAXUINT;
-  auto old_certificate = ci::QueryCertificateAuthorCertificate(pkgid, uid);
-
-  if (!old_certificate.empty()) {
-    bool is_same = ci::IsSameAuthor(old_certificate, certificate);
-    certificate_mismatch = !is_same;
-  }
-  return certificate_mismatch;
-}
-
-bool Signature::CheckSignatureMismatch(std::string* error_message) {
-  const auto& cert = cert_info_->auth_cert.get();
-  if (cert) {
-    bool certificate_mismatch =
-        CheckPkgCertificateMismatch(pkgid_, cert->getBase64());
-    if (certificate_mismatch) {
-      *error_message =
-          "Package with the same id and different certificate "
-          "has been already installed";
-      return false;
-    }
-  }
-  return true;
-}
-
 bool Signature::SetPath() {
   bf::path path = bf::path((is_readonly_package_) ?
       tzplatform_getenv(TZ_SYS_RO_SHARE) : tzplatform_getenv(TZ_SYS_SHARE)) /
@@ -91,9 +63,6 @@ bool Signature::GetPrivilegeLevel(boost::filesystem::path sig_root_path,
   if (!CheckSignatures(check_reference, level, sig_root_path, error_message))
     return false;
 
-  if (!CheckSignatureMismatch(error_message))
-    return false;
-
   if (*level == PrivilegeLevel::UNTRUSTED)
     if (!GetSignatureFromFile(pkgid_, is_readonly_package_, level, cert_info_))
       LOG(INFO) << "Unable to get privilege level from file";