int COOKIESIZE = security_server_get_cookie_size();
RUNNER_ASSERT_MSG(20 == COOKIESIZE, "Wrong cookie size from security-server");
- LOGD("%s %d", "Cookie size:", COOKIESIZE);
+ SLOGD("%s %d", "Cookie size:", COOKIESIZE);
cookie = (char*) calloc(COOKIESIZE, 1);
RUNNER_ASSERT_MSG(NULL != cookie, "Memory allocation error");
mypid = getpid();
- LOGD("%s %d", "This binary PID is:", mypid);
+ SLOGD("%s %d", "This binary PID is:", mypid);
res = smack_new_label_from_self(&label_smack);
if (0 != res) {
RUNNER_ASSERT_MSG(false, "Error in requesting cookie from security-server");
}
- LOGD("%s", "Received cookie:");
+ SLOGD("%s", "Received cookie:");
printhex((unsigned char*) cookie, COOKIESIZE);
label_ss = security_server_get_smacklabel_cookie(cookie);
RUNNER_ASSERT_MSG(false, "Error in getting label by cookie");
}
- LOGD("%s %s", "Label from SMACK:", label_smack);
- LOGD("%s %s", "Label from SS:", label_ss);
+ SLOGD("%s %s", "Label from SMACK:", label_smack);
+ SLOGD("%s %s", "Label from SS:", label_ss);
if (sizeof(label_smack) != sizeof(label_ss)) {
if (NULL != label_smack)
{
dotval = cur_pid % 1000;
if (dotval == 0)
- LOGD(".");
+ SLOGD(".");
exit(0);
}
cur_pid = getpid();
RUNNER_TEST(tc_security_server_request_cookie)
{
RUNNER_IGNORED_MSG("needs FIX, check FIXME comment");
- LOGD("Cycling PID to %d\n", target_pid);
+ SLOGD("Cycling PID to %d\n", target_pid);
cycle_pid(target_pid);
unlink("/opt/home/root/pid_cycle");
RUNNER_ASSERT(security_server_request_cookie((char*)new_cookie, 20) == SECURITY_SERVER_API_SUCCESS);
- LOGD("\nTarget PID: %d, Target UID: %d\n", target_pid, target_uid);
- LOGD("Previous cookie:\n");
+ SLOGD("\nTarget PID: %d, Target UID: %d\n", target_pid, target_uid);
+ SLOGD("Previous cookie:\n");
printhex(prev_cookie, 20);
- LOGD("Newly issued cookie:\n");
+ SLOGD("Newly issued cookie:\n");
printhex(new_cookie, 20);
RUNNER_ASSERT_MSG(memcmp(prev_cookie, new_cookie, cookie_size) != 0, "cookies are the same");
}
printf("%s\n", "cannot convert string uid to integer");
exit(1);
}
- LOGD("Target UID is %d. change user...\n", target_uid);
+ SLOGD("Target UID is %d. change user...\n", target_uid);
setuid(target_uid);
errno = 0;
mode_t sock_mode;
if (unlink(SECURITY_SERVER_TEST_SOCK_PATH) == -1 && errno != ENOENT) {
- LOGE("%s : %s\n", "unlink()", strerror(errno));
+ SLOGE("%s : %s\n", "unlink()", strerror(errno));
goto error;
}
/* Create Unix domain socket */
if ((localsockfd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
{
- LOGE("%s : %s\n", "socket()", strerror(errno));
+ SLOGE("%s : %s\n", "socket()", strerror(errno));
goto error;
}
if ((flags = fcntl(localsockfd, F_GETFL, 0)) < 0 ||
fcntl(localsockfd, F_SETFL, flags | O_NONBLOCK) < 0)
{
- LOGE("%s : %s\n", "fcntl()", strerror(errno));
+ SLOGE("%s : %s\n", "fcntl()", strerror(errno));
goto error;
}
/* Bind the socket */
if ((bind(localsockfd, (struct sockaddr*)&serveraddr, sizeof(serveraddr))) < 0)
{
- LOGE("%s : %s\n", "bind()", strerror(errno));
+ SLOGE("%s : %s\n", "bind()", strerror(errno));
goto error;
}
* But, fchmod doesn't work on socket file so there is no other choice at this point */
if (chmod(SECURITY_SERVER_TEST_SOCK_PATH, sock_mode) < 0) /* Flawfinder: ignore */
{
- LOGE("%s : %s\n", "chmod()", strerror(errno));
+ SLOGE("%s : %s\n", "chmod()", strerror(errno));
goto error;
}
retval = poll(poll_fd, 1, timeout);
if (retval < 0)
{
- LOGE("%s : %s\n", "poll()", strerror(errno));
+ SLOGE("%s : %s\n", "poll()", strerror(errno));
return -1;
}
/* Timed out */
if (retval == 0)
{
- LOGE("%s", "poll() timeout");
+ SLOGE("%s", "poll() timeout");
return 0;
}
return 1;
buf = (unsigned char*) malloc(send_len);
if (buf == NULL)
{
- LOGE("%s\n", "out of memory");
+ SLOGE("%s\n", "out of memory");
return -1;
}
retval = check_socket_poll(sock_fd, POLLOUT, 1000);
if (retval == -1)
{
- LOGE("%s\n", "poll() error");
+ SLOGE("%s\n", "poll() error");
if (buf != NULL)
free(buf);
return -1;
}
if (retval == 0)
{
- LOGE("%s\n", "poll() timeout");
+ SLOGE("%s\n", "poll() timeout");
if (buf != NULL)
free(buf);
return -1;
if (retval < send_len)
{
/* Write error */
- LOGE("Error on write(): %d. errno=%d, sockfd=%d\n", retval, errno, sock_fd);
+ SLOGE("Error on write(): %d. errno=%d, sockfd=%d\n", retval, errno, sock_fd);
if (buf != NULL)
free(buf);
return -1;
localsockfd = socket(AF_UNIX, SOCK_STREAM, 0);
if (localsockfd < 0)
{
- LOGE("%s : %s\n", "socket()", strerror(errno));
+ SLOGE("%s : %s\n", "socket()", strerror(errno));
return -1;
}
fcntl(localsockfd, F_SETFL, flags | O_NONBLOCK) < 0)
{
close(localsockfd);
- LOGE("%s : %s\n", "fcntl()", strerror(errno));
+ SLOGE("%s : %s\n", "fcntl()", strerror(errno));
return -1;
}
{
if (errno == EINPROGRESS)
{
- LOGD("%s\n", "Connection is in progress");
+ SLOGD("%s\n", "Connection is in progress");
check_socket_poll(localsockfd, POLLOUT, 1000);
if (ret == -1)
{
- LOGE("%s\n", "poll() error");
+ SLOGE("%s\n", "poll() error");
close(localsockfd);
return -1;
}
ret = connect(localsockfd, (struct sockaddr*)&clientaddr, client_len);
if (ret < 0)
{
- LOGE("%s\n", "connection failed");
+ SLOGE("%s\n", "connection failed");
close(localsockfd);
return -1;
}
}
else
{
- LOGE("%s\n", "Connection failed");
+ SLOGE("%s\n", "Connection failed");
close(localsockfd);
return -1;
}
if (retval != 0)
{
/* Error on socket */
- LOGE("Connection failed: %d\n", retval);
+ SLOGE("Connection failed: %d\n", retval);
goto error;
}
if (retval != 0)
{
/* Error on socket */
- LOGE("Send request failed: %d\n", retval);
+ SLOGE("Send request failed: %d\n", retval);
goto error;
}
- LOGD("%s", "Just closing the socket and exit\n");
+ SLOGD("%s", "Just closing the socket and exit\n");
error:
if (sockfd > 0)
RUNNER_TEST(tc_security_server_get_object_name_normal_case_trying_6001)
{
ret = security_server_get_object_name(6001, obj_name, sizeof(obj_name));
- LOGD("Result: %s\n", obj_name);
+ SLOGD("Result: %s\n", obj_name);
RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
}