new pkgmgr_common::parcel::CertInfoParcelable(uid, cert));
pkgmgr_client::PkgInfoClient client(parcelable, uid,
- pkgmgr_common::ReqType::GET_CERT_INFO);
+ pkgmgr_common::ReqType::SET_CERT_INFO);
if (!client.SendRequest())
return PMINFO_R_ERROR;
return PMINFO_R_OK;
}
+extern "C" EXPORT_API int _pkginfo_get_certinfo(const char *pkgid,
+ pkgmgr_certinfo_x** cert, uid_t uid)
+{
+ std::shared_ptr<pkgmgr_common::parcel::AbstractParcelable> parcelable(
+ new pkgmgr_common::parcel::CertInfoParcelable(uid,
+ std::string(pkgid)));
+
+ pkgmgr_client::PkgInfoClient client(parcelable, uid,
+ pkgmgr_common::ReqType::GET_CERT_INFO);
+ if (!client.SendRequest())
+ return PMINFO_R_ERROR;
+
+ std::shared_ptr<pkgmgr_common::parcel::CertInfoParcelable> return_parcel(
+ std::static_pointer_cast<pkgmgr_common::parcel::CertInfoParcelable>(
+ client.GetResultParcel()));
+
+ tizen_base::Parcel parcel;
+ parcel.ReadParcelable(return_parcel.get());
+ auto certinfo = return_parcel->GetCertInfo();
+ if (certinfo == nullptr)
+ return PMINFO_R_ERROR;
+
+ *cert = (pkgmgr_certinfo_x*)certinfo;
+ return PMINFO_R_OK;
+}
+
extern "C" EXPORT_API int _pkginfo_delete_certinfo(const char *pkgid)
{
char* query = sqlite3_mprintf("UPDATE package_cert_info SET "
int _pkginfo_insert_certinfo(const char *pkgid, pkgmgr_certinfo_x* cert, uid_t uid);
+int _pkginfo_get_certinfo(const char *pkgid, pkgmgr_certinfo_x** cert, uid_t uid);
+
int _pkginfo_delete_certinfo(const char *pkgid);
#ifdef __cplusplus
lhs_app_id, rhs_app_id, _getuid(), compare_result);
}
-static int _pkginfo_get_certinfo(const char *pkgid, pkgmgr_certinfo_x *info) {
-
- // TODO: need to use pkginfo-client APIs
-
- return PMINFO_R_OK;
-}
-
API int pkgmgrinfo_pkginfo_load_certinfo(const char *pkgid,
pkgmgrinfo_certinfo_h handle,
uid_t uid) {
return PMINFO_R_EINVAL;
}
- ret = _pkginfo_get_certinfo(pkgid, info);
+ ret = _pkginfo_get_certinfo(pkgid, &info, uid);
if (ret != PMINFO_R_OK) _LOGE("failed to get certinfo of %s ", pkgid);
return ret;