int i;
int fd = -1;
char *path;
- const char *app_labels[] = {"TEST_raz", "TEST_dwa", "TEST_trzy", ""};
+
+ const char *app_labels_wrong[] = {"-TEST_raz", NULL};
+ const char *app_labels[] = {"TEST_raz", "TEST_dwa", "TEST_trzy", NULL};
const int READ_BUF_SIZE = 1000;
char buf[READ_BUF_SIZE];
FILE *file = NULL;
struct smack_accesses * rules = NULL;
+ //test what happens when the label is not correct SMACK label
+ result = smack_accesses_new(&rules);
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "Error in smack_accesses_new. Error: " << result);
+
+ result = add_shared_dir_readers(TEST_OBJ,app_labels_wrong);
+ RUNNER_ASSERT_MSG(result == PC_ERR_INVALID_PARAM, "add_shared_dir_readers should fail here");
+
+ result = smack_have_access(app_labels_wrong[0],TEST_OBJ,"rx");
+ RUNNER_ASSERT_MSG(result != 1, "add_shared_dir_readers should not grant permission here");
+
+ smack_accesses_free(rules);
+
+ //ok, now the correct list of apps
result = smack_accesses_new(&rules);
RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "Error in smack_accesses_new. Error: " << result);