Set default privilege when install preloaded packages 78/49578/5
authorSangyoon Jang <s89.jang@samsung.com>
Thu, 15 Oct 2015 10:01:21 +0000 (19:01 +0900)
committerSangyoon Jang <s89.jang@samsung.com>
Thu, 15 Oct 2015 10:01:21 +0000 (19:01 +0900)
set platform level temporarily
this tool will be merged to app-installer

Change-Id: Ic4f852a17216ce1437c66e8380745cdf4d97f04c
Signed-off-by: Sangyoon Jang <s89.jang@samsung.com>
tool/pkg_privilege.c

index 08e0014..db6a86e 100644 (file)
@@ -92,6 +92,11 @@ static app_inst_req *_prepare_request(const char *pkgid, const char *appid,
        return req;
 }
 
+/* NOTE: We cannot use cert-svc api which checks signature level in this tool,
+ * because cert-svc does not provide c apis in Tizen 3.0.
+ * So we set default privilege as platform level temporarily.
+ */
+#define DEFAULT_PRIVILEGE "http://tizen.org/privilege/internal/default/platform"
 static int _insert_privilege(char *manifest, uid_t uid)
 {
        int ret;
@@ -120,6 +125,10 @@ static int _insert_privilege(char *manifest, uid_t uid)
                                                priv->text);
                }
 
+               if (getuid() == OWNER_ROOT)
+                       security_manager_app_inst_req_add_privilege(req,
+                                       DEFAULT_PRIVILEGE);
+
                ret = security_manager_app_install(req);
                if (ret != SECURITY_MANAGER_SUCCESS)
                        printf("app install failed: %d\n", ret);