Fix updating certinfo
[platform/core/appfw/app-installers.git] / src / common / pkgmgr_registration.cc
index 92662e8..57d3554 100644 (file)
@@ -63,7 +63,7 @@ bool RegisterCertificates(
     LOG(ERROR) << "Cannot create pkgmgr_instcertinfo_h";
     return false;
   }
-  for (auto pair : kCertTypePairs) {
+  for (const auto& pair : kCertTypePairs) {
      auto cert = (cert_info.*(pair.first)).get();
      auto type = pair.second;
      if (!RegisterCertificate(handle, cert, type))
@@ -162,7 +162,9 @@ bool UpgradeAppInPkgmgr(manifest_x* manifest,
     return false;
   }
 
-  (void) pkgmgr_installer_delete_certinfo(pkgid.c_str());
+  // TODO(jeremy.jang): consider updating cert only when dist cert is changed.
+  // because the package from different author is not allowed to be installed,
+  // so auth cert cannot be changed when update.
   if (!RegisterCertificates(cert_info, pkgid, uid))
     return false;
 
@@ -285,7 +287,7 @@ bool UpdatePluginInfo(manifest_x* manifest,
       pkgmgr_parser_update_pkg_plugin_info_in_usr_db(manifest, uid) :
       pkgmgr_parser_update_pkg_plugin_info_in_db(manifest);
   if (ret) {
-    LOG(ERROR) << "Failed to insupdateert plugin info, error code=" << ret;
+    LOG(ERROR) << "Failed to insert update plugin info, error code=" << ret;
     return false;
   }
   return true;