Replace implementation of comparing pkg certinfo
authorJunghyun Yeon <jungh.yeon@samsung.com>
Thu, 4 Mar 2021 06:43:16 +0000 (15:43 +0900)
committer연정현/Tizen Platform Lab(SR)/Staff Engineer/삼성전자 <jungh.yeon@samsung.com>
Fri, 5 Mar 2021 00:05:43 +0000 (09:05 +0900)
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
src/pkgmgrinfo_certinfo.c

index 44fc7a8..4fa5336 100644 (file)
@@ -30,41 +30,14 @@ API int pkgmgrinfo_pkginfo_create_certinfo(pkgmgrinfo_certinfo_h *handle) {
 API int pkgmgrinfo_pkginfo_compare_usr_pkg_cert_info(
     const char *lhs_package_id, const char *rhs_package_id, uid_t uid,
     pkgmgrinfo_cert_compare_result_type_e *compare_result) {
-  // TODO: need to use pkginfo-client APIs
-  return 0;
-#if 0
-  sqlite3 *db;
-  char *dbpath;
-
   if (lhs_package_id == NULL || rhs_package_id == NULL ||
       compare_result == NULL) {
     _LOGE("invalid parameter");
     return PMINFO_R_EINVAL;
   }
 
-  /* open unified global cert db */
-  dbpath = getUserPkgCertDBPath();
-  if (dbpath == NULL) return PMINFO_R_ERROR;
-
-  ret = __open_db(dbpath, &db, SQLITE_OPEN_READONLY);
-  if (ret != SQLITE_OK) {
-    _LOGE("failed to open db: %d", ret);
-    free(dbpath);
-    return PMINFO_R_ERROR;
-  }
-  free(dbpath);
-
-  if (_pkginfo_compare_certinfo(db, lhs_package_id, rhs_package_id,
-                                compare_result)) {
-    _LOGE("failed to compare certinfo");
-    sqlite3_close_v2(db);
-    return PMINFO_R_ERROR;
-  }
-
-  sqlite3_close_v2(db);
-
-  return PMINFO_R_OK;
-#endif
+  return _certinfo_compare_certinfo(lhs_package_id, rhs_package_id,
+      compare_result);
 }
 
 API int pkgmgrinfo_pkginfo_compare_pkg_cert_info(