return 0;
}
-RUNNER_TEST_GROUP_INIT(libprivilegecontrol)
-
int nftw_remove_labels(const char *fpath, const struct stat * /*sb*/,
int /*typeflag*/, struct FTW * /*ftwbuf*/)
{
RUNNER_ASSERT_MSG(label != NULL, "EXEC label on " << fpath << " is not set");
result = strcmp(APPID_DIR, label);
RUNNER_ASSERT_MSG(result == 0, "EXEC label on executable file " << fpath << " is incorrect");
+ } else if(S_ISLNK(sb->st_mode)) {
+ struct stat buf;
+ char* target = realpath(fpath, NULL);
+ RUNNER_ASSERT_MSG(0 == stat(target, &buf),"Stat failed for " << fpath);
+ free(target);
+ if (buf.st_mode != (buf.st_mode | S_IXUSR | S_IFREG)) {
+ RUNNER_ASSERT_MSG(label == NULL, "EXEC label on " << fpath << " is set");
+ } else {
+ RUNNER_ASSERT_MSG(label != NULL, "EXEC label on " << fpath << " is not set");
+ result = strcmp(APPID_DIR, label);
+ RUNNER_ASSERT_MSG(result == 0, "EXEC label on link to executable file " << fpath << " is incorrect");
+ }
} else
RUNNER_ASSERT_MSG(label == NULL, "EXEC label on " << fpath << " is set");
}
} // namespace
+RUNNER_TEST_GROUP_INIT(libprivilegecontrol)
+
/**
* Test setting labels for all files and folders in given path.
*/
smack_lsetlabel(APP_SET_PRIV_PATH_REAL, APP_ID, SMACK_LABEL_EXEC);
smack_lsetlabel(APP_SET_PRIV_PATH, APP_ID "_symlink", SMACK_LABEL_EXEC);
+ /**
+ * TODO This test should also verify set_app_privilege behavior for OSP and
+ * WRT apps. To do that we'll have to install real apps on device as a
+ * precondition.
+ */
+
// Set APP privileges
result = set_app_privilege(APP_ID, NULL, APP_SET_PRIV_PATH);
RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "Error in set_app_privilege. Error: " << result);