From e672f9f759eb728b1affb030666e2f41c1f0f9d3 Mon Sep 17 00:00:00 2001 From: Sunwook Bae Date: Thu, 29 Aug 2013 14:47:24 +0900 Subject: [PATCH] Change to use pkgmgr-info instead of package-manager Change-Id: I45e8fc4002a8a2e6b3011554afd61fd94c795eb5 Signed-off-by: Sunwook Bae --- CMakeLists.txt | 2 +- packaging/osp-channel-service.spec | 2 +- src/FIo_MessagePortService.cpp | 52 +++++++++++++++++++++++--------------- 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c9d2e6..4ed2421 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,7 @@ TARGET_LINK_LIBRARIES(${this_target} "-lpthread" ) TARGET_LINK_LIBRARIES(${this_target} "-lcrypto" ) TARGET_LINK_LIBRARIES(${this_target} "-lsoup-2.4" ) TARGET_LINK_LIBRARIES(${this_target} "-laul" ) -TARGET_LINK_LIBRARIES(${this_target} "-lcapi-appfw-package-manager" ) +TARGET_LINK_LIBRARIES(${this_target} "-lpkgmgr-info" ) TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp-server -losp-appfw-server") ## Cory additional info diff --git a/packaging/osp-channel-service.spec b/packaging/osp-channel-service.spec index 64ba06c..2522f97 100755 --- a/packaging/osp-channel-service.spec +++ b/packaging/osp-channel-service.spec @@ -17,7 +17,7 @@ BuildRequires: pkgconfig(libsmack) BuildRequires: pkgconfig(message-port) BuildRequires: pkgconfig(openssl) BuildRequires: pkgconfig(aul) -BuildRequires: pkgconfig(capi-appfw-package-manager) +BuildRequires: pkgconfig(pkgmgr-info) BuildRequires: osp-appfw-internal-devel BuildRequires: hash-signer diff --git a/src/FIo_MessagePortService.cpp b/src/FIo_MessagePortService.cpp index 5aaa6ae..6f6253f 100644 --- a/src/FIo_MessagePortService.cpp +++ b/src/FIo_MessagePortService.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include @@ -295,25 +295,38 @@ _MessagePortService::IsPreloaded(const String& localAppId, const String& remoteA unique_ptr pLocalAppId(_StringConverter::CopyToCharArrayN(localAppId)); unique_ptr pRemoteAppId(_StringConverter::CopyToCharArrayN(remoteAppId)); - int ret = package_manager_is_preload_package_by_app_id(pLocalAppId.get(), &preload_local); - if (ret == 0) + pkgmgrinfo_appinfo_h handle = null; + int ret = pkgmgrinfo_appinfo_get_appinfo(pLocalAppId.get(), &handle); + if (ret != PMINFO_R_OK) { - ret = package_manager_is_preload_package_by_app_id(pRemoteAppId.get(), &preload_remote); - if (ret == 0) - { - if (preload_local && preload_remote) - { - return true; - } - } - else - { - SysLog(NID_IO, "Failed to check the preloaded application. %d", ret); - } + SysLog(NID_IO, "Failed to get the appinfo. %d", ret); + return false; } - else + ret = pkgmgrinfo_appinfo_is_preload(handle, &preload_local); + if (ret != PMINFO_R_OK) { SysLog(NID_IO, "Failed to check the preloaded application. %d", ret); + pkgmgrinfo_appinfo_destroy_appinfo(handle); + return false; + } + + ret = pkgmgrinfo_appinfo_get_appinfo(pRemoteAppId.get(), &handle); + if (ret != PMINFO_R_OK) + { + SysLog(NID_IO, "Failed to get the appinfo. %d", ret); + return false; + } + ret = pkgmgrinfo_appinfo_is_preload(handle, &preload_remote); + if (ret != PMINFO_R_OK) + { + SysLog(NID_IO, "Failed to check the preloaded application. %d", ret); + pkgmgrinfo_appinfo_destroy_appinfo(handle); + return false; + } + + if (preload_local && preload_remote) + { + return true; } return false; @@ -322,16 +335,15 @@ _MessagePortService::IsPreloaded(const String& localAppId, const String& remoteA int _MessagePortService::CheckCertificate(const String& localAppId, const String& remoteAppId) const { - package_manager_compare_result_type_e res; - unique_ptr pLocalAppId(_StringConverter::CopyToCharArrayN(localAppId)); unique_ptr pRemoteAppId(_StringConverter::CopyToCharArrayN(remoteAppId)); - int ret = package_manager_compare_app_cert_info(pLocalAppId.get(), pRemoteAppId.get(), &res); + pkgmgrinfo_cert_compare_result_type_e res; + int ret = pkgmgrinfo_pkginfo_compare_app_cert_info(pLocalAppId.get(), pRemoteAppId.get(), &res); SysTryReturn(NID_IO, ret == 0, MESSAGEPORT_ERROR_IO_ERROR, E_SYSTEM, "[E_SYSTEM] Failed to check the certificate: %d", ret); - SysTryReturn(NID_IO, res == PACAKGE_MANAGER_COMPARE_MATCH, MESSAGEPORT_ERROR_CERTIFICATE_NOT_MATCH, E_CERTIFICATE_VERIFICATION_FAILED, + SysTryReturn(NID_IO, res == PMINFO_CERT_COMPARE_MATCH, MESSAGEPORT_ERROR_CERTIFICATE_NOT_MATCH, E_CERTIFICATE_VERIFICATION_FAILED, "[E_CERTIFICATE_VERIFICATION_FAILED] Both applications are not signed with the same certificate: %d", res); return 0; -- 2.7.4