Adjust to privilege verification API change 84/98384/4 accepted/tizen/3.0/common/20161122.195116 accepted/tizen/3.0/ivi/20161122.075927 accepted/tizen/3.0/mobile/20161122.075833 accepted/tizen/3.0/tv/20161122.075852 accepted/tizen/3.0/wearable/20161122.075909 submit/tizen_3.0/20161121.042235
authorSangyoon Jang <s89.jang@samsung.com>
Thu, 17 Nov 2016 06:58:01 +0000 (15:58 +0900)
committerjongmyeong ko <jongmyeong.ko@samsung.com>
Thu, 17 Nov 2016 10:50:21 +0000 (02:50 -0800)
Requires:
 - https://review.tizen.org/gerrit/98161

Change-Id: Ie9a2aef9da888adcfb634c32407e3389ee7c4fb8
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
src/common/certificate_validation.cc
src/common/certificate_validation.h
src/common/step/security/step_check_signature.cc

index 2e97b2b..886430a 100644 (file)
@@ -230,7 +230,7 @@ bool ValidateSignatures(const bf::path& base_path,
 }
 
 bool ValidatePrivilegeLevel(common_installer::PrivilegeLevel level,
-    const char* api_version, GList* privileges,
+    uid_t uid, const char* api_version, GList* privileges,
     std::string* error_message) {
   if (level == common_installer::PrivilegeLevel::UNTRUSTED) {
     if (privileges) {
@@ -261,7 +261,7 @@ bool ValidatePrivilegeLevel(common_installer::PrivilegeLevel level,
     int status = PRVMGR_ERR_NONE;
     // Do the privilege check only if the package has privileges
     if (pair.first) {
-      status = privilege_manager_verify_privilege(api_version,
+      status = privilege_manager_verify_privilege(uid, api_version,
           pair.second ? PRVMGR_PACKAGE_TYPE_WRT : PRVMGR_PACKAGE_TYPE_CORE,
           pair.first, PrivilegeLevelToVisibility(level), &error);
     }
index e1670d8..cbc36bb 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <boost/filesystem/path.hpp>
 #include <privilege_manager.h>
+#include <sys/types.h>
 #include <vcore/SignatureData.h>
 #include <vcore/SignatureFinder.h>
 
@@ -37,8 +38,8 @@ bool ValidateSignatures(const boost::filesystem::path& base_path,
     bool check_reference, std::string* error_message);
 
 bool ValidatePrivilegeLevel(common_installer::PrivilegeLevel level,
-                            const char* api_version, GList* privileges,
-                            std::string* error_message);
+    uid_t uid, const char* api_version, GList* privileges,
+    std::string* error_message);
 
 }  // namespace common_installer
 
index 3723237..2b75464 100644 (file)
@@ -87,7 +87,7 @@ Step::Status StepCheckSignature::CheckSignatureMismatch() {
 Step::Status StepCheckSignature::CheckPrivilegeLevel(PrivilegeLevel level) {
   std::string error_message;
   if (!context_->is_preload_request.get()) {
-    if (!ValidatePrivilegeLevel(level,
+    if (!ValidatePrivilegeLevel(level, context_->uid.get(),
         context_->manifest_data.get()->api_version,
         context_->manifest_data.get()->privileges, &error_message)) {
       if (!error_message.empty()) {