Fix implementation of setting process label from Smack exec label.
authorRafal Krypa <r.krypa@samsung.com>
Tue, 5 Feb 2013 16:10:21 +0000 (17:10 +0100)
committerTomasz Swierczek <t.swierczek@samsung.com>
Wed, 6 Feb 2013 13:53:00 +0000 (14:53 +0100)
[Issue#]       SSDWSSP-80
[Bug]          set_smack_from_binary() gets label from symlink, not its target.
[Cause]        Used function for getting label doesn't follow symlinks.
[Solution]     Change the function to the symlink-following one.
[Verification] Build, install, run latest tests from security-tests package.

Change-Id: Ibc67d8f91621ad0ab05c1690d87604acdc78c995

src/privilege-control.c

index b058f09..f1ceba8 100644 (file)
@@ -279,9 +279,9 @@ static int set_smack_from_binary(const char* path)
        char* label;
 
        C_LOGD("Path: %s", path);
-       ret = smack_lgetlabel(path, &label, SMACK_LABEL_EXEC);
+       ret = smack_getlabel(path, &label, SMACK_LABEL_EXEC);
        if (ret != 0) {
-               C_LOGE("smack_lgetlabel returned PC_ERR_INVALID_OPERATION");
+               C_LOGE("Getting exec label from file %s failed", path);
                return PC_ERR_INVALID_OPERATION;
        }