From e976029272616424f7bf84d246f42c82dcd345c4 Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Tue, 3 Sep 2019 14:27:53 +0900 Subject: [PATCH] Remove checking cert mismatch from Signature class This should be done at StepCheckOldCertificate step. Change-Id: I9923c55f02f476cee57e90ed91e470bdf318231b Signed-off-by: Sangyoon Jang --- src/common/signature.cc | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/src/common/signature.cc b/src/common/signature.cc index 15da992..78e7ac1 100644 --- a/src/common/signature.cc +++ b/src/common/signature.cc @@ -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"; -- 2.7.4