Fix parsing of Smack config files.
authorRafal Krypa <r.krypa@samsung.com>
Fri, 25 Jan 2013 16:13:51 +0000 (17:13 +0100)
committerRafal Krypa <r.krypa@samsung.com>
Wed, 30 Jan 2013 16:12:46 +0000 (17:12 +0100)
[Issue#]       N/A
[Bug]          Giving Smack permissions to apps based on permissions list not working.
[Cause]        Invalid return code from fscanf() expected.
[Solution]     Fix parsing in perm_to_smack() internal function.
[Verification] Run libprivilege-control tests from security-tests.

Change-Id: I9efd05b256e31e2c39bc479db01b744e3169c3f7

src/privilege-control.c

index d4b7dbf..d203023 100644 (file)
@@ -486,7 +486,7 @@ static inline int perm_to_smack(struct smack_accesses* smack, const char* app_la
        }
 
        while (1) {
-               if (fscanf(file, format_string, smack_subject, smack_object, smack_accesses) != 1) {
+               if (fscanf(file, format_string, smack_subject, smack_object, smack_accesses) != 3) {
                        C_LOGE("fscanf failed");
                        goto out;
                }