Added missing part of fix for rule overwriting issue
authorTomasz Swierczek <t.swierczek@samsung.com>
Fri, 31 May 2013 16:03:16 +0000 (18:03 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Mon, 17 Jun 2013 12:24:35 +0000 (14:24 +0200)
[Issue#]       N/A
[Bug]          Some rules in apps rule file were overwriting rules
[Cause]        smack_accesses_add used instead of smack_accesses_add_modify. Not all required changes from
86da6484f2e4cad76565b8ddac0d126e3b5327fb have been applied on rsa.
[Solution]     changed function
[Verification] Install FtApp and see if rules for aospd* label are rx or rwx (should be latter)

Change-Id: Ic863b013b069e9a97d3b04e79c84f5c1a54f1f2a

src/privilege-control.c

index 1a50564..ee5017e 100644 (file)
@@ -1207,9 +1207,9 @@ app_register_appsetting(const char *app_id, struct smack_accesses *smack)
        /*Add smack rules to rx access each app*/
        for (i = 0; i < app_list_len; ++i) {
                C_LOGD("Appsetting: applying rx rule for %s", label_app_list[i]);
-               if (smack_accesses_add(smack, app_id,
-                               label_app_list[i], "rx") == -1) {
-                       C_LOGE("smack_accesses_add failed");
+               if (smack_accesses_add_modify(smack, app_id,
+                               label_app_list[i], "rx", "") == -1) {
+                       C_LOGE("smack_accesses_add_modify failed");
                        ret = PC_ERR_INVALID_OPERATION;
                        goto out;
                }
@@ -1225,13 +1225,13 @@ app_register_appsetting(const char *app_id, struct smack_accesses *smack)
        /*Add smack rules to rwx access each app*/
        for (i = 0; i < dir_list_len; ++i) {
                C_LOGD("Appsetting: applying rwx rule for %s", label_dir_list[i]);
-               if (smack_accesses_add(smack, app_id,
-                               label_dir_list[i], "rwx") == -1) {
-                       C_LOGE("smack_accesses_add failed");
+               if (smack_accesses_add_modify(smack, app_id,
+                               label_dir_list[i], "rwx", "") == -1) {
+                       C_LOGE("smack_accesses_add_modify failed");
                        ret = PC_ERR_INVALID_OPERATION;
                        goto out;
                        /* Should we abort adding rules if once
-                        * smack_accesses_add will fail?*/
+                        * smack_accesses_add_modify will fail?*/
                }
        }