RUNNER_CHILD_TEST(privilege_control06_revoke_permissions)
{
int result;
- int fd;
// Revoke permissions
result = perm_app_revoke_permissions(APP_ID);
return true;
}
-int removeAccessesAll()
+void removeAccessesAll()
{
struct smack_accesses *rules = NULL;
int result = smack_accesses_new(&rules);
}
//pairs of rules for test with mixed cases, different length and mixed order
-char *rules_tab[] = {
+const char *rules_tab[] = {
"reader1", "-", "-----",
"reader2", "--------", "-----",
"reader3", "RwXaT", "rwxat",
const int B_SIZE = 8;
char buff[B_SIZE];
- char *def_rule = "_";
+ const char *def_rule = "_";
//int smack_new_label_from_self(char **label);
result = smack_new_label_from_self(&label);
//}
//bellow function is from libsmack.c witch changed name
-char *xattr(enum smack_label_type type)
+const char *xattr(enum smack_label_type type)
{
switch (type) {
case SMACK_LABEL_ACCESS:
const int B_SIZE = 8;
char buff[B_SIZE];
- char *file_path = "/etc/smack/test_smack_rules";
+ const char *file_path = "/etc/smack/test_smack_rules";
//preparing environment by restoring default "_" label
const int B_SIZE = 8;
char buff[B_SIZE];
- char *file_path = "/etc/smack/test_smack_rules_lnk";
+ const char *file_path = "/etc/smack/test_smack_rules_lnk";
//preparing environment by restoring default "_" label
char buff[B_SIZE];
int fd;
- char *file_path = "/etc/smack/test_smack_rules";
+ const char *file_path = "/etc/smack/test_smack_rules";
fd = open(file_path, O_RDWR, 0644); //reference preinstalled rules
RUNNER_ASSERT_MSG(fd >= 0, "Unable to open /etc/smack/test_smack_rules");
char *smack_label;
number++;
- result = asprintf(&smack_label, "s%ld", number);
+ result = asprintf(&smack_label, "s%d", number);
RUNNER_ASSERT_MSG(result > 0, "asprintf failed");
result = smack_set_label_for_self(smack_label);
RUNNER_ASSERT_MSG(result == 0, "smack_set_label_for_self(" << smack_label << ") failed");
result = smack_new_label_from_self(&smack_label);
RUNNER_ASSERT_MSG(result == 0, "smack_new_label_from_self() failed");
result = write(fd, smack_label, strlen(smack_label));
- RUNNER_ASSERT_MSG(result == strlen(smack_label), "write() failed");
+ RUNNER_ASSERT_MSG(result == (int)strlen(smack_label), "write() failed");
close(fd);
free(smack_label);
}
int restart_security_server()
{
int ret = -1;
- char *dbus_client_name = "tests.dbus.client";
+ const char *dbus_client_name = "tests.dbus.client";
DBusMessage* msg = NULL;
DBusMessageIter args, iter;
* the call will start the unit and its dependencies,
* but will fail if this would change an already queued job.
*/
- char *dbus_systemd_srv_unit_mode = "fail";
+ const char *dbus_systemd_srv_unit_mode = "fail";
// append arguments, mode = "fail" for "Restart" method
dbus_message_iter_init_append(msg, &args);
ssize_t rest = count;
ssize_t s;
while (rest > 0) {
- RUNNER_ASSERT_MSG(0 < (s = TEMP_FAILURE_RETRY(read(fd, buf + readf, rest))), "Error in read from pipe");
+ RUNNER_ASSERT_MSG(0 < (s = TEMP_FAILURE_RETRY(read(fd, ((char*)buf) + readf, rest))), "Error in read from pipe");
rest -= s;
readf += s;
}
ssize_t rest = count;
ssize_t s;
while (rest > 0) {
- RUNNER_ASSERT_MSG(0 <= (s = TEMP_FAILURE_RETRY(write(fd, buf + writef, rest))), "Error in write to pipe");
+ RUNNER_ASSERT_MSG(0 <= (s = TEMP_FAILURE_RETRY(write(fd, ((char*)buf) + writef, rest))), "Error in write to pipe");
rest -= s;
writef += s;
}
DBusConnection* conn = NULL;
DBusError err;
DBusPendingCall *pending = NULL;
- dbus_bool_t stat;
- dbus_uint32_t level;
- char *dbus_server_name = DBUS_SERVER_NAME;
+ const char *dbus_server_name = DBUS_SERVER_NAME;
char *smack_context = NULL;
int status;
- int result = -1;
pid_t pid = fork();
RUNNER_ASSERT_MSG(-1 != pid, "fork() failed");
* Function should be run at the begining of every test, so every test is independent of each other.
*/
void reset_security_server(){
- int ret;
- unsigned int attempt, max_attempt, expire_sec;
system("if [ -d /opt/data/security-server ]; then \n rm -rf /opt/data/security-server/*; \n fi");
sync();
restart_security_server();
sleep(1);
-
}
RUNNER_TEST(tc24_security_server_attempt_exceeding)
{
int ret;
- int i;
- unsigned int attempt, max_attempt, expire_sec;
+ unsigned int i, attempt, max_attempt, expire_sec;
// Prepare environment
reset_security_server();
RUNNER_TEST(tc25_security_server_attempt_exceeding)
{
int ret;
- int i;
- unsigned int attempt, max_attempt, expire_sec;
+ unsigned int i, attempt, max_attempt, expire_sec;
// Prepare environment
reset_security_server();
* This test program must be executed as root process
*/
-void convert_prev_cookie(const char *cmdline, const char *prev, unsigned char *now)
+void convert_prev_cookie(const char * /*cmdline*/, const char *prev, unsigned char *now)
{
int i, cnt;
char tmphexnum[3] = {0};
cnt = security_server_get_cookie_size();
cnt = cnt * 2;
- if (strlen(prev) != cnt)
+ if ((int)strlen(prev) != cnt)
{
printf("%s\n", "Cookie length is wrong");
exit(1);
}
- for (i = 0, cnt = 0; i < strlen(prev); i = i + 2)
+ for (i = 0, cnt = 0; i < (int)strlen(prev); i = i + 2)
{
strncpy(tmphexnum, prev + i, 2);
tmphexnum[2] = 0;
{
/* FIXME: proper parameters needed (these below are fake)
* or better idea for this test case...*/
- char *argvv[] = {argv[0], "12345", "5000", "abcdefabcdefabcdefabcdefabcdefabcdefabcd"};
- int argcc = 4;
+ const char *argvv[] = {argv[0], "12345", "5000", "abcdefabcdefabcdefabcdefabcdefabcdefabcd"};
target_uid = getuid();
if (target_uid != 0)
int fake_get_gid(const char *object)
{
- int sockfd = -1, retval, gid;
- response_header hdr;
+ int sockfd = -1, retval;
retval = connect_to_server(&sockfd);
if (retval != 0)
return 0;
}
-static int nftw_rmdir_contents(const char *fpath, const struct stat *sb,
+static int nftw_rmdir_contents(const char *fpath, const struct stat * /*sb*/,
int tflag, struct FTW *ftwbuf)
{
if (tflag == FTW_F) {
return 0;
}
-int clear_password(char **error)
+int clear_password(char ** /*error*/)
{
int ret = -1;
unsigned int attempt, max_attempt, expire_sec;
return 0;
}
+ return -1;
}
RUNNER_TEST_GROUP_INIT(SECURITY_SERVER_TESTS_SERVER);
int ret = -1;
unsigned int attempt, max_attempt, expire_sec;
const char *subject_denied = TEST04_SUBJECT;
- struct smack_accesses *handle = NULL;
char *str = (char*) malloc(256);
attempt = max_attempt = expire_sec = 0;
char cookie[20];
char *ss_label = NULL;
char object[SECURITY_SERVER_MAX_OBJ_NAME];
- struct smack_accesses *handle = NULL;
ret = smack_set_label_for_self(subject_denied);
RUNNER_ASSERT_MSG(ret == 0, "ret: " << ret);
{
int ret = -1;
const char *subject_denied = TEST08_SUBJECT;
- struct smack_accesses *handle = NULL;
ret = smack_set_label_for_self(subject_denied);
RUNNER_ASSERT_MSG(ret == 0, "ret: " << ret);