apply setting hybrid flag for security-manager 12/97512/1
authorjongmyeongko <jongmyeong.ko@samsung.com>
Mon, 14 Nov 2016 10:27:34 +0000 (19:27 +0900)
committerjongmyeongko <jongmyeong.ko@samsung.com>
Mon, 14 Nov 2016 10:28:33 +0000 (19:28 +0900)
Change-Id: I6c861effe8632766c1659f160afa3dafc2daab52
Signed-off-by: jongmyeongko <jongmyeong.ko@samsung.com>
src/common/security_registration.cc

index 335265e..61fa839 100644 (file)
@@ -56,7 +56,7 @@ bool PrepareRequest(const std::string& app_id, const std::string& pkg_id,
     const std::string& author_id, const std::string& api_version,
     const boost::filesystem::path& path,
     uid_t uid, const std::vector<std::string>& privileges,
-    app_inst_req* req, bool /*cross_app_rules*/, std::string* error_message) {
+    app_inst_req* req, bool cross_app_rules, std::string* error_message) {
   if (app_id.empty() || pkg_id.empty()) {
     LOG(ERROR) << "Appid or pkgid is empty. Both values must be set";
     return false;
@@ -80,8 +80,6 @@ bool PrepareRequest(const std::string& app_id, const std::string& pkg_id,
     return false;
   }
 
-  // TODO(t.iwanek): set is_hybrid in request according to cross_app_rules var
-
   error = security_manager_app_inst_req_set_uid(req, uid);
   if (error != SECURITY_MANAGER_SUCCESS) {
     std::string errnum = boost::str(boost::format("%d") % error);
@@ -90,6 +88,16 @@ bool PrepareRequest(const std::string& app_id, const std::string& pkg_id,
     return false;
   }
 
+  if (cross_app_rules) {
+    error = security_manager_app_inst_req_set_hybrid(req);
+    if (error != SECURITY_MANAGER_SUCCESS) {
+      std::string errnum = boost::str(boost::format("%d") % error);
+      *error_message = security_manager_strerror(static_cast<lib_retcode>(error));
+      *error_message += ":<" + errnum + ">";
+      return false;
+    }
+  }
+
   if (!api_version.empty()) {
     error = security_manager_app_inst_req_set_target_version(req,
         api_version.c_str());