RUNNER_TEST_GROUP_INIT(libprivilegecontrol)
-int nftw_remove_labels(const char *fpath, const struct stat *sb,
- int typeflag, struct FTW *ftwbuf)
+int nftw_remove_labels(const char *fpath, const struct stat * /*sb*/,
+ int /*typeflag*/, struct FTW * /*ftwbuf*/)
{
smack_lsetlabel(fpath, NULL, SMACK_LABEL_ACCESS);
smack_lsetlabel(fpath, NULL, SMACK_LABEL_EXEC);
return 0;
}
-int nftw_set_labels_non_app_dir(const char *fpath, const struct stat *sb,
- int typeflag, struct FTW *ftwbuf)
+int nftw_set_labels_non_app_dir(const char *fpath, const struct stat * /*sb*/,
+ int /*typeflag*/, struct FTW * /*ftwbuf*/)
{
smack_lsetlabel(fpath, CANARY_LABEL, SMACK_LABEL_ACCESS);
smack_lsetlabel(fpath, CANARY_LABEL, SMACK_LABEL_EXEC);
return 0;
}
-int nftw_check_labels_non_app_dir(const char *fpath, const struct stat *sb,
- int typeflag, struct FTW *ftwbuf)
+int nftw_check_labels_non_app_dir(const char *fpath, const struct stat * /*sb*/,
+ int /*typeflag*/, struct FTW * /*ftwbuf*/)
{
int result;
char* label;
}
int nftw_check_labels_app_dir(const char *fpath, const struct stat *sb,
- int typeflag, struct FTW *ftwbuf)
+ int /*typeflag*/, struct FTW * /*ftwbuf*/)
{
int result;
char* label;
}
int nftw_check_labels_app_shared_dir(const char *fpath, const struct stat *sb,
- int typeflag, struct FTW *ftwbuf)
+ int /*typeflag*/, struct FTW * /*ftwbuf*/)
{
int result;
char* label;
result = app_install(app_labels[i]);
RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "Error in app_install.");
- asprintf(&path, SMACK_RULES_DIR "/%s", app_labels[i]);
+ RUNNER_ASSERT(0 <= asprintf(&path, SMACK_RULES_DIR "/%s", app_labels[i]));
fd = open(path, O_WRONLY, 0644);
RUNNER_ASSERT_MSG(fd != -1, "Error in opening file " << path);
//TEST the operations on empty files
- asprintf(&path, SMACK_RULES_DIR "/%s", app_labels[0]);
+ RUNNER_ASSERT(0 <= asprintf(&path, SMACK_RULES_DIR "/%s", app_labels[0]));
file = fopen(path, "r");
RUNNER_ASSERT_MSG(file, "fopen failed, errno:" << errno);
- fgets(buf, READ_BUF_SIZE, file);
+ RUNNER_ASSERT(NULL != fgets(buf, READ_BUF_SIZE, file));
result = strcmp(buf, test_string_01);
RUNNER_ASSERT_MSG( result!=0, "add_shared_dir_readers ERROR, file not formatted" << path );
fclose(file);
//TEST the operations on non empty files
- asprintf(&path, SMACK_RULES_DIR "/%s", app_labels[2]);
+ RUNNER_ASSERT(0 <= asprintf(&path, SMACK_RULES_DIR "/%s", app_labels[2]));
file = NULL;
file = fopen(path, "r");
RUNNER_ASSERT_MSG(file, "fopen failed, errno:" << errno);
- fgets(buf, READ_BUF_SIZE, file);
+ RUNNER_ASSERT(NULL != fgets(buf, READ_BUF_SIZE, file));
result = strcmp(buf, test_string_21);
RUNNER_ASSERT_MSG( result==0, "add_shared_dir_readers ERROR, file not formatted" );
- fgets(buf, READ_BUF_SIZE, file);
+ RUNNER_ASSERT(NULL != fgets(buf, READ_BUF_SIZE, file));
result = strcmp(buf, test_string_22);
RUNNER_ASSERT_MSG( result==0, "add_shared_dir_readers ERROR, file not formatted" );
RUNNER_ASSERT_MSG(groups_cnt > 0, "Wrong number of supplementary groupsCnt");
gid_t *groups_list = (gid_t *) calloc(groups_cnt, sizeof(gid_t));
RUNNER_ASSERT_MSG(groups_list != NULL, "Memory allocation failed");
- getgroups(groups_cnt, groups_list);
+ RUNNER_ASSERT(-1 != getgroups(groups_cnt, groups_list));
for (int i = 0; i < groups_cnt; ++i) {
if (groups_check.erase(groups_list[i]) == 0) {
result = file_exists(OSP_BLAHBLAH);
RUNNER_ASSERT(result == -1);
- result = add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE , (const char*[]){ "~/\"\\\ malformed rwxat", NULL }, NULL, 0);
+ result = add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE , (const char*[]){ "~/\"\\ malformed rwxat", NULL }, NULL, 0);
RUNNER_ASSERT(result == PC_ERR_INVALID_PARAM);
result = file_exists(OSP_BLAHBLAH);
RUNNER_ASSERT(result == -1);
RUNNER_TEST(privilege_control10_app_register_av)
{
int result;
- int i;
-
- struct smack_accesses * rules = NULL;
- char *path = NULL;
// cleaning
smack_revoke_subject(APP_TEST_AV_1);
RUNNER_ASSERT_MSG(0, "smack_new_label_from_self() failed");
}
result = write(fd, smack_label, strlen(smack_label));
- if(result != strlen(smack_label)){
+ if(result != (int)strlen(smack_label)){
close(fd);
close(sock);
free(smack_label);