From: Manasij Sur Roy Date: Tue, 20 Sep 2016 10:07:26 +0000 (+0530) Subject: Fix to use pkgid for FacetId verification X-Git-Tag: accepted/tizen/3.0/wearable/20161015.082801 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Ftags%2Faccepted%2Ftizen%2F3.0%2Fwearable%2F20161015.082801;p=platform%2Fcore%2Faccount%2Ffido-client.git Fix to use pkgid for FacetId verification Change-Id: Iffc7dfd1f6ffaaa7bae850c09c38fde37c633d7a Signed-off-by: Manasij Sur Roy --- diff --git a/server/fido_app_id_handler.c b/server/fido_app_id_handler.c index ffd3bc0..c994d08 100644 --- a/server/fido_app_id_handler.c +++ b/server/fido_app_id_handler.c @@ -444,6 +444,9 @@ __get_pub_key_from_cert(const char *cert_b64) OPENSSL_free(der_pubkey); + if (pub_key != NULL) + _INFO("%s", pub_key); + return pub_key; } @@ -458,12 +461,43 @@ __get_tz_facet_id_of_caller(const char *caller_app_id, GDBusMethodInvocation *in _INFO("Caller uid =[%d]", uid); #endif + _INFO("Caller app id = [%s]", caller_app_id); + pkgmgrinfo_pkginfo_h handle = NULL; + char *caller_pkg_id = NULL; + pkgmgrinfo_appinfo_h pkg_app_info = NULL; + #ifdef WITH_JSON_BUILDER - int ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(caller_app_id, uid, &handle); + int ret = pkgmgrinfo_appinfo_get_usr_appinfo(caller_app_id, uid, &pkg_app_info); + if (ret != PMINFO_R_OK) { + _ERR("pkgmgrinfo_appinfo_get_appinfo=[%d]", ret); + + return NULL; + } #else - int ret = pkgmgrinfo_pkginfo_get_pkginfo(caller_app_id, &handle); + int ret = pkgmgrinfo_appinfo_get_appinfo(caller_app_id, &pkg_app_info); + if (ret != PMINFO_R_OK) { + _ERR("pkgmgrinfo_appinfo_get_appinfo=[%d]", ret); + + return NULL; + } +#endif + + ret = pkgmgrinfo_appinfo_get_pkgid(pkg_app_info, &caller_pkg_id); + if (ret != PMINFO_R_OK) { + _ERR("pkgmgrinfo_appinfo_get_appinfo=[%d]", ret); + pkgmgrinfo_appinfo_destroy_appinfo(pkg_app_info); + + return NULL; + } + + _INFO("Caller package id = [%s]", caller_pkg_id); + +#ifdef WITH_JSON_BUILDER + ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(caller_pkg_id, uid, &handle); +#else + ret = pkgmgrinfo_pkginfo_get_pkginfo(caller_pkg_id, &handle); #endif if (ret < 0) { @@ -473,7 +507,7 @@ __get_tz_facet_id_of_caller(const char *caller_app_id, GDBusMethodInvocation *in _INFO(""); - char *pkgid = NULL; + /*char *pkgid = NULL; ret = pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid); if (ret != PMINFO_R_OK) { @@ -482,9 +516,9 @@ __get_tz_facet_id_of_caller(const char *caller_app_id, GDBusMethodInvocation *in return NULL; } - _INFO(""); + _INFO("");*/ - pkgmgrinfo_certinfo_h cert_handle; + pkgmgrinfo_certinfo_h cert_handle = NULL; const char *author_cert = NULL; ret = pkgmgrinfo_pkginfo_create_certinfo(&cert_handle); if (ret != PMINFO_R_OK) { @@ -496,11 +530,13 @@ __get_tz_facet_id_of_caller(const char *caller_app_id, GDBusMethodInvocation *in _INFO(""); #ifdef WITH_JSON_BUILDER - ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, cert_handle, uid); + ret = pkgmgrinfo_pkginfo_load_certinfo(caller_pkg_id, cert_handle, uid); #else - ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, cert_handle); + ret = pkgmgrinfo_pkginfo_load_certinfo(caller_pkg_id, cert_handle); #endif + _INFO("pkgmgrinfo_pkginfo_load_certinfo = [%d]", ret); + if (ret != PMINFO_R_OK) { _ERR(""); pkgmgrinfo_pkginfo_destroy_certinfo(cert_handle); @@ -511,6 +547,7 @@ __get_tz_facet_id_of_caller(const char *caller_app_id, GDBusMethodInvocation *in _INFO(""); ret = pkgmgrinfo_pkginfo_get_cert_value(cert_handle, PMINFO_AUTHOR_SIGNER_CERT, &author_cert); + _INFO("pkgmgrinfo_pkginfo_get_cert_value = [%d]", ret); if (ret != PMINFO_R_OK) { pkgmgrinfo_pkginfo_destroy_certinfo(cert_handle); _ERR(""); @@ -518,7 +555,7 @@ __get_tz_facet_id_of_caller(const char *caller_app_id, GDBusMethodInvocation *in return NULL; } - /*_INFO("Author Root Cert=%s", author_cert);*/ + _INFO("Author Signer Cert=%s", author_cert); _INFO(""); @@ -543,6 +580,7 @@ CATCH: pkgmgrinfo_pkginfo_destroy_certinfo(cert_handle); pkgmgrinfo_pkginfo_destroy_pkginfo(handle); + pkgmgrinfo_appinfo_destroy_appinfo(pkg_app_info); _INFO(""); return tz_facet_id; }