${PROJECT_SOURCE_DIR}/tests/common/smack_access.cpp
${PROJECT_SOURCE_DIR}/tests/common/summary_collector.cpp
${PROJECT_SOURCE_DIR}/tests/common/dbus_access.cpp
- ${PROJECT_SOURCE_DIR}/tests/common/gdbbacktrace.cpp
${PROJECT_SOURCE_DIR}/tests/common/memory.cpp
${PROJECT_SOURCE_DIR}/tests/common/db_sqlite.cpp
${PROJECT_SOURCE_DIR}/tests/common/fs_label_manager.cpp
}
void AccessProvider::applyAndSwithToUser(int uid, int gid) {
- RUNNER_ASSERT_MSG_BT(0 == smack_revoke_subject(m_mySubject.c_str()),
+ RUNNER_ASSERT_MSG(0 == smack_revoke_subject(m_mySubject.c_str()),
"Error in smack_revoke_subject(" << m_mySubject << ")");
apply();
- RUNNER_ASSERT_MSG_BT(0 == smack_set_label_for_self(m_mySubject.c_str()),
+ RUNNER_ASSERT_MSG(0 == smack_set_label_for_self(m_mySubject.c_str()),
"Error in smack_set_label_for_self.");
- RUNNER_ASSERT_MSG_BT(0 == setgid(gid),
+ RUNNER_ASSERT_MSG(0 == setgid(gid),
"Error in setgid.");
- RUNNER_ASSERT_MSG_BT(0 == setuid(uid),
+ RUNNER_ASSERT_MSG(0 == setuid(uid),
"Error in setuid.");
}
return;
int ret = sqlite3_open_v2(m_db_path.c_str(), &m_db_handle, m_flags, VFS_NOT_USED);
- RUNNER_ASSERT_MSG_BT(m_db_handle, "Error opening the database: Unable to allocate memory.");
- RUNNER_ASSERT_MSG_BT(ret == SQLITE_OK, "Error opening the database: " <<
+ RUNNER_ASSERT_MSG(m_db_handle, "Error opening the database: Unable to allocate memory.");
+ RUNNER_ASSERT_MSG(ret == SQLITE_OK, "Error opening the database: " <<
sqlite3_errmsg(m_db_handle));
}
void Sqlite3DBase::close(void)
{
int ret = sqlite3_close(m_db_handle);
- RUNNER_ASSERT_MSG_BT(ret == SQLITE_OK, "Error closing the database: " <<
+ RUNNER_ASSERT_MSG(ret == SQLITE_OK, "Error closing the database: " <<
sqlite3_errmsg(m_db_handle));
m_db_handle = NULL;
}
sqlite3_free(tmp);
- RUNNER_ASSERT_MSG_BT(ret == SQLITE_OK || ret == SQLITE_ABORT, "Error executing statement <" <<
+ RUNNER_ASSERT_MSG(ret == SQLITE_OK || ret == SQLITE_ABORT, "Error executing statement <" <<
sql_query << "> : " << errmsg);
}
void DBusAccess::connect() {
m_conn = dbus_bus_get_private(DBUS_BUS_SYSTEM, &m_err);
- RUNNER_ASSERT_MSG_BT(dbus_error_is_set(&m_err) != 1,
+ RUNNER_ASSERT_MSG(dbus_error_is_set(&m_err) != 1,
"Error in dbus_bus_get: " << m_err.message);
dbus_connection_set_exit_on_disconnect(m_conn, FALSE);
}
void DBusAccess::requestName() {
dbus_bus_request_name(m_conn, m_dbus_client_name.c_str(),
DBUS_NAME_FLAG_REPLACE_EXISTING , &m_err);
- RUNNER_ASSERT_MSG_BT(dbus_error_is_set(&m_err) != 1,
+ RUNNER_ASSERT_MSG(dbus_error_is_set(&m_err) != 1,
"Error in dbus_bus_request_name: " << m_err.message);
}
dbus_systemd_object.c_str(),
dbus_systemd_interface.c_str(),
method);
- RUNNER_ASSERT_MSG_BT(NULL != m_msg,
+ RUNNER_ASSERT_MSG(NULL != m_msg,
"Error in dbus_message_new_method_call");
}
dbus_message_iter_init_append(m_msg, &iter);
int ret = dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING,
&argument);
- RUNNER_ASSERT_MSG_BT(ret != 0,
+ RUNNER_ASSERT_MSG(ret != 0,
"Error in dbus_message_iter_append_basic");
}
void DBusAccess::sendMsgWithReply() {
int ret = dbus_connection_send_with_reply(m_conn, m_msg, &m_pending, -1);
- RUNNER_ASSERT_MSG_BT(ret == 1,
+ RUNNER_ASSERT_MSG(ret == 1,
"Error in dbus_connection_send_with_reply");
- RUNNER_ASSERT_MSG_BT(NULL != m_pending, "Pending call null");
+ RUNNER_ASSERT_MSG(NULL != m_pending, "Pending call null");
dbus_connection_flush(m_conn);
dbus_pending_call_block(m_pending);
void DBusAccess::getMsgReply() {
m_msg = dbus_pending_call_steal_reply(m_pending);
- RUNNER_ASSERT_MSG_BT(NULL != m_msg,
+ RUNNER_ASSERT_MSG(NULL != m_msg,
"Error in dbus_pending_call_steal_reply");
}
void DBusAccess::handleMsgReply() {
DBusMessageIter iter;
- RUNNER_ASSERT_MSG_BT(dbus_message_iter_init(m_msg, &iter) != 0,
+ RUNNER_ASSERT_MSG(dbus_message_iter_init(m_msg, &iter) != 0,
"Message has no arguments");
if (DBUS_TYPE_OBJECT_PATH != dbus_message_iter_get_arg_type(&iter)) {
- RUNNER_ASSERT_MSG_BT(false, "No job path in msg");
+ RUNNER_FAIL_MSG("No job path in msg");
}
dbus_message_unref(m_msg);
dbus_pending_call_unref(m_pending);
std::string data = std::string("mode=0777,uid=0,smackfsdef=") + label;
int ret = mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Unable to make directory");
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "Unable to make directory");
ret = mount("none", path.c_str(), "tmpfs", 0, data.c_str());
- RUNNER_ASSERT_MSG_BT(ret == 0, "Unable to mount filesystem");
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "Unable to mount filesystem");
if (m_path[m_path.length()-1] != '/')
m_path += '/';
mode_t systemMask = umask(0000);
int fd = open(path.c_str(), O_RDWR | O_CREAT | O_TRUNC, S_IRWXU | S_IRWXG | S_IRWXO);
umask(systemMask);
- RUNNER_ASSERT_MSG_BT(fd > -1, "Unable to create file for tests: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(fd > -1, "Unable to create file for tests");
close(fd);
int ret = chown(path.c_str(), APP_UID, APP_GID);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Unable to change file owner: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "Unable to change file owner");
}
void FsLabelManager::createLink(const std::string &relativeLinkPath, const std::string &relativeRealPath)
std::string realPath = m_path + relativeRealPath;
int ret = unlink(linkPath.c_str());
- RUNNER_ASSERT_MSG_BT(ret == 0 || errno == ENOENT, "Unable to unlink file." << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0 || errno == ENOENT, "Unable to unlink file");
ret = symlink(realPath.c_str(), linkPath.c_str());
- RUNNER_ASSERT_MSG_BT(ret == 0, "Unable to create symlink." << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "Unable to create symlink");
ret = lchown(linkPath.c_str(), APP_UID, APP_GID);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Unable to change file owner: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "Unable to change file owner");
}
void FsLabelManager::testSmackSetLabel(const std::string &relativePath,
std::string path = m_path + relativePath;
int ret = smack_setlabel(path.c_str(), label, labelType);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error in normal setting label " << label);
+ RUNNER_ASSERT_MSG(ret == 0, "Error in normal setting label " << label);
checkLabel(path, label, labelType);
}
std::string path = m_path + relativePath;
int ret = smack_lsetlabel(path.c_str(), label, labelType);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error in link setting label " << label);
+ RUNNER_ASSERT_MSG(ret == 0, "Error in link setting label " << label);
checkLinkLabel(path, label, labelType);
}
std::string path = m_path + relativePath;
int fd = open(path.c_str(), O_WRONLY);
- RUNNER_ASSERT_MSG_BT(fd > -1, "Unable to open file: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(fd > -1, "Unable to open file");
int ret = smack_fsetlabel(fd, label, labelType);
close(fd);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error in fd setting " << label);
+ RUNNER_ASSERT_MSG(ret == 0, "Error in fd setting " << label);
checkLabel(path, label, labelType);
}
char *tmpLabel;
int ret = smack_getlabel(path.c_str(), &tmpLabel, labelType);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error in normal getting label");
+ RUNNER_ASSERT_MSG(ret == 0, "Error in normal getting label");
SmackLabelPtr labelPtr(tmpLabel);
if (label == NULL && !m_label.compare(tmpLabel))
return;
- RUNNER_ASSERT_MSG_BT(label != NULL, "Path should be related with file system default label. "
+ RUNNER_ASSERT_MSG(label != NULL, "Path should be related with file system default label. "
<< tmpLabel << " != " << m_label);
ret = strcmp(tmpLabel, label);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Wrong label. " << tmpLabel << " != " << label);
+ RUNNER_ASSERT_MSG(ret == 0, "Wrong label. " << tmpLabel << " != " << label);
checkLabel(path, tmpLabel, labelType);
}
char *tmpLabel;
int ret = smack_lgetlabel(path.c_str(), &tmpLabel, labelType);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error in link getting label");
+ RUNNER_ASSERT_MSG(ret == 0, "Error in link getting label");
SmackLabelPtr labelPtr(tmpLabel);
if (label == NULL && !m_label.compare(tmpLabel))
return;
- RUNNER_ASSERT_MSG_BT(label != NULL, "Path should be related with file system default label. "
+ RUNNER_ASSERT_MSG(label != NULL, "Path should be related with file system default label. "
<< tmpLabel << " != " << m_label);
ret = strcmp(tmpLabel, label);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Wrong label. " << tmpLabel << " != " << label);
+ RUNNER_ASSERT_MSG(ret == 0, "Wrong label. " << tmpLabel << " != " << label);
checkLinkLabel(path, tmpLabel, labelType);
}
{
std::string path = m_path + relativePath;
int fd = open(path.c_str(), O_WRONLY);
- RUNNER_ASSERT_MSG_BT(fd > -1, "Unable to open file: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(fd > -1, "Unable to open file");
char *tmpLabel;
int ret = smack_fgetlabel(fd, &tmpLabel, labelType);
close(fd);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error in fd getting label");
+ RUNNER_ASSERT_MSG(ret == 0, "Error in fd getting label");
SmackLabelPtr labelPtr(tmpLabel);
if (label == NULL && !m_label.compare(tmpLabel))
return;
- RUNNER_ASSERT_MSG_BT(label != NULL, "Fd should be related with file system default label. "
+ RUNNER_ASSERT_MSG(label != NULL, "Fd should be related with file system default label. "
<< tmpLabel << " != " << m_label);
ret = strcmp(tmpLabel, label);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Wrong label. " << tmpLabel << " != " << label);
+ RUNNER_ASSERT_MSG(ret == 0, "Wrong label. " << tmpLabel << " != " << label);
checkLabel(path, tmpLabel, labelType);
}
{
char buf[SMACK_LABEL_LEN+2] = { 0, };
int ret = getxattr(path.c_str(), get_xattr_name(labelType), buf, SMACK_LABEL_LEN+1);
- RUNNER_ASSERT_MSG_BT(ret > 0, "Error in getting xattr. " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret > 0, "Error in getting xattr");
const char *tmpLabel;
if (label == NULL)
tmpLabel = label;
ret = strncmp(tmpLabel, buf, SMACK_LABEL_LEN+1);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Wrong label. " << tmpLabel << " != " << buf);
+ RUNNER_ASSERT_MSG(ret == 0, "Wrong label. " << tmpLabel << " != " << buf);
}
void FsLabelManager::checkLinkLabel(const std::string &path,
{
char buf[SMACK_LABEL_LEN+2] = { 0, };
int ret = lgetxattr(path.c_str(), get_xattr_name(labelType), buf, SMACK_LABEL_LEN+1);
- RUNNER_ASSERT_MSG_BT(ret > 0, "Error in getting xattr. " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret > 0, "Error in getting xattr");
const char *tmpLabel;
if (label == NULL)
tmpLabel = label;
ret = strncmp(tmpLabel, buf, SMACK_LABEL_LEN+1);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Wrong label. " << tmpLabel << " != " << buf);
+ RUNNER_ASSERT_MSG(ret == 0, "Wrong label. " << tmpLabel << " != " << buf);
}
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * @file gdbbacktrace.cpp
- * @author Pawel Broda (p.broda@partner.samsung.com)
- * @version 1.0
- * @brief API providing backtrace
- */
-
-#include <fcntl.h>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include "gdbbacktrace.h"
-
-namespace {
-const size_t MAX_BACKTRACE_LINE_LENGTH = 1024;
-const std::string COLOUR_CODE_RED("\033[31m");
-const std::string COLOUR_CODE_RESET("\033[0m");
-
-const std::string FRAME_PATTERN_WAITPID("#0 ");
-const std::string FRAME_PATTERN_BACKTRACE("#1 ");
-const std::string FRAME_PATTERN_DPL("in DPL::Test");
-
-void print_colour(const std::string& err)
-{
- std::cerr << COLOUR_CODE_RED << err << COLOUR_CODE_RESET << std::endl;
-}
-
-bool backtrace_parse_line(const std::string& line, std::ostream& result, size_t line_number)
-{
- if (line.empty() || line[0] != '#')
- return false;
-
- // backtrace info - omit waitpid(), backtrace() and DPL frames
- if (line.find(FRAME_PATTERN_WAITPID) == 0)
- return false;
-
- if (line.find(FRAME_PATTERN_BACKTRACE) == 0)
- return false;
-
- if (line.find(FRAME_PATTERN_DPL) != std::string::npos)
- return false;
-
- // example std::string line content:
- // "#5 0x000000000040198d in main () at ../src/backtrace.cpp:105"
- // should result in (i.e. would be written into char line_formatted):
- // "main () at ../src/backtrace.cpp:105"
-
- char line_formatted[MAX_BACKTRACE_LINE_LENGTH];
- line_formatted[0] = '\0';
- sscanf(line.c_str(), "%*s %*s %[^\n]", line_formatted);
- if (line_formatted[0] != '\0') {
- result << "#" << std::left << std::setw(2) << line_number << " " << line_formatted <<
- std::endl;
- return true;
- }
-
- return false;
-}
-
-std::string backtrace_read(int fd)
-{
- FILE *bt_fd = fdopen(fd, "r");
- char read_buffer[MAX_BACKTRACE_LINE_LENGTH];
- std::ostringstream result;
-
- result << std::endl;
- size_t line_number = 1;
- while (fgets(read_buffer, sizeof(read_buffer) - 1, bt_fd) != NULL) {
- if (backtrace_parse_line(read_buffer, result, line_number))
- ++line_number;
- }
-
- fclose(bt_fd);
-
- // check if gdbbacktrace() called directly from the test
- if (line_number == 2)
- return "";
-
- return result.str();
-}
-} // anonymous backtrace namespace end
-
-std::string gdbbacktrace(void)
-{
- std::string pid_buf = std::to_string(getpid());
- int pipe_fd[2];
- pipe(pipe_fd);
-
- int child_pid = fork();
- if (child_pid == -1)
- {
- print_colour("fork needed to run gdb in batch mode failed...");
- return "";
- }
-
- if (child_pid == 0) {
- int devnull = open("/dev/null", O_WRONLY);
- if (dup2(devnull, 2) == -1)
- exit(2);
- if (dup2(pipe_fd[1], 1) == -1)
- exit(2);
- execlp("/usr/bin/gdb", "gdb", "--batch", "-n", "-ex", "thread", "-ex", "bt", "--pid",
- pid_buf.c_str(), NULL);
- // gdb failed to start...
- exit(1);
- }
-
- int status;
- int waitpid_res = waitpid(child_pid, &status, 0);
-
- close(pipe_fd[1]);
-
- std::string result;
- if (waitpid_res == -1) {
- print_colour("Backtrace not available (waitpid failed)");
- } else if (status == 2) {
- print_colour("Error: file descriptor duplication failed... failed to start gdb...");
- } else if (status != 0) {
- print_colour("Error: no gdb or failed to start gdb...");
- } else {
- result.append(backtrace_read(pipe_fd[0]));
- }
-
- close(pipe_fd[0]);
-
- return result;
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * @file gdbbacktrace.h
- * @author Pawel Broda (p.broda@partner.samsung.com)
- * @version 1.0
- * @brief API providing backtrace
- */
-
-#ifndef _GDBBACKTRACE_H_
-#define _GDBBACKTRACE_H_
-
-#include <string>
-
-std::string gdbbacktrace(void);
-
-#endif
SmackAccess::SmackAccess()
: m_handle(NULL)
{
- RUNNER_ASSERT_MSG_BT(0 == smack_accesses_new(&m_handle),
+ RUNNER_ASSERT_MSG(0 == smack_accesses_new(&m_handle),
"Error in smack_accesses_new");
}
const std::string &object,
const std::string &rights)
{
- RUNNER_ASSERT_MSG_BT(0 == smack_accesses_add(m_handle,
+ RUNNER_ASSERT_MSG(0 == smack_accesses_add(m_handle,
subject.c_str(),
object.c_str(),
rights.c_str()),
}
void SmackAccess::apply() {
- RUNNER_ASSERT_MSG_BT(0 == smack_accesses_apply(m_handle),
+ RUNNER_ASSERT_MSG(0 == smack_accesses_apply(m_handle),
"Error in smack_accessses_apply.");
}
void setLabelForSelf(const int line, const char *label)
{
int ret = smack_set_label_for_self(label);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error in smack_set_label_for_self(): " << ret << ", line: " << line);
+ RUNNER_ASSERT_MSG(ret == 0, "Error in smack_set_label_for_self(): " << ret << ", line: " << line);
}
/*
{
// get group ID by group name
group *gr = getgrnam(group_name);
- RUNNER_ASSERT_MSG_BT(gr != NULL, "Group '" << group_name << "' does not exist.");
+ RUNNER_ASSERT_ERRNO_MSG(gr != NULL, "getgrnam failed on '" << group_name << "' group");
const gid_t new_group_id = gr->gr_gid;
// get number of groups that the current process belongs to
// add new group & apply change
groups[ngroups] = new_group_id;
int ret = setgroups(groups.size(), groups.data());
- int error = errno;
- RUNNER_ASSERT_MSG_BT(ret == 0, "setgroups() failed. " << strerror(error));
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "setgroups() failed");
}
/*
{
// get group ID by group name
group *gr = getgrnam(group_name);
- RUNNER_ASSERT_MSG_BT(gr != NULL, "Group '" << group_name << "' does not exist.");
+ RUNNER_ASSERT_ERRNO_MSG(gr != NULL, "getgrnam failed on '" << group_name << "' group");
const gid_t new_group_id = gr->gr_gid;
int ngroups = getgroups(0, NULL);
if (groups.size() != (size_t)ngroups) {
// apply change
int ret = setgroups(groups.size(), groups.data());
- int error = errno;
- RUNNER_ASSERT_MSG_BT(ret == 0, "setgroups() failed. " << strerror(error));
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "setgroups() failed");
}
}
#include <errno.h>
#include <string.h>
-#include "gdbbacktrace.h"
-
const uid_t APP_UID = 5000;
const gid_t APP_GID = 5000;
const uid_t DB_ALARM_UID = 6001;
} \
void Proc##Multi()
-#define RUNNER_ASSERT_MSG_BT(test, msg) RUNNER_ASSERT_MSG(test,\
- msg << gdbbacktrace())
-#define RUNNER_ASSERT_BT(test) RUNNER_ASSERT_MSG_BT(test, "")
-
-#define RUNNER_ASSERT_MSG_ERRNO_BT(test, msg) \
- RUNNER_ASSERT_MSG_BT(test, msg << strerror(errno))
-
namespace DB {
class Transaction
Transaction() {
db_result = perm_begin();
- RUNNER_ASSERT_MSG_BT(PC_OPERATION_SUCCESS == db_result,
+ RUNNER_ASSERT_MSG(PC_OPERATION_SUCCESS == db_result,
"perm_begin returned: " << db_result);
}
DB::Transaction db_transaction;
#define DB_END } \
- RUNNER_ASSERT_MSG_BT(PC_OPERATION_SUCCESS == DB::Transaction::db_result, \
+ RUNNER_ASSERT_MSG(PC_OPERATION_SUCCESS == DB::Transaction::db_result, \
"perm_end returned: " << DB::Transaction::db_result);
// Common macros and labels used in tests
: m_admin(nullptr)
{
int ret = cynara_admin_initialize(&m_admin);
- RUNNER_ASSERT_MSG_BT(ret == CYNARA_ADMIN_API_SUCCESS,
+ RUNNER_ASSERT_MSG(ret == CYNARA_ADMIN_API_SUCCESS,
"cynara_admin_initialize failed. ret: " << ret);
- RUNNER_ASSERT_MSG_BT(m_admin != nullptr, "cynara_admin struct was not initialized");
+ RUNNER_ASSERT_MSG(m_admin != nullptr, "cynara_admin struct was not initialized");
}
CynaraTestAdmin::~CynaraTestAdmin()
policies[policiesContainer.m_policies.size()] = nullptr;
int ret = cynara_admin_set_policies(m_admin, policies);
- RUNNER_ASSERT_MSG_BT(ret == expectedResult,
+ RUNNER_ASSERT_MSG(ret == expectedResult,
"cynara_admin_set_policies returned wrong value: "
<< ret << " != " << expectedResult << ". "
<< "policies:\n" << policies);
int expectedResult)
{
int ret = cynara_admin_set_bucket(m_admin, bucket, operation, extra);
- RUNNER_ASSERT_MSG_BT(ret == expectedResult,
+ RUNNER_ASSERT_MSG(ret == expectedResult,
"cynara_admin_set_bucket returned wrong value: "
<< ret << " != " << expectedResult << "."
<< " bucket: " << formatCstr(bucket) << ","
: m_cynara(nullptr)
{
int ret = cynara_initialize(&m_cynara, nullptr);
- RUNNER_ASSERT_MSG_BT(ret == CYNARA_API_SUCCESS,
+ RUNNER_ASSERT_MSG(ret == CYNARA_API_SUCCESS,
"cynara_initialize failed. ret: " << ret);
- RUNNER_ASSERT_MSG_BT(m_cynara != nullptr, "cynara struct was not initialized");
+ RUNNER_ASSERT_MSG(m_cynara != nullptr, "cynara struct was not initialized");
}
CynaraTestClient::~CynaraTestClient()
int expectedResult)
{
int ret = cynara_check(m_cynara, client, session, user, privilege);
- RUNNER_ASSERT_MSG_BT(ret == expectedResult,
+ RUNNER_ASSERT_MSG(ret == expectedResult,
"cynara_check returned wrong value: "
<< ret << " != " << expectedResult << "."
<< " client: " << formatCstr(client) << ","
int tflag, struct FTW * /*ftwbuf*/)
{
if (tflag == FTW_F)
- RUNNER_ASSERT_MSG_BT(!unlink(fpath), "Unable to unlink " << fpath << " file. "
- << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(!unlink(fpath), "Unable to unlink " << fpath << " file");
else
- RUNNER_ASSERT_MSG_BT(tflag == FTW_DP, "Visited file should not exist. Path: " << fpath);
+ RUNNER_ASSERT_MSG(tflag == FTW_DP, "Visited file should not exist. Path: " << fpath);
return 0;
}
void copyFile(const std::string &src, const std::string &dst)
{
int inFd = TEMP_FAILURE_RETRY(open(src.c_str(), O_RDONLY));
- RUNNER_ASSERT_MSG_ERRNO_BT(inFd > 0, "Opening " << src << " file failed");
+ RUNNER_ASSERT_ERRNO_MSG(inFd > 0, "Opening " << src << " file failed");
FdUniquePtr inFdPtr(&inFd);
int outFd = TEMP_FAILURE_RETRY(creat(dst.c_str(), 0700));
- RUNNER_ASSERT_MSG_ERRNO_BT(outFd > 0, "Creating " << dst << " file failed");
+ RUNNER_ASSERT_ERRNO_MSG(outFd > 0, "Creating " << dst << " file failed");
FdUniquePtr outFdPtr(&outFd);
long int len = sysconf(_SC_GETPW_R_SIZE_MAX);
- RUNNER_ASSERT_MSG_BT(len != -1, "No suggested buflen");
+ RUNNER_ASSERT_MSG(len != -1, "No suggested buflen");
size_t buflen = len;
char *buf = static_cast<char*>(malloc(buflen));
struct passwd pwbuf, *pwbufp = nullptr;
int ret = TEMP_FAILURE_RETRY(getpwnam_r(cynaraUser.c_str(),
&pwbuf, buf, buflen, &pwbufp));
- RUNNER_ASSERT_MSG_ERRNO_BT(ret == 0, "getpwnam_r failed on " << cynaraUser << " user");
- RUNNER_ASSERT_MSG_BT(pwbufp, "User " << cynaraUser << " does not exist");
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "getpwnam_r failed on " << cynaraUser << " user");
+ RUNNER_ASSERT_MSG(pwbufp, "User " << cynaraUser << " does not exist");
ret = fchown(outFd, pwbufp->pw_uid, pwbufp->pw_gid);
- RUNNER_ASSERT_MSG_ERRNO_BT(ret != -1, "fchown failed");
+ RUNNER_ASSERT_ERRNO_MSG(ret != -1, "fchown failed");
ret = smack_fsetlabel(outFd, cynaraLabel.c_str(), SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Setting smack label failed");
+ RUNNER_ASSERT_MSG(ret == 0, "Setting smack label failed");
struct stat statSrc;
ret = fstat(inFd, &statSrc);
- RUNNER_ASSERT_MSG_ERRNO_BT(ret != -1, "fstat failed");
+ RUNNER_ASSERT_ERRNO_MSG(ret != -1, "fstat failed");
ret = sendfile(outFd, inFd, 0, statSrc.st_size);
- RUNNER_ASSERT_MSG_ERRNO_BT(ret != -1, "sendfile failed");
+ RUNNER_ASSERT_ERRNO_MSG(ret != -1, "sendfile failed");
}
void copyDir(const std::string &source, const std::string &destination)
DIR *dirPtr = nullptr;
struct dirent *direntPtr;
- RUNNER_ASSERT_MSG_ERRNO_BT(dirPtr = opendir(source.c_str()),
+ RUNNER_ASSERT_ERRNO_MSG(dirPtr = opendir(source.c_str()),
"opening " << source << " dir failed");
DirPtr dirScopedPtr(dirPtr);
{
int ret = nftw(dir.c_str(), removeContents, 2, FTW_DEPTH | FTW_PHYS);
if (ret == -1)
- RUNNER_ASSERT_MSG_ERRNO_BT(errno == ENOENT, "nftw failed");
+ RUNNER_ASSERT_ERRNO_MSG(errno == ENOENT, "nftw failed");
}
void removeDirIfExists(const std::string &dir)
{
- RUNNER_ASSERT_MSG_ERRNO_BT(!rmdir(dir.c_str()) || errno == ENOENT,
+ RUNNER_ASSERT_ERRNO_MSG(!rmdir(dir.c_str()) || errno == ENOENT,
"Removing " << dir << " dir failed");
}
if (ret == -1 && errno == ENOENT) {
return false;
} else if (ret == -1) {
- RUNNER_ASSERT_MSG_ERRNO_BT(false, "Cannot stat " << cynaraDbDir
+ RUNNER_ASSERT_ERRNO_MSG(false, "Cannot stat " << cynaraDbDir
<< " not due to its nonexistence");
}
- RUNNER_ASSERT_MSG_BT(st.st_mode & S_IFDIR, cynaraDbDir << " is not a directory");
+ RUNNER_ASSERT_MSG(st.st_mode & S_IFDIR, cynaraDbDir << " is not a directory");
return true;
}
m_dbPresent = cynaraDbExists();
if (m_dbPresent) {
- RUNNER_ASSERT_MSG_ERRNO_BT(!mkdir(m_dir.c_str(), S_IRWXU | S_IRWXG | S_IRWXO),
+ RUNNER_ASSERT_ERRNO_MSG(!mkdir(m_dir.c_str(), S_IRWXU | S_IRWXG | S_IRWXO),
"Unable to make " << m_dir << " test directory");
copyDir(cynaraDbDir, m_dir);
}
CynaraTestClient cynara;
for (auto it = data.begin(); it != data.end(); ++it) {
- RUNNER_ASSERT_MSG_BT(it->size() == 3, "Wrong test data size");
+ RUNNER_ASSERT_MSG(it->size() == 3, "Wrong test data size");
}
for (auto itClient = data.begin(); itClient != data.end(); ++itClient) {
void checkSingleWildcardData(const std::vector< std::vector<const char *> > &data)
{
- RUNNER_ASSERT_MSG_BT(data.size() == 3, "Wrong test data size");
+ RUNNER_ASSERT_MSG(data.size() == 3, "Wrong test data size");
for (auto it = data.begin(); it != data.end(); ++it) {
- RUNNER_ASSERT_MSG_BT(it->size() == 3, "Wrong test data size");
+ RUNNER_ASSERT_MSG(it->size() == 3, "Wrong test data size");
}
}
${PROJECT_SOURCE_DIR}/tests/framework/src/binary_queue.cpp
${PROJECT_SOURCE_DIR}/tests/framework/src/colors.cpp
${PROJECT_SOURCE_DIR}/tests/framework/src/exception.cpp
+ ${PROJECT_SOURCE_DIR}/tests/framework/src/gdbbacktrace.cpp
${PROJECT_SOURCE_DIR}/tests/framework/src/noncopyable.cpp
${PROJECT_SOURCE_DIR}/tests/framework/src/singleton.cpp
${PROJECT_SOURCE_DIR}/tests/framework/src/abstract_log_provider.cpp
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file gdbbacktrace.h
+ * @author Pawel Broda (p.broda@partner.samsung.com)
+ * @version 1.0
+ * @brief API providing backtrace
+ */
+
+#ifndef _GDBBACKTRACE_H_
+#define _GDBBACKTRACE_H_
+
+#include <string>
+
+std::string gdbbacktrace(void);
+
+#endif
* @version 1.0
* @brief This file is the header file of test runner
*/
+
#ifndef DPL_TEST_RUNNER_H
#define DPL_TEST_RUNNER_H
-#include <dpl/singleton.h>
-#include <dpl/availability.h>
-#include <dpl/atomic.h>
-#include <dpl/test/test_results_collector.h>
-#include <sstream>
-#include <string>
-#include <vector>
#include <chrono>
#include <list>
-#include <set>
#include <map>
+#include <set>
+#include <sstream>
+#include <string>
+#include <vector>
+
+#include <dpl/atomic.h>
+#include <dpl/availability.h>
+#include <dpl/gdbbacktrace.h>
+#include <dpl/singleton.h>
+#include <dpl/test/test_results_collector.h>
namespace DPL {
namespace Test {
}
} // namespace DPL
-#define RUNNER_TEST_GROUP_INIT(GroupName) \
- static int Static##GroupName##Init() \
- { \
+#define RUNNER_TEST_GROUP_INIT(GroupName) \
+ static int Static##GroupName##Init() \
+ { \
DPL::Test::TestRunnerSingleton::Instance().InitGroup(#GroupName); \
- return 0; \
- } \
- const int DPL_UNUSED Static##GroupName##InitVar = \
+ return 0; \
+ } \
+ const int DPL_UNUSED Static##GroupName##InitVar = \
Static##GroupName##Init();
-#define RUNNER_TEST(Proc) \
- void Proc(); \
- static int Static##Proc##Init() \
- { \
+#define RUNNER_TEST(Proc) \
+ void Proc(); \
+ static int Static##Proc##Init() \
+ { \
DPL::Test::TestRunnerSingleton::Instance().RegisterTest(#Proc, &Proc); \
- return 0; \
- } \
- const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init(); \
+ return 0; \
+ } \
+ const int DPL_UNUSED Static##Proc##InitVar = Static##Proc##Init(); \
void Proc()
-//! \brief Returns base name for path
-
-#define RUNNER_ASSERT_MSG(test, message) \
- do \
- { \
- DPL::Test::TestRunnerSingleton::Instance().MarkAssertion(); \
- \
- if (!(test)) \
- { \
- std::ostringstream assertMsg; \
- assertMsg << message; \
- throw DPL::Test::TestRunner::TestFailed(#test, \
- __FILE__, \
- __LINE__, \
+
+/**
+ * ASSERT MACROS
+ *
+ * Use them to create assertions in test cases. To do that put them inside test
+ * body. Failing assertion indicates failing test.
+ */
+
+#define RUNNER_ASSERT_MSG(test, message) \
+ do \
+ { \
+ DPL::Test::TestRunnerSingleton::Instance().MarkAssertion(); \
+ \
+ if (!(test)) \
+ { \
+ std::ostringstream assertMsg; \
+ assertMsg << message << gdbbacktrace(); \
+ throw DPL::Test::TestRunner::TestFailed(#test, \
+ __FILE__, \
+ __LINE__, \
assertMsg.str()); \
- } \
+ } \
} while (0)
-#define RUNNER_ASSERT(test) RUNNER_ASSERT_MSG(test, "")
+#define RUNNER_ASSERT_ERRNO_MSG(test, message) \
+ do \
+ { \
+ DPL::Test::TestRunnerSingleton::Instance().MarkAssertion(); \
+ \
+ if (!(test)) \
+ { \
+ const char *err = strerror(errno); \
+ std::ostringstream assertMsg; \
+ assertMsg << message; \
+ if (!assertMsg.str().empty()) \
+ assertMsg << ". "; \
+ assertMsg << err << gdbbacktrace(); \
+ throw DPL::Test::TestRunner::TestFailed(#test, \
+ __FILE__, \
+ __LINE__, \
+ assertMsg.str()); \
+ } \
+ } while (0)
-#define RUNNER_FAIL RUNNER_ASSERT(false)
+#define RUNNER_ASSERT_ERRNO(test) \
+ RUNNER_ASSERT_ERRNO_MSG(test, "")
-#define RUNNER_IGNORED_MSG(message) do { std::ostringstream assertMsg; \
- assertMsg << message; \
- throw DPL::Test::TestRunner::Ignored( \
- assertMsg.str()); \
-} while (0)
+#define RUNNER_FAIL_MSG(message) \
+ RUNNER_ASSERT_MSG(false, message)
-/*
+#define RUNNER_ASSERT(test) \
+ RUNNER_ASSERT_MSG(test, "")
+
+/**
+ * IGNORE MACRO
+ *
+ * When test reaches this macro call, its furhter code will be ignored.
+ * To ignore whole test, put this macro call at the beginning of this tests
+ * body.
+ */
+
+#define RUNNER_IGNORED_MSG(message) \
+ do \
+ { \
+ std::ostringstream assertMsg; \
+ assertMsg << message; \
+ throw DPL::Test::TestRunner::Ignored(assertMsg.str()); \
+ } while (0)
+
+/**
+ * PERF MACROS
+ *
* Use these macros to do the time measurement. The first macro will start time measurement,
* the second will gather the result. These macros can be used only once per test-case.
* The result of time measurement will be displayed only if the test will pass.
* - csv
* In TAP format performance result will not be displayed.
*/
-#define RUNNER_PERF_TEST_BEGIN(maxTime) \
- do { \
- DPL::Test::TestRunnerSingleton::Instance().beginPerformanceTestTime( \
- std::chrono::microseconds{static_cast<long long int>(maxTime*1000000.0)}); \
+
+#define RUNNER_PERF_TEST_BEGIN(maxTime) \
+ do { \
+ DPL::Test::TestRunnerSingleton::Instance().beginPerformanceTestTime( \
+ std::chrono::microseconds{static_cast<long long int>(maxTime*1000000.0)}); \
} while (0)
#define RUNNER_PERF_TEST_END() \
DPL::Test::TestRunnerSingleton::Instance().endPerformanceTestTime(); \
} while (0)
+
#endif // DPL_TEST_RUNNER_H
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @file gdbbacktrace.cpp
+ * @author Pawel Broda (p.broda@partner.samsung.com)
+ * @version 1.0
+ * @brief API providing backtrace
+ */
+
+#include <fcntl.h>
+#include <iomanip>
+#include <iostream>
+#include <sstream>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+#include <dpl/gdbbacktrace.h>
+
+namespace {
+const size_t MAX_BACKTRACE_LINE_LENGTH = 1024;
+const std::string COLOUR_CODE_RED("\033[31m");
+const std::string COLOUR_CODE_RESET("\033[0m");
+
+const std::string FRAME_PATTERN_WAITPID("#0 ");
+const std::string FRAME_PATTERN_BACKTRACE("#1 ");
+const std::string FRAME_PATTERN_DPL("in DPL::Test");
+
+void print_colour(const std::string& err)
+{
+ std::cerr << COLOUR_CODE_RED << err << COLOUR_CODE_RESET << std::endl;
+}
+
+bool backtrace_parse_line(const std::string& line, std::ostream& result, size_t line_number)
+{
+ if (line.empty() || line[0] != '#')
+ return false;
+
+ // backtrace info - omit waitpid(), backtrace() and DPL frames
+ if (line.find(FRAME_PATTERN_WAITPID) == 0)
+ return false;
+
+ if (line.find(FRAME_PATTERN_BACKTRACE) == 0)
+ return false;
+
+ if (line.find(FRAME_PATTERN_DPL) != std::string::npos)
+ return false;
+
+ // example std::string line content:
+ // "#5 0x000000000040198d in main () at ../src/backtrace.cpp:105"
+ // should result in (i.e. would be written into char line_formatted):
+ // "main () at ../src/backtrace.cpp:105"
+
+ char line_formatted[MAX_BACKTRACE_LINE_LENGTH];
+ line_formatted[0] = '\0';
+ sscanf(line.c_str(), "%*s %*s %[^\n]", line_formatted);
+ if (line_formatted[0] != '\0') {
+ result << "#" << std::left << std::setw(2) << line_number << " " << line_formatted <<
+ std::endl;
+ return true;
+ }
+
+ return false;
+}
+
+std::string backtrace_read(int fd)
+{
+ FILE *bt_fd = fdopen(fd, "r");
+ char read_buffer[MAX_BACKTRACE_LINE_LENGTH];
+ std::ostringstream result;
+
+ result << std::endl;
+ size_t line_number = 1;
+ while (fgets(read_buffer, sizeof(read_buffer) - 1, bt_fd) != NULL) {
+ if (backtrace_parse_line(read_buffer, result, line_number))
+ ++line_number;
+ }
+
+ fclose(bt_fd);
+
+ // check if gdbbacktrace() called directly from the test
+ if (line_number == 2)
+ return "";
+
+ return result.str();
+}
+} // anonymous backtrace namespace end
+
+std::string gdbbacktrace(void)
+{
+ std::string pid_buf = std::to_string(getpid());
+ int pipe_fd[2];
+ pipe(pipe_fd);
+
+ int child_pid = fork();
+ if (child_pid == -1)
+ {
+ print_colour("fork needed to run gdb in batch mode failed...");
+ return "";
+ }
+
+ if (child_pid == 0) {
+ int devnull = open("/dev/null", O_WRONLY);
+ if (dup2(devnull, 2) == -1)
+ exit(2);
+ if (dup2(pipe_fd[1], 1) == -1)
+ exit(2);
+ execlp("/usr/bin/gdb", "gdb", "--batch", "-n", "-ex", "thread", "-ex", "bt", "--pid",
+ pid_buf.c_str(), NULL);
+ // gdb failed to start...
+ exit(1);
+ }
+
+ int status;
+ int waitpid_res = waitpid(child_pid, &status, 0);
+
+ close(pipe_fd[1]);
+
+ std::string result;
+ if (waitpid_res == -1) {
+ print_colour("Backtrace not available (waitpid failed)");
+ } else if (status == 2) {
+ print_colour("Error: file descriptor duplication failed... failed to start gdb...");
+ } else if (status != 0) {
+ print_colour("Error: no gdb or failed to start gdb...");
+ } else {
+ result.append(backtrace_read(pipe_fd[0]));
+ }
+
+ close(pipe_fd[0]);
+
+ return result;
+}
continue;
ret = base_name_from_perm(perm_list[i], permission_name);
- RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS, "permission : <" << perm_list[i] <<
+ RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS, "permission : <" << perm_list[i] <<
"> cannot be converted to basename (iri parse error)");
app_permission(name, permission_name, permission_group_type_name, is_volatile,
PERMISSION_ENABLED);
"WHERE name == '" << app_name << "' ;";
m_base.execute(sql.str(), result);
- RUNNER_ASSERT_MSG_BT(result.rows.size() == 1 && result.rows[0].size() == 1, "query : <" <<
+ RUNNER_ASSERT_MSG(result.rows.size() == 1 && result.rows[0].size() == 1, "query : <" <<
sql.str() << "> returned [" << result.rows.size() << "] rows");
}
"WHERE name == '" << app_name << "' ;";
m_base.execute(sql.str(), result);
- RUNNER_ASSERT_MSG_BT(result.rows.size() == 0, "query : <" << sql.str() << "> returned [" <<
+ RUNNER_ASSERT_MSG(result.rows.size() == 0, "query : <" << sql.str() << "> returned [" <<
result.rows.size() << "] rows");
}
";";
m_base.execute(sql.str(), result);
- RUNNER_ASSERT_MSG_BT(result.rows.size() == 1, "query : <" << sql.str() << "> returned [" <<
+ RUNNER_ASSERT_MSG(result.rows.size() == 1, "query : <" << sql.str() << "> returned [" <<
result.rows.size() << "] rows");
}
void read_gids(std::set<unsigned> &set, const char *file_path)
{
FILE *f = fopen(file_path, "r");
- RUNNER_ASSERT_MSG_BT(f != NULL, "Unable to open file " << file_path);
+ RUNNER_ASSERT_ERRNO_MSG(f != NULL, "Unable to open file " << file_path);
unsigned gid;
while (fscanf(f, "%u\n", &gid) == 1) {
set.insert(gid);
{
int ret;
+ errno = 0;
struct passwd *pw = getpwuid(user_id);
- RUNNER_ASSERT_MSG_BT(pw != NULL, "getpwuid() failed.");
+ RUNNER_ASSERT_ERRNO_MSG(pw != NULL, "getpwuid() failed");
int groups_cnt = 0;
gid_t *groups_list = NULL;
ret = getgrouplist(pw->pw_name, pw->pw_gid, groups_list, &groups_cnt);
- RUNNER_ASSERT_MSG_BT(ret == -1, "getgrouplist() failed.");
+ RUNNER_ASSERT_MSG(ret == -1, "getgrouplist() failed.");
if (groups_cnt == 0)
return;
groups_list = (gid_t*) calloc(groups_cnt, sizeof(gid_t));
- RUNNER_ASSERT_MSG_BT(groups_list != NULL, "Memory allocation failed.");
+ RUNNER_ASSERT_MSG(groups_list != NULL, "Memory allocation failed.");
ret = getgrouplist(pw->pw_name, pw->pw_gid, groups_list, &groups_cnt);
if (ret == -1) {
free(groups_list);
- RUNNER_ASSERT_MSG_BT(false, "getgrouplist() failed.");
+ RUNNER_FAIL_MSG("getgrouplist() failed.");
}
for (int i = 0; i < groups_cnt; ++i) {
void read_current_gids(std::set<unsigned> &set)
{
int groups_cnt = getgroups(0, NULL);
- RUNNER_ASSERT_MSG_BT(groups_cnt > 0, "Wrong number of supplementary groups.");
+ RUNNER_ASSERT_ERRNO_MSG(groups_cnt > 0, "Wrong number of supplementary groups");
gid_t *groups_list = (gid_t*) calloc(groups_cnt, sizeof(gid_t));
- RUNNER_ASSERT_MSG_BT(groups_list != NULL, "Memory allocation failed.");
+ RUNNER_ASSERT_MSG(groups_list != NULL, "Memory allocation failed.");
if (getgroups(groups_cnt, groups_list) == -1){
free(groups_list);
- RUNNER_ASSERT_MSG_BT(false, "getgroups failed.");
+ RUNNER_FAIL_MSG("getgroups failed.");
}
for (int i = 0; i < groups_cnt; ++i) {
if(groups_current.erase(*it) == 0)
groups_left.append(std::to_string(*it)).append(" ");
}
- RUNNER_ASSERT_MSG_BT(groups_left.empty(),
+ RUNNER_ASSERT_MSG(groups_left.empty(),
"Application lost some groups: " << groups_left);
for (auto it = groups_check.begin(); it != groups_check.end(); ++it)
if(groups_current.erase(*it) == 0)
groups_left.append(std::to_string(*it)).append(" ");
}
- RUNNER_ASSERT_MSG_BT(groups_left.empty(),
+ RUNNER_ASSERT_MSG(groups_left.empty(),
"Application doesn't belong to some required groups: " << groups_left);
for (auto it = groups_current.begin(); it != groups_current.end(); ++it)
{
groups_left.append(std::to_string(*it)).append(" ");
}
- RUNNER_ASSERT_MSG_BT(groups_left.empty(),
+ RUNNER_ASSERT_MSG(groups_left.empty(),
"Application belongs to groups it should't belong to: " << groups_left);
}
void check_app_installed(const char *app_path)
{
- RUNNER_ASSERT_MSG_BT(file_exists(app_path) == 0,
+ RUNNER_ASSERT_MSG(file_exists(app_path) == 0,
" App not installed: " << app_path);
}
bool is_enabled_result;
result = perm_app_has_permission(app_label, APP_TYPE_WGT, permission, &is_enabled_result);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error calling perm_app_has_permission. Result: " << result);
- RUNNER_ASSERT_MSG_BT(is_enabled_result == is_enabled_expected,
+ RUNNER_ASSERT_MSG(is_enabled_result == is_enabled_expected,
" Result of perm_app_has_permission should be: " << is_enabled_expected);
}
/* ACCESS */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path");
+ RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
labelPtr.reset(label);
- RUNNER_ASSERT_MSG_BT(label != NULL, "ACCESS label on " << fpath << " is not set");
+ RUNNER_ASSERT_MSG(label != NULL, "ACCESS label on " << fpath << " is not set");
result = strcmp(correctLabel, label);
- RUNNER_ASSERT_MSG_BT(result == 0, "ACCESS label on " << fpath << " is incorrect");
+ RUNNER_ASSERT_MSG(result == 0, "ACCESS label on " << fpath << " is incorrect");
/* EXEC */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_EXEC);
- RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path");
+ RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
labelPtr.reset(label);
if (S_ISREG(sb->st_mode) && (sb->st_mode & S_IXUSR)) {
- RUNNER_ASSERT_MSG_BT(label != NULL, "EXEC label on " << fpath << " is not set");
+ RUNNER_ASSERT_MSG(label != NULL, "EXEC label on " << fpath << " is not set");
result = strcmp(correctLabel, label);
- RUNNER_ASSERT_MSG_BT(result == 0, "EXEC label on executable file " << fpath << " is incorrect");
+ RUNNER_ASSERT_MSG(result == 0, "EXEC label on executable file " << fpath << " is incorrect");
} else
- RUNNER_ASSERT_MSG_BT(label == NULL, "EXEC label on " << fpath << " is set");
+ RUNNER_ASSERT_MSG(label == NULL, "EXEC label on " << fpath << " is set");
/* TRANSMUTE */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_TRANSMUTE);
- RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path");
+ RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
labelPtr.reset(label);
- RUNNER_ASSERT_MSG_BT(label == NULL, "TRANSMUTE label on " << fpath << " is set");
+ RUNNER_ASSERT_MSG(label == NULL, "TRANSMUTE label on " << fpath << " is set");
return 0;
}
/* ACCESS */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path");
+ RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
labelPtr.reset(label);
- RUNNER_ASSERT_MSG_BT(label != NULL, "ACCESS label on " << fpath << " is not set");
+ RUNNER_ASSERT_MSG(label != NULL, "ACCESS label on " << fpath << " is not set");
result = strcmp(LABEL_FOR_PUBLIC_SHARED_DIRS, label);
- RUNNER_ASSERT_MSG_BT(result == 0, "ACCESS label on " << fpath << " is incorrect");
+ RUNNER_ASSERT_MSG(result == 0, "ACCESS label on " << fpath << " is incorrect");
/* EXEC */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_EXEC);
- RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path");
+ RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
labelPtr.reset(label);
- RUNNER_ASSERT_MSG_BT(label == NULL, "EXEC label on " << fpath << " is set");
+ RUNNER_ASSERT_MSG(label == NULL, "EXEC label on " << fpath << " is set");
/* TRANSMUTE */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_TRANSMUTE);
- RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path");
+ RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
labelPtr.reset(label);
if (S_ISDIR(sb->st_mode)) {
- RUNNER_ASSERT_MSG_BT(label != NULL, "TRANSMUTE label on " << fpath << " is not set");
+ RUNNER_ASSERT_MSG(label != NULL, "TRANSMUTE label on " << fpath << " is not set");
result = strcmp("TRUE", label);
- RUNNER_ASSERT_MSG_BT(result == 0, "TRANSMUTE label on " << fpath << " is not set");
+ RUNNER_ASSERT_MSG(result == 0, "TRANSMUTE label on " << fpath << " is not set");
} else
- RUNNER_ASSERT_MSG_BT(label == NULL, "TRANSMUTE label on " << fpath << " is set");
+ RUNNER_ASSERT_MSG(label == NULL, "TRANSMUTE label on " << fpath << " is set");
return 0;
}
/* ACCESS */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_ACCESS);
labelPtr.reset(label);
- RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path");
+ RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
result = strcmp(CANARY_LABEL, labelPtr.get());
- RUNNER_ASSERT_MSG_BT(result == 0, "ACCESS label on " << fpath << " is overwritten");
+ RUNNER_ASSERT_MSG(result == 0, "ACCESS label on " << fpath << " is overwritten");
/* EXEC */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_EXEC);
labelPtr.reset(label);
- RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path");
+ RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
result = strcmp(CANARY_LABEL, labelPtr.get());
- RUNNER_ASSERT_MSG_BT(result == 0, "EXEC label on " << fpath << " is overwritten");
+ RUNNER_ASSERT_MSG(result == 0, "EXEC label on " << fpath << " is overwritten");
/* TRANSMUTE */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_TRANSMUTE);
labelPtr.reset(label);
- RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path");
- RUNNER_ASSERT_MSG_BT(labelPtr.get() == NULL, "TRANSMUTE label on " << fpath << " is set");
+ RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
+ RUNNER_ASSERT_MSG(labelPtr.get() == NULL, "TRANSMUTE label on " << fpath << " is set");
return 0;
}
int result;
result = nftw(TEST_APP_DIR, &nftw_remove_labels, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to clean Smack labels in " << TEST_APP_DIR);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to clean Smack labels in " << TEST_APP_DIR);
result = nftw(TEST_NON_APP_DIR, &nftw_set_labels_non_app_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to set Smack labels in " << TEST_NON_APP_DIR);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to set Smack labels in " << TEST_NON_APP_DIR);
DB_BEGIN
result = perm_app_setup_path(APP_ID, TEST_APP_DIR, APP_PATH_PUBLIC_RO);
- RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_setup_path() failed");
+ RUNNER_ASSERT_MSG(result == 0, "perm_app_setup_path() failed");
DB_END
result = nftw(TEST_APP_DIR, &nftw_check_labels_app_public_ro_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to check Smack labels for app dir");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to check Smack labels for app dir");
result = nftw(TEST_NON_APP_DIR, &nftw_check_labels_non_app_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to check Smack labels for non-app dir");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to check Smack labels for non-app dir");
- RUNNER_ASSERT_BT(check_all_accesses(smack, {{ USER_APP_ID, LABEL_FOR_PUBLIC_SHARED_DIRS, "r"}}));
+ RUNNER_ASSERT(check_all_accesses(smack, {{ USER_APP_ID, LABEL_FOR_PUBLIC_SHARED_DIRS, "r"}}));
}
void test_revoke_permissions(int line_no, const char* app_id)
DB_BEGIN
result = perm_app_uninstall(app_id);
- RUNNER_ASSERT_MSG_BT(result == 0, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG(result == 0, "Line: " << line_no <<
"perm_app_uninstall returned " << result);
// Close transaction to commit uninstallation before further actions
// Install test apps
result = perm_app_install(app_id);
- RUNNER_ASSERT_MSG_BT(result == 0, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG(result == 0, "Line: " << line_no <<
"perm_app_install returned " << result);
// Close transaction to commit installation before further actions
// TEST:
// Revoke permissions
result = perm_app_revoke_permissions(app_id);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "Line: " << line_no <<
"Error revoking app permissions. Result: " << result);
DB_END
// Cleanup - uninstall test apps
result = perm_app_uninstall(app_id);
- RUNNER_ASSERT_MSG_BT(result == 0, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG(result == 0, "Line: " << line_no <<
"perm_app_uninstall returned " << result);
DB_END
// Prepare
result = perm_app_uninstall(EFL_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"perm_app_uninstall failed: " << result);
result = perm_app_install(EFL_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"perm_app_install failed: " << result);
// Register a permission:
result = perm_app_enable_permissions(EFL_APP_ID, APP_TYPE_EFL, PRIVS_EFL, false);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error registering app permissions. Result: " << result);
DB_END
- RUNNER_ASSERT_MSG_BT(check_all_accesses(smack, {{USER_APP_ID,"test_book_efl", "r"}}),
+ RUNNER_ASSERT_MSG(check_all_accesses(smack, {{USER_APP_ID,"test_book_efl", "r"}}),
"SMACK accesses not granted for EFL_APP");
DB_BEGIN
// Cleanup
result = perm_app_uninstall(EFL_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"perm_app_uninstall failed: " << result);
DB_END
// Prepare
result = perm_app_uninstall(EFL_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"perm_app_uninstall failed: " << result);
result = perm_app_install(EFL_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"perm_app_install failed: " << result);
result = perm_app_disable_permissions(EFL_APP_ID, APP_TYPE_EFL, PRIVS_EFL);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling app permissions. Result: " << result);
DB_END
- RUNNER_ASSERT_MSG_BT(check_no_accesses(smack, {{USER_APP_ID,"test_book_efl", "r"}}),
+ RUNNER_ASSERT_MSG(check_no_accesses(smack, {{USER_APP_ID,"test_book_efl", "r"}}),
"SMACK accesses not disabled for EFL_APP");
DB_BEGIN
// Register a permission
result = perm_app_enable_permissions(EFL_APP_ID, APP_TYPE_EFL, PRIVS_EFL, false);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error registering app permissions. Result: " << result);
DB_END
- RUNNER_ASSERT_MSG_BT(check_all_accesses(smack, {{USER_APP_ID,"test_book_efl", "r"}}),
+ RUNNER_ASSERT_MSG(check_all_accesses(smack, {{USER_APP_ID,"test_book_efl", "r"}}),
"SMACK accesses not granted for EFL_APP");
DB_BEGIN
// Disable a permission
result = perm_app_disable_permissions(EFL_APP_ID, APP_TYPE_EFL, PRIVS_EFL);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling app permissions. Result: " << result);
DB_END
- RUNNER_ASSERT_MSG_BT(check_no_accesses(smack, {{USER_APP_ID,"test_book_efl", "r"}}),
+ RUNNER_ASSERT_MSG(check_no_accesses(smack, {{USER_APP_ID,"test_book_efl", "r"}}),
"SMACK accesses not disabled for EFL_APP");
DB_BEGIN
// Cleanup
result = perm_app_uninstall(EFL_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"perm_app_uninstall failed: " << result);
DB_END
// Prepare
result = perm_app_uninstall(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"perm_app_uninstall failed: " << result);
result = perm_app_install(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"perm_app_install failed: " << result);
result = perm_app_disable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS1);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling app first permissions. Result: " << result);
result = perm_app_disable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling app permissions. Result: " << result);
result = perm_app_disable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_NO_R);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling app no r permissions. Result: " << result);
result = perm_app_disable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_R);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling app r permissions. Result: " << result);
DB_END
- RUNNER_ASSERT_MSG_BT(check_no_accesses(smack, rules2),
+ RUNNER_ASSERT_MSG(check_no_accesses(smack, rules2),
"SMACK accesses not disabled.");
- RUNNER_ASSERT_MSG_BT(check_no_accesses(smack, rules1),
+ RUNNER_ASSERT_MSG(check_no_accesses(smack, rules1),
"SMACK accesses not disabled.");
DB_BEGIN
// Prepare permissions that we want to disable
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2, false);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error registering app permissions. Result: " << result);
DB_END
// Are all the permissions enabled?
- RUNNER_ASSERT_MSG_BT(check_all_accesses(smack, rules2), "Not all permisions enabled.");
+ RUNNER_ASSERT_MSG(check_all_accesses(smack, rules2), "Not all permisions enabled.");
DB_BEGIN
// Disable permissions
result = perm_app_disable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling app permissions. Result: " << result);
DB_END
// Are all the permissions disabled?
- RUNNER_ASSERT_MSG_BT(check_no_accesses(smack, rules2), "Not all permisions disabled.");
+ RUNNER_ASSERT_MSG(check_no_accesses(smack, rules2), "Not all permisions disabled.");
/**
* Test - disable some granted permissions leaving non complementary and then disabling those too.
// Prepare permissions that will not be disabled
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS1, false);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error adding app first permissions. Result: " << result);
// Prepare permissions that we want to disable
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2, false);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error adding app second permissions. Result: " << result);
// Disable second permissions
result = perm_app_disable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling app second permissions. Result: " << result);
DB_END
// Are all second permissions disabled?
- RUNNER_ASSERT_MSG_BT(check_no_accesses(smack, rules2), "Not all first permisions disabled.");
+ RUNNER_ASSERT_MSG(check_no_accesses(smack, rules2), "Not all first permisions disabled.");
// Are all first permissions not disabled?
- RUNNER_ASSERT_MSG_BT(check_all_accesses(smack, rules1), "Some of second permissions disabled.");
+ RUNNER_ASSERT_MSG(check_all_accesses(smack, rules1), "Some of second permissions disabled.");
DB_BEGIN
// Disable first permissions
result = perm_app_disable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS1);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling app first permissions. Result: " << result);
DB_END
// Are all second permissions disabled?
- RUNNER_ASSERT_MSG_BT(check_no_accesses(smack, rules1), "Not all second permisions disabled.");
+ RUNNER_ASSERT_MSG(check_no_accesses(smack, rules1), "Not all second permisions disabled.");
/**
* Test - disable only no r granted permissions.
// Prepare permissions
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_R, false);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error registering app r permissions. Result: " << result);
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_NO_R, false);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error registering app no r permissions. Result: " << result);
// Disable same permissions without r
result = perm_app_disable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_NO_R);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling app no r permissions. Result: " << result);
DB_END
// Is any r permissions disabled?
- RUNNER_ASSERT_MSG_BT(check_all_accesses(smack, rules2_r), "Some of r permissions disabled.");
+ RUNNER_ASSERT_MSG(check_all_accesses(smack, rules2_r), "Some of r permissions disabled.");
// Are all no r permissions disabled?
- RUNNER_ASSERT_MSG_BT(check_no_accesses(smack, rules2_no_r), "Not all no r permissions disabled.");
+ RUNNER_ASSERT_MSG(check_no_accesses(smack, rules2_no_r), "Not all no r permissions disabled.");
DB_BEGIN
// Prepare permissions
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_NO_R, false);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error adding app no r permissions. Result: " << result);
DB_END
- RUNNER_ASSERT_MSG_BT(check_all_accesses(smack, rules2_no_r), "Not all no r permissions enabled.");
+ RUNNER_ASSERT_MSG(check_all_accesses(smack, rules2_no_r), "Not all no r permissions enabled.");
DB_BEGIN
// Disable all permissions
result = perm_app_disable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_R);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling app permissions. Result: " << result);
DB_END
- RUNNER_ASSERT_MSG_BT(check_no_accesses(smack, rules2_r), "Not all r permissions disabled.");
+ RUNNER_ASSERT_MSG(check_no_accesses(smack, rules2_r), "Not all r permissions disabled.");
DB_BEGIN
// Clean up after test:
result = perm_app_uninstall(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
DB_END
}
void osp_blahblah_dac_check(int line_no, const std::vector<unsigned> &gids, std::string dac_file_path)
{
std::ifstream dac_file(dac_file_path);
- RUNNER_ASSERT_MSG_BT(dac_file, "Line: " << line_no << " Failed to create " << dac_file_path);
+ RUNNER_ASSERT_MSG(dac_file, "Line: " << line_no << " Failed to create " << dac_file_path);
auto it = gids.begin();
std::string line;
std::istringstream is(line);
unsigned gid;
is >> gid;
- RUNNER_ASSERT_MSG_BT(it != gids.end(), "Line: " << line_no << "Additional line in file: " << gid);
- RUNNER_ASSERT_MSG_BT(*it == gid, "Line: " << line_no << " " << *it << "!=" << gid);
+ RUNNER_ASSERT_MSG(it != gids.end(), "Line: " << line_no << "Additional line in file: " << gid);
+ RUNNER_ASSERT_MSG(*it == gid, "Line: " << line_no << " " << *it << "!=" << gid);
it++;
}
- RUNNER_ASSERT_MSG_BT(it == gids.end(), "Line: " << line_no << " Missing line in file: " << *it);
+ RUNNER_ASSERT_MSG(it == gids.end(), "Line: " << line_no << " Missing line in file: " << *it);
dac_file.close();
}
int result;
result = nftw(TEST_APP_DIR, &nftw_remove_labels, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to clean Smack labels in " << TEST_APP_DIR);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to clean Smack labels in " << TEST_APP_DIR);
result = nftw(TEST_NON_APP_DIR, &nftw_set_labels_non_app_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to set Smack labels in " << TEST_NON_APP_DIR);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to set Smack labels in " << TEST_NON_APP_DIR);
DB_BEGIN
result = perm_app_setup_path(APPID_DIR, TEST_APP_DIR, APP_PATH_PRIVATE);
- RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_setup_path() for APP_PATH_PRIVATE failed");
+ RUNNER_ASSERT_MSG(result == 0, "perm_app_setup_path() for APP_PATH_PRIVATE failed");
DB_END
result = nftw(TEST_APP_DIR, &nftw_check_labels_app_private_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to check Smack labels for app dir");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to check Smack labels for app dir");
result = nftw(TEST_NON_APP_DIR, &nftw_check_labels_non_app_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to check Smack labels for non-app dir");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to check Smack labels for non-app dir");
}
RUNNER_TEST(privilege_control02_perm_app_setup_path_02_FLOOR)
int result;
result = nftw(TEST_APP_DIR, &nftw_remove_labels, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to clean Smack labels in " << TEST_APP_DIR);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to clean Smack labels in " << TEST_APP_DIR);
result = nftw(TEST_NON_APP_DIR, &nftw_set_labels_non_app_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to set Smack labels in " << TEST_NON_APP_DIR);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to set Smack labels in " << TEST_NON_APP_DIR);
DB_BEGIN
result = perm_app_setup_path(APPID_DIR, TEST_APP_DIR, APP_PATH_FLOOR);
- RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_setup_path() for APP_PATH_FLOOR type failed");
+ RUNNER_ASSERT_MSG(result == 0, "perm_app_setup_path() for APP_PATH_FLOOR type failed");
DB_END
result = nftw(TEST_APP_DIR, &nftw_check_labels_app_floor_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to check Smack labels for app dir");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to check Smack labels for app dir");
result = nftw(TEST_NON_APP_DIR, &nftw_check_labels_non_app_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to check Smack labels for non-app dir");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to check Smack labels for non-app dir");
}
DB_BEGIN
result = perm_app_uninstall(app_id);
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
" perm_app_uninstall returned " << result << ". "
"Errno: " << strerror(errno));
result = perm_app_install(app_id);
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
" perm_app_install returned " << result << ". "
"Errno: " << strerror(errno));
// TEST:
result = perm_app_enable_permissions(app_id, APP_TYPE, privileges, false);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error registering app permissions. Result: " << result);
DB_END
result = test_have_all_accesses(rules);
- RUNNER_ASSERT_MSG_BT(result == 1, "Permissions not added.");
+ RUNNER_ASSERT_MSG(result == 1, "Permissions not added.");
std::set<unsigned> groups_before;
read_user_gids(groups_before, APP_UID);
result = perm_app_set_privilege(app_id, type, app_path);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error in perm_app_set_privilege. Error: " << result);
// Check if SMACK label really set
char *label;
result = smack_new_label_from_self(&label);
- RUNNER_ASSERT_MSG_BT(result >= 0,
+ RUNNER_ASSERT_MSG(result >= 0,
" Error getting current process label");
- RUNNER_ASSERT_MSG_BT(label != NULL,
+ RUNNER_ASSERT_MSG(label != NULL,
" Process label is not set");
result = strcmp(USER_APP_ID, label);
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
" Process label " << label << " is incorrect");
check_groups(groups_before, dac_file);
// argument validation
result = perm_add_api_feature(APP_TYPE_OSP, NULL, NULL, NULL, 0);
- RUNNER_ASSERT_BT(result == PC_ERR_INVALID_PARAM);
+ RUNNER_ASSERT(result == PC_ERR_INVALID_PARAM);
result = perm_add_api_feature(APP_TYPE_OSP,"", NULL, NULL, 0);
- RUNNER_ASSERT_BT(result == PC_ERR_INVALID_PARAM);
+ RUNNER_ASSERT(result == PC_ERR_INVALID_PARAM);
// Already existing feature:
// TODO: Database will be malformed. (Rules for these features will be removed.)
result = perm_add_api_feature(APP_TYPE_OSP,"http://tizen.org/privilege/messaging.read", NULL, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
result = perm_add_api_feature(APP_TYPE_WGT,"http://tizen.org/privilege/messaging.sms", NULL, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
// empty features
result = perm_add_api_feature(APP_TYPE_OSP,"blahblah", NULL, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
result = perm_add_api_feature(APP_TYPE_WGT,"blahblah", NULL, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
// empty rules
const char *test1[] = { NULL };
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[0].c_str(), test1, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
const char *test2[] = { "", NULL };
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[1].c_str(), test2, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
const char *test3[] = { " \t\n", "\t \n", "\n\t ", NULL };
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[2].c_str(), test3, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
// malformed rules
const char *test4[] = { "malformed", NULL };
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[3].c_str(), test4, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_ERR_INVALID_PARAM, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG(result == PC_ERR_INVALID_PARAM, "perm_add_api_feature returned: " << result);
const char *test5[] = { "malformed malformed", NULL };
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[4].c_str(), test5, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_ERR_INVALID_PARAM, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG(result == PC_ERR_INVALID_PARAM, "perm_add_api_feature returned: " << result);
const char *test6[] = { "-malformed malformed rwxat", NULL };
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[5].c_str(), test6, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_ERR_INVALID_PARAM, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG(result == PC_ERR_INVALID_PARAM, "perm_add_api_feature returned: " << result);
const char *test7[] = { "~/\"\\ malformed rwxat", NULL };
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[6].c_str(), test7, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_ERR_INVALID_PARAM, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG(result == PC_ERR_INVALID_PARAM, "perm_add_api_feature returned: " << result);
const char *test8[] = { "subject object rwxat something else", NULL };
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[7].c_str(), test8, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_ERR_INVALID_PARAM, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG(result == PC_ERR_INVALID_PARAM, "perm_add_api_feature returned: " << result);
// correct rules
NULL};
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[8].c_str(), test9, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
const char *test10[] = { "Sub::jE,ct ~APP~ a-rwxl", NULL };
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[9].c_str(), test10, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
const char *test11[] = { "Sub::sjE,ct ~APP~ a-RwXL", NULL }; // TODO This fails.
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[10].c_str(), test11, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
// TODO For now identical/complementary rules are not merged.
"",
NULL};
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[11].c_str(), test12, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
// empty group ids
const char *test13[] = { "~APP~ b a", NULL};
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[12].c_str(), test13,(const gid_t[]) {0,1,2},0);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
result = file_exists(OSP_BLAHBLAH_DAC[12].c_str());
- RUNNER_ASSERT_BT(result == -1);
+ RUNNER_ASSERT(result == -1);
remove_smack_files();
// valid group ids
result = perm_add_api_feature(APP_TYPE_OSP,BLAHBLAH_FEATURE[13].c_str(), test13,(const gid_t[]) {0,1,2},3);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
osp_blahblah_dac_check(__LINE__, {0,1,2}, OSP_BLAHBLAH_DAC[13]);
remove_smack_files();
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[14].c_str(), test13,(const gid_t[]) {0,1,2},1);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
osp_blahblah_dac_check(__LINE__, {0}, OSP_BLAHBLAH_DAC[14]);
remove_smack_files();
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[15].c_str(), test13,(const gid_t[]) {1,1,1},3);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
osp_blahblah_dac_check(__LINE__, {1,1,1},OSP_BLAHBLAH_DAC[15]);
remove_smack_files();
// uninstall app to make sure that all rules and permissions are revoked
result = perm_app_uninstall(APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"perm_app_uninstall failed: " << perm_strerror(result));
result = perm_app_install(APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"perm_app_install failed: " << perm_strerror(result));
result = perm_add_api_feature(APP_TYPE_OSP, permissionName[0], perm_rules1, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"perm_add_api_feature failed: " << result);
result = perm_app_enable_permissions(APP_ID, APP_TYPE_OSP, permissionName, true);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"perm_app_enable_permissions failed: " << perm_strerror(result));
DB_END
// Check if rules are applied
result = test_have_all_accesses(test_rules1);
- RUNNER_ASSERT_MSG_BT(result == 1, "Not all permissions added.");
+ RUNNER_ASSERT_MSG(result == 1, "Not all permissions added.");
DB_BEGIN
// Redefine the permission
result = perm_add_api_feature(APP_TYPE_OSP, permissionName[0], perm_rules2, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"perm_add_api_feature failed: " << result);
DB_END
// Check if rules are updated
result = test_have_all_accesses(test_rules2);
- RUNNER_ASSERT_MSG_BT(result == 1, "Not all permissions added after update.");
+ RUNNER_ASSERT_MSG(result == 1, "Not all permissions added after update.");
// The difference between rules1 and rules2 should be revoked!
result = test_have_any_accesses(diff_rules);
- RUNNER_ASSERT_MSG_BT(result == 0, "Permissions are not fully updated.");
+ RUNNER_ASSERT_MSG(result == 0, "Permissions are not fully updated.");
}
/*
DB_BEGIN
result = perm_app_uninstall(pkg_id);
- RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_uninstall returned: " << perm_strerror(result));
+ RUNNER_ASSERT_MSG(result == 0, "perm_app_uninstall returned: " << perm_strerror(result));
DB_END
}
DB_BEGIN
result = perm_app_install(pkg_id);
- RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_install returned: " << perm_strerror(result));
+ RUNNER_ASSERT_MSG(result == 0, "perm_app_install returned: " << perm_strerror(result));
DB_END
DB_BEGIN
result = perm_app_install(APP_ID);
- RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_install returned: " << perm_strerror(result));
+ RUNNER_ASSERT_MSG(result == 0, "perm_app_install returned: " << perm_strerror(result));
// transaction rollback
result = perm_rollback();
- RUNNER_ASSERT_MSG_BT(result == 0, "perm_rollback returned: " << perm_strerror(result));
+ RUNNER_ASSERT_MSG(result == 0, "perm_rollback returned: " << perm_strerror(result));
DB_END
}
DB_BEGIN
result = perm_app_install(APP_ID);
- RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_install returned: " << perm_strerror(result));
+ RUNNER_ASSERT_MSG(result == 0, "perm_app_install returned: " << perm_strerror(result));
// transaction rollback
result = perm_rollback();
- RUNNER_ASSERT_MSG_BT(result == 0, "perm_rollback returned: " << perm_strerror(result));
+ RUNNER_ASSERT_MSG(result == 0, "perm_rollback returned: " << perm_strerror(result));
// install once again after the rollback
result = perm_app_install(APP_ID);
- RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_install returned: " << perm_strerror(result));
+ RUNNER_ASSERT_MSG(result == 0, "perm_app_install returned: " << perm_strerror(result));
DB_END
DB_BEGIN
result = perm_app_uninstall(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
result = perm_app_install(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
/**
* Test - Enabling all permissions with persistant mode enabled
*/
result = perm_app_revoke_permissions(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2, false);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error registering app permissions. Result: " << result);
DB_END
// Check if the accesses are realy applied..
result = test_have_all_accesses(rules2);
- RUNNER_ASSERT_MSG_BT(result == 1, "Permissions not added.");
+ RUNNER_ASSERT_MSG(result == 1, "Permissions not added.");
DB_BEGIN
// Clean up
result = perm_app_revoke_permissions(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
DB_END
DB_BEGIN
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2, false);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error registering app permissions. Result: " << result);
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2, false);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error enabling app permissions. Result: " << result);
DB_END
// Check if the accesses are realy applied..
result = test_have_all_accesses(rules2);
- RUNNER_ASSERT_MSG_BT(result == 1, "Permissions not added.");
+ RUNNER_ASSERT_MSG(result == 1, "Permissions not added.");
DB_BEGIN
// Clean up
result = perm_app_revoke_permissions(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
DB_END
DB_BEGIN
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_R_AND_NO_R, false);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error registering app permissions. Result: " << result);
DB_END
// Check if the accesses are realy applied..
result = test_have_all_accesses(rules2_no_r);
- RUNNER_ASSERT_MSG_BT(result == 1, "Permissions not added.");
+ RUNNER_ASSERT_MSG(result == 1, "Permissions not added.");
DB_BEGIN
// Clean up
result = perm_app_revoke_permissions(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
DB_END
// Register permission for rules 2 no r
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_NO_R, false);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error registering app permissions without r. Result: " << result);
DB_END
// Check if the accesses are realy applied..
result = test_have_all_accesses(rules2_no_r);
- RUNNER_ASSERT_MSG_BT(result == 1, "Permissions without r not added.");
+ RUNNER_ASSERT_MSG(result == 1, "Permissions without r not added.");
DB_BEGIN
// Register permission for rules 2
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2, false);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error registering app all permissions. Result: " << result);
DB_END
// Check if the accesses are realy applied..
result = test_have_all_accesses(rules2);
- RUNNER_ASSERT_MSG_BT(result == 1, "Permissions all not added.");
+ RUNNER_ASSERT_MSG(result == 1, "Permissions all not added.");
DB_BEGIN
// Clean up
result = perm_app_revoke_permissions(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
/**
// Enable permission for rules 2 no r
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_NO_R, false);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error registering app permissions without r. Result: " << result);
DB_END
// Check if the accesses are realy applied..
result = test_have_all_accesses(rules2_no_r);
- RUNNER_ASSERT_MSG_BT(result == 1, "Permissions without r not added.");
+ RUNNER_ASSERT_MSG(result == 1, "Permissions without r not added.");
DB_BEGIN
// Enable permission for rules 2
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_R, false);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error registering app permissions with only r. Result: " << result);
DB_END
// Check if the accesses are realy applied..
result = test_have_all_accesses(rules2_r);
- RUNNER_ASSERT_MSG_BT(result == 1, "Permissions with only r not added.");
+ RUNNER_ASSERT_MSG(result == 1, "Permissions with only r not added.");
DB_BEGIN
// Clean up
result = perm_app_revoke_permissions(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
// Clean up after test:
result = perm_app_uninstall(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
DB_END
}
DB_BEGIN
result = perm_app_install(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
// Disable permissions
result = perm_app_disable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling app permissions. Result: " << result);
// Prepare permissions to reset
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2, true);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error registering app permissions. Result: " << result);
// Reset permissions
result = perm_app_reset_permissions(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error reseting app permissions. Result: " << result);
DB_END
// Are all second permissions not disabled?
result = test_have_all_accesses(rules2);
- RUNNER_ASSERT_MSG_BT(result == 1, "Not all permissions added.");
+ RUNNER_ASSERT_MSG(result == 1, "Not all permissions added.");
DB_BEGIN
// Disable permissions
result = perm_app_disable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling app permissions. Result: " << result);
result = perm_app_uninstall(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG(result == 0, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
DB_END
}
ss << "s-" << getpid() << "-" << getppid();
result = smack_set_label_for_self(ss.str().c_str());
- RUNNER_ASSERT_MSG_BT(result == 0, "smack_set_label_for_self("
+ RUNNER_ASSERT_MSG(result == 0, "smack_set_label_for_self("
<< ss.str().c_str() << ") failed");
}
alarm(0);
if (fd < 0)
return;
+
+ FdUniquePtr fdPtr(&fd);
+
result = smack_new_label_from_self(&smack_label);
- if (result < 0) {
- close(fd);
- close(sock);
- free(smack_label);
- RUNNER_ASSERT_MSG_BT(0, "smack_new_label_from_self() failed");
- }
- result = write(fd, smack_label, strlen(smack_label));
- if (result != (int)strlen(smack_label)) {
- close(fd);
- close(sock);
- free(smack_label);
- RUNNER_ASSERT_MSG_BT(0, "write() failed: " << strerror(errno));
- }
- close(fd);
- free(smack_label);
+ RUNNER_ASSERT_MSG(result >= 0, "smack_new_label_from_self() failed");
+ SmackLabelPtr smackLabelPtr(smack_label);
+
+ ssize_t bitsNum = write(fd, smack_label, strlen(smack_label));
+ RUNNER_ASSERT_ERRNO_MSG(bitsNum >= 0 && static_cast<size_t>(bitsNum) == strlen(smack_label),
+ "write() failed");
}
RUNNER_MULTIPROCESS_TEST_SMACK(privilege_control15_app_id_from_socket)
unlink(SOCK_PATH);
pid = fork();
- RUNNER_ASSERT_MSG_BT(pid >= 0, "Fork failed");
+ RUNNER_ASSERT_ERRNO_MSG(pid >= 0, "Fork failed");
smack_set_random_label_based_on_pid_on_self();
/* Set the process label before creating a socket */
sock = socket(AF_UNIX, SOCK_STREAM, 0);
- RUNNER_ASSERT_MSG_BT(sock >= 0, "socket failed: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(sock >= 0, "socket failed");
+
result = bind(sock,
(struct sockaddr*) &sockaddr, sizeof(struct sockaddr_un));
- if (result != 0) {
- close(sock);
- RUNNER_ASSERT_MSG_BT(0, "bind failed: " << strerror(errno));
- }
+ RUNNER_ASSERT_ERRNO_MSG(result == 0, "bind failed");
+
result = listen(sock, 1);
- if (result != 0) {
- close(sock);
- RUNNER_ASSERT_MSG_BT(0, "listen failed: " << strerror(errno));
- }
+ RUNNER_ASSERT_ERRNO_MSG(result == 0, "listen failed");
smack_unix_sock_server(sock);
/* Change the process label with listening socket */
smack_unix_sock_server(sock);
pid = fork();
- RUNNER_ASSERT_MSG_BT(pid >= 0, "Fork failed");
+ RUNNER_ASSERT_ERRNO_MSG(pid >= 0, "Fork failed");
/* Now running two concurrent servers.
Test if socket label was unaffected by fork() */
smack_unix_sock_server(sock);
/* Let's give the two servers different labels */
smack_unix_sock_server(sock);
- close(sock);
exit(0);
} else { /* parent process, client */
char *smack_label2;
sock = socket(AF_UNIX, SOCK_STREAM, 0);
- RUNNER_ASSERT_MSG_BT(sock >= 0,
- "socket failed: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(sock >= 0, "socket failed");
+
result = connect(sock,
(struct sockaddr*) &sockaddr, sizeof(struct sockaddr_un));
- if (result != 0) {
- close(sock);
- RUNNER_ASSERT_MSG_BT(0, "connect failed: " << strerror(errno));
- }
+ RUNNER_ASSERT_ERRNO_MSG(result == 0, "connect failed");
alarm(2);
result = read(sock, smack_label1, SMACK_LABEL_LEN);
alarm(0);
- if (result < 0) {
- close(sock);
- RUNNER_ASSERT_MSG_BT(0, "read failed: " << strerror(errno));
- }
+ RUNNER_ASSERT_ERRNO_MSG(result >= 0, "read failed");
+
smack_label1[result] = '\0';
smack_label2 = perm_app_id_from_socket(sock);
- if (smack_label2 == NULL) {
- close(sock);
- RUNNER_ASSERT_MSG_BT(0, "perm_app_id_from_socket failed");
- }
+ RUNNER_ASSERT_MSG(smack_label2 != NULL, "perm_app_id_from_socket failed");
result = strcmp(smack_label1, smack_label2);
- if (result != 0) {
- close(sock);
- RUNNER_ASSERT_MSG_BT(0, "smack labels differ: '" << smack_label1
- << "' != '" << smack_label2 << "-" << random() << "'");
- }
- close(sock);
+ RUNNER_ASSERT_MSG(result == 0, "smack labels differ: '" << smack_label1
+ << "' != '" << smack_label2 << "-" << random() << "'");
}
}
}
DB_BEGIN
result = perm_app_uninstall(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error uninstalling app. Result" << result);
result = perm_app_install(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error installing app. Result" << result);
result = perm_app_disable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_R_AND_NO_R);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling app r and no r permissions. Result: " << result);
DB_END
DB_BEGIN
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_R, false);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error registering app r permissions. Result: " << result);
DB_END
DB_BEGIN
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_NO_R, false);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error registering app r permissions. Result: " << result);
DB_END
DB_BEGIN
result = perm_app_disable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_R);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling app r and no r permissions. Result: " << result);
DB_END
DB_BEGIN
result = perm_app_disable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_NO_R);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling app r and no r permissions. Result: " << result);
DB_END
const char *result;
for (auto itr = error_codes.begin(); itr != error_codes.end(); ++itr) {
- RUNNER_ASSERT_MSG_BT(strcmp(perm_strerror(*itr), "Unknown error") != 0,
+ RUNNER_ASSERT_MSG(strcmp(perm_strerror(*itr), "Unknown error") != 0,
"Returned invalid error code description.");
}
result = perm_strerror(POSITIVE_ERROR_CODE);
- RUNNER_ASSERT_MSG_BT(strcmp(result, "Unknown error") == 0,
+ RUNNER_ASSERT_MSG(strcmp(result, "Unknown error") == 0,
"Bad message returned for invalid error code: \"" << result << "\"");
result = perm_strerror(NONEXISTING_ERROR_CODE);
- RUNNER_ASSERT_MSG_BT(strcmp(result, "Unknown error") == 0,
+ RUNNER_ASSERT_MSG(strcmp(result, "Unknown error") == 0,
"Bad message returned for invalid error code: \"" << result << "\"");
}
RUNNER_TEST(privilege_control21c_incorrect_params_perm_app_set_privilege)
{
- RUNNER_ASSERT_MSG_BT(perm_app_set_privilege(NULL, NULL, APP_SET_PRIV_PATH) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_set_privilege(NULL, NULL, APP_SET_PRIV_PATH) == PC_ERR_INVALID_PARAM,
"perm_app_set_privilege didn't check if package name isn't NULL.");
}
RUNNER_TEST(privilege_control21d_incorrect_params_perm_app_install)
{
- RUNNER_ASSERT_MSG_BT(perm_app_install(NULL) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_install(NULL) == PC_ERR_INVALID_PARAM,
"perm_app_install didn't check if pkg_id isn't NULL.");
- RUNNER_ASSERT_MSG_BT(perm_app_install("") == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_install("") == PC_ERR_INVALID_PARAM,
"perm_app_install didn't check if pkg_id isn't empty.");
}
RUNNER_TEST(privilege_control21e_incorrect_params_perm_app_uninstall)
{
- RUNNER_ASSERT_MSG_BT(perm_app_uninstall(NULL) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_uninstall(NULL) == PC_ERR_INVALID_PARAM,
"perm_app_uninstall didn't check if pkg_id isn't NULL.");
- RUNNER_ASSERT_MSG_BT(perm_app_uninstall("") == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_uninstall("") == PC_ERR_INVALID_PARAM,
"perm_app_uninstall didn't check if pkg_id isn't empty.");
}
RUNNER_TEST(privilege_control21f_incorrect_params_perm_app_enable_permissions)
{
- RUNNER_ASSERT_MSG_BT(perm_app_enable_permissions(APP_ID, APP_TYPE_OTHER, NULL, 1) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_enable_permissions(APP_ID, APP_TYPE_OTHER, NULL, 1) == PC_ERR_INVALID_PARAM,
"perm_app_enable_permissions didn't check if perm_list isn't NULL.");
- RUNNER_ASSERT_MSG_BT(perm_app_enable_permissions(NULL, APP_TYPE_OTHER, PRIVS2, 1) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_enable_permissions(NULL, APP_TYPE_OTHER, PRIVS2, 1) == PC_ERR_INVALID_PARAM,
"perm_app_enable_permissions didn't check if pkg_id isn't NULL.");
- RUNNER_ASSERT_MSG_BT(perm_app_enable_permissions("", APP_TYPE_OTHER, PRIVS2, 1) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_enable_permissions("", APP_TYPE_OTHER, PRIVS2, 1) == PC_ERR_INVALID_PARAM,
"perm_app_enable_permissions didn't check if pkg_id isn't empty.");
- RUNNER_ASSERT_MSG_BT(perm_app_enable_permissions("~APP~", APP_TYPE_OTHER, PRIVS2, 1) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_enable_permissions("~APP~", APP_TYPE_OTHER, PRIVS2, 1) == PC_ERR_INVALID_PARAM,
"perm_app_enable_permissions didn't check if pkg_id is valid");
}
RUNNER_TEST(privilege_control21g_incorrect_params_app_revoke_permissions)
{
- RUNNER_ASSERT_MSG_BT(perm_app_revoke_permissions(NULL) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_revoke_permissions(NULL) == PC_ERR_INVALID_PARAM,
"perm_app_revoke_permissions didn't check if pkg_id isn't NULL.");
- RUNNER_ASSERT_MSG_BT(perm_app_revoke_permissions("") == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_revoke_permissions("") == PC_ERR_INVALID_PARAM,
"perm_app_revoke_permissions didn't check if pkg_id isn't empty.");
- RUNNER_ASSERT_MSG_BT(perm_app_revoke_permissions("~APP~") == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_revoke_permissions("~APP~") == PC_ERR_INVALID_PARAM,
"perm_app_revoke_permissions didn't check if pkg_id is valid.");
}
RUNNER_TEST(privilege_control21h_incorrect_params_app_reset_permissions)
{
- RUNNER_ASSERT_MSG_BT(perm_app_reset_permissions(NULL) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_reset_permissions(NULL) == PC_ERR_INVALID_PARAM,
"perm_app_reset_permissions didn't check if pkg_id isn't NULL.");
- RUNNER_ASSERT_MSG_BT(perm_app_reset_permissions("") == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_reset_permissions("") == PC_ERR_INVALID_PARAM,
"perm_app_reset_permissions didn't check if pkg_id isn't empty.");
- RUNNER_ASSERT_MSG_BT(perm_app_reset_permissions("~APP~") == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_reset_permissions("~APP~") == PC_ERR_INVALID_PARAM,
"perm_app_reset_permissions didn't check if pkg_id is valid.");
}
RUNNER_TEST(privilege_control21i_incorrect_params_app_setup_path)
{
- RUNNER_ASSERT_MSG_BT(perm_app_setup_path(APPID_DIR, NULL, APP_PATH_PRIVATE) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_setup_path(APPID_DIR, NULL, APP_PATH_PRIVATE) == PC_ERR_INVALID_PARAM,
"perm_app_setup_path didn't check if path isn't NULL.");
- RUNNER_ASSERT_MSG_BT(perm_app_setup_path(NULL, TEST_APP_DIR, APP_PATH_PRIVATE) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_setup_path(NULL, TEST_APP_DIR, APP_PATH_PRIVATE) == PC_ERR_INVALID_PARAM,
"perm_app_setup_path didn't check if pkg_id isn't NULL.");
- RUNNER_ASSERT_MSG_BT(perm_app_setup_path("", TEST_APP_DIR, APP_PATH_PRIVATE) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_setup_path("", TEST_APP_DIR, APP_PATH_PRIVATE) == PC_ERR_INVALID_PARAM,
"perm_app_setup_path didn't check if pkg_id isn't empty.");
- RUNNER_ASSERT_MSG_BT(perm_app_setup_path("~APP~", TEST_APP_DIR, APP_PATH_PRIVATE) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_setup_path("~APP~", TEST_APP_DIR, APP_PATH_PRIVATE) == PC_ERR_INVALID_PARAM,
"perm_app_setup_path didn't check if pkg_id is valid.");
}
RUNNER_TEST(privilege_control21k_incorrect_params_add_api_feature)
{
- RUNNER_ASSERT_MSG_BT(perm_add_api_feature(APP_TYPE_OSP, NULL, NULL, NULL, 0) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_add_api_feature(APP_TYPE_OSP, NULL, NULL, NULL, 0) == PC_ERR_INVALID_PARAM,
"perm_add_api_feature didn't check if api_feature_name isn't NULL.");
- RUNNER_ASSERT_MSG_BT(perm_add_api_feature(APP_TYPE_OSP, "", NULL, NULL, 0) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_add_api_feature(APP_TYPE_OSP, "", NULL, NULL, 0) == PC_ERR_INVALID_PARAM,
"perm_add_api_feature didn't check if api_feature_name isn't empty.");
}
RUNNER_TEST(privilege_control21l_incorrect_params_ignored_disable_permissions)
{
- RUNNER_ASSERT_MSG_BT(perm_app_disable_permissions(APP_ID, APP_TYPE_OTHER, NULL) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_disable_permissions(APP_ID, APP_TYPE_OTHER, NULL) == PC_ERR_INVALID_PARAM,
"perm_app_disable_permissions didn't check if perm_list isn't NULL.");
- RUNNER_ASSERT_MSG_BT(perm_app_disable_permissions(NULL, APP_TYPE_OTHER, PRIVS2) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_disable_permissions(NULL, APP_TYPE_OTHER, PRIVS2) == PC_ERR_INVALID_PARAM,
"perm_app_disable_permissions didn't check if pkg_id isn't NULL.");
- RUNNER_ASSERT_MSG_BT(perm_app_disable_permissions("", APP_TYPE_OTHER, PRIVS2) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_disable_permissions("", APP_TYPE_OTHER, PRIVS2) == PC_ERR_INVALID_PARAM,
"perm_app_disable_permissions didn't check if pkg_id isn't empty.");
- RUNNER_ASSERT_MSG_BT(perm_app_disable_permissions("~APP~", APP_TYPE_OTHER, PRIVS2) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG(perm_app_disable_permissions("~APP~", APP_TYPE_OTHER, PRIVS2) == PC_ERR_INVALID_PARAM,
"perm_app_disable_permissions didn't check if pkg_id is valid.");
}
bool has_permission;
const char *app_label = "test_app_label";
- RUNNER_ASSERT_MSG_BT(perm_app_has_permission(NULL, APP_TYPE_WGT,
+ RUNNER_ASSERT_MSG(perm_app_has_permission(NULL, APP_TYPE_WGT,
PRIVS2[0], &has_permission) == PC_ERR_INVALID_PARAM,
"perm_app_has_permission didn't check if pkg_id isn't NULL.");
- RUNNER_ASSERT_MSG_BT(perm_app_has_permission(app_label, APP_TYPE_OTHER,
+ RUNNER_ASSERT_MSG(perm_app_has_permission(app_label, APP_TYPE_OTHER,
PRIVS2[0], &has_permission) == PC_ERR_INVALID_PARAM,
"perm_app_has_permission should not accept app_type = OTHER.");
- RUNNER_ASSERT_MSG_BT(perm_app_has_permission(app_label, APP_TYPE_WGT,
+ RUNNER_ASSERT_MSG(perm_app_has_permission(app_label, APP_TYPE_WGT,
NULL, &has_permission) == PC_ERR_INVALID_PARAM,
"perm_app_has_permission didn't check if permission_name isn't NULL.");
- RUNNER_ASSERT_MSG_BT(perm_app_has_permission(app_label, APP_TYPE_WGT,
+ RUNNER_ASSERT_MSG(perm_app_has_permission(app_label, APP_TYPE_WGT,
PRIVS2[0], NULL) == PC_ERR_INVALID_PARAM,
"perm_app_has_permission didn't check if has_permission isn't NULL.");
}
#include <tests_common.h>
#include <libprivilege-control_test_common.h>
#include "common/db.h"
+#include <memory.h>
#define APP_USER_NAME "app"
#define APP_HOME_DIR "/opt/home/app"
DB_BEGIN
result = perm_app_uninstall(APP_ID);
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
"perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
result = perm_app_install(APP_ID);
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
"perm_app_install returned " << result << ". Errno: " << strerror(errno));
//Add permissions
result = perm_app_enable_permissions(APP_ID, APP_TYPE_EFL, PRIVS_EFL, true);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error adding app permissions. Result: " << result);
DB_END
//Check if smack_have_access always fails on every rule
result = test_have_nosmack_accesses(rules_efl);
- RUNNER_ASSERT_MSG_BT(result == -1,
+ RUNNER_ASSERT_MSG(result == -1,
"Despite SMACK being off some accesses were added. Result: " << result);
TestLibPrivilegeControlDatabase db_test;
DB_BEGIN
result = perm_app_disable_permissions(USER_APP_ID, APP_TYPE_EFL, PRIVS_EFL);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling permissions: " << perm_strerror(result));
DB_END
}
DB_BEGIN
result = perm_app_uninstall(app_id);
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
"perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
result = perm_app_install(app_id);
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
"perm_app_install returned " << result << ". Errno: " << strerror(errno));
result = perm_app_enable_permissions(app_id, app_type, privileges, 1);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error enabling app permissions. Result: " << result);
DB_END
result = test_have_nosmack_accesses(rules);
- RUNNER_ASSERT_MSG_BT(result == -1,
+ RUNNER_ASSERT_MSG(result == -1,
" Permissions shouldn't be added. Result: " << result);
std::set<unsigned> groups_before;
read_user_gids(groups_before, APP_UID);
result = perm_app_set_privilege(app_id, type, app_path);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error in perm_app_set_privilege. Error: " << result);
//Even though app privileges are set, no smack label should be extracted.
char* label = NULL;
result = smack_new_label_from_self(&label);
- RUNNER_ASSERT_MSG_BT(result == -1,
+ RUNNER_ASSERT_MSG(result == -1,
" new_label_from_self should return error (SMACK is off). Result: " << result);
- RUNNER_ASSERT_MSG_BT(label == NULL,
+ RUNNER_ASSERT_MSG(label == NULL,
" new_label_from_self shouldn't allocate memory for label.");
check_groups(groups_before, dac_file);
//Set app privileges
result = perm_app_set_privilege(APP_ID, NULL, APP_SET_PRIV_PATH);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_set_privilege. Error: " << result);
//Even though app privileges are set, no smack label should be extracted.
char* label = NULL;
result = smack_new_label_from_self(&label);
- RUNNER_ASSERT_MSG_BT(result == -1,
+ RUNNER_ASSERT_MSG(result == -1,
"new_label_from_self should return error (SMACK is off). Result: " << result);
- RUNNER_ASSERT_MSG_BT(label == NULL, "new_label_from_self shouldn't allocate memory for label.");
+ RUNNER_ASSERT_MSG(label == NULL, "new_label_from_self shouldn't allocate memory for label.");
//Check if DAC privileges really set
- RUNNER_ASSERT_MSG_BT(getuid() == APP_UID, "Wrong UID");
- RUNNER_ASSERT_MSG_BT(getgid() == APP_GID, "Wrong GID");
+ RUNNER_ASSERT_MSG(getuid() == APP_UID, "Wrong UID");
+ RUNNER_ASSERT_MSG(getgid() == APP_GID, "Wrong GID");
result = strcmp(getenv("HOME"), APP_HOME_DIR);
- RUNNER_ASSERT_MSG_BT(result == 0, "Wrong HOME DIR. Result: " << result);
+ RUNNER_ASSERT_MSG(result == 0, "Wrong HOME DIR. Result: " << result);
result = strcmp(getenv("USER"), APP_USER_NAME);
- RUNNER_ASSERT_MSG_BT(result == 0, "Wrong user USER NAME. Result: " << result);
+ RUNNER_ASSERT_MSG(result == 0, "Wrong user USER NAME. Result: " << result);
check_groups(groups_before, NULL);
}
DB_BEGIN
result = perm_app_uninstall(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
result = perm_app_install(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"perm_app_install returned " << result << ". Errno: " << strerror(errno));
result = perm_app_revoke_permissions(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2, 1);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error enabling app permissions. Result: " << result);
DB_END
//Check if accesses aren't added
result = test_have_nosmack_accesses(rules2);
- RUNNER_ASSERT_MSG_BT(result == -1, "Permissions shouldn't be added. Result: " << result);
+ RUNNER_ASSERT_MSG(result == -1, "Permissions shouldn't be added. Result: " << result);
TestLibPrivilegeControlDatabase db_test;
db_test.test_db_after__perm_app_install(USER_APP_ID);
//Clean up
result = perm_app_revoke_permissions(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
DB_END
DB_BEGIN
result = perm_app_uninstall(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
result = perm_app_install(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"perm_app_install returned " << result << ". Errno: " << strerror(errno));
// Disable permissions
result = perm_app_disable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling app permissions. Result: " << result);
// Prepare permissions to reset
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2, true);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error adding app permissions. Result: " << result);
// Reset permissions
result = perm_app_reset_permissions(WGT_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error reseting app permissions. Result: " << result);
DB_END
result = test_have_nosmack_accesses(rules2);
- RUNNER_ASSERT_MSG_BT(result == -1, "Permissions shouldn't be changed. Result: " << result);
+ RUNNER_ASSERT_MSG(result == -1, "Permissions shouldn't be changed. Result: " << result);
DB_BEGIN
// Disable permissions
result = perm_app_disable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling app permissions. Result: " << result);
DB_END
//Create our server and client with fork
pid = fork();
- RUNNER_ASSERT_MSG_BT(pid >= 0, "Fork failed");
+ RUNNER_ASSERT_ERRNO_MSG(pid >= 0, "Fork failed");
if (!pid) { //child (server)
int sock, result, fd;
//Create a socket
sock = socket(AF_UNIX, SOCK_STREAM, 0);
- RUNNER_ASSERT_MSG_BT(sock >= 0, "socket failed: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(sock >= 0, "socket failed");
//Bind socket to address
result = bind(sock, (struct sockaddr*) &sockaddr, sizeof(struct sockaddr_un));
- if (result != 0) {
- close(sock);
- RUNNER_ASSERT_MSG_BT(false, "bind failed: " << strerror(errno));
- }
+ RUNNER_ASSERT_ERRNO_MSG(result == 0, "bind failed");
//Prepare for listening
result = listen(sock, 1);
- if (result != 0) {
- close(sock);
- RUNNER_ASSERT_MSG_BT(false, "listen failed: " << strerror(errno));
- }
+ RUNNER_ASSERT_ERRNO_MSG(result == 0, "listen failed");
//Accept connection
alarm(2);
fd = accept(sock, NULL, NULL);
alarm(0);
- RUNNER_ASSERT_MSG_BT(fd >= 0, "accept failed: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(fd >= 0, "accept failed");
//Wait a little bit for client to use perm_app_id_from_socket
usleep(200);
//cleanup
- close(sock);
exit(0);
} else { //parent (client)
// Give server some time to setup listening socket
//Create socket
sock = socket(AF_UNIX, SOCK_STREAM, 0);
- RUNNER_ASSERT_MSG_BT(sock >= 0, "socket failed: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(sock >= 0, "socket failed");
//Try connecting to address
result = connect(sock, (struct sockaddr*) &sockaddr, sizeof(struct sockaddr_un));
- if (result != 0) {
- close(sock);
- RUNNER_ASSERT_MSG_BT(0, "connect failed: " << strerror(errno));
- }
+ RUNNER_ASSERT_ERRNO_MSG(result == 0, "connect failed");
//Use perm_app_id_from_socket. Should fail and return NULL smack_label.
smack_label = perm_app_id_from_socket(sock);
- if (smack_label != NULL) {
- close(sock);
- RUNNER_ASSERT_MSG_BT(0, "perm_app_id_from_socket should fail.");
- }
+ RUNNER_ASSERT_MSG(!smack_label, "perm_app_id_from_socket should fail.");
//cleanup
- close(sock);
- RUNNER_ASSERT_MSG_BT(smack_label == NULL, "perm_app_id_from_socket should fail.");
+ RUNNER_ASSERT_MSG(smack_label == NULL, "perm_app_id_from_socket should fail.");
}
}
// Clear any previously created apps, files, labels and permissions
result = nftw(TEST_APP_DIR, &nftw_remove_labels, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
"Unable to clean up Smack labels in: " << TEST_APP_DIR
<< ". Result: " << result);
result = nftw(TEST_NON_APP_DIR, &nftw_remove_labels, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
"Unable to clean up Smack labels in: " << TEST_NON_APP_DIR
<< ". Result: " << result);
DB_BEGIN
result = perm_app_revoke_permissions(APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_revoke_permissions. Result: " << result);
result = perm_app_uninstall(APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_uninstall. Result: " << result);
// Install setting app and give it app-setting permissions
result = perm_app_revoke_permissions(APP_TEST_SETTINGS_ASP1);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_revoke_permissions. Result: " << result);
result = perm_app_uninstall(APP_TEST_SETTINGS_ASP1);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_uninstall. Result: " << result);
result = perm_app_install(APP_TEST_SETTINGS_ASP1);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_install. Result: " << result);
// Register appsettings feature
result = perm_add_api_feature(APP_TYPE_OSP, PRIV_APPSETTING[0], PRIV_APPSETTING_RULES, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error while registering api feature. Result: " << result);
result = perm_app_enable_permissions(APP_TEST_SETTINGS_ASP1,
APP_TYPE_OSP, PRIV_APPSETTING, true);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error enabling App-Setting permissions. Result: " << result);
// Install one additional app (used to check perm to shared directories)
result = perm_app_revoke_permissions(TEST_OSP_FEATURE_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_revoke_permissions. Result: " << result);
result = perm_app_uninstall(TEST_OSP_FEATURE_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_uninstall. Result: " << result);
result = perm_app_install(TEST_OSP_FEATURE_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_install. Result: " << result);
const char *test1[] = { NULL };
result = perm_app_enable_permissions(TEST_OSP_FEATURE_APP_ID,
APP_TYPE_OSP, test1, true);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error enabling permissions. Result: " << result);
// Register two valid api features
result = perm_add_api_feature(APP_TYPE_OSP, TEST_OSP_FEATURE,
test_osp_feature_rule_set, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_add_api_feature. Cannot add TEST_OSP_FEATURE: "
<< TEST_OSP_FEATURE << ". Result: " << result);
result = perm_add_api_feature(APP_TYPE_WGT, TEST_WGT_FEATURE,
test_wgt_feature_rule_set, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_add_api_feature. Cannot add TEST_WGT_FEATURE: "
<< TEST_WGT_FEATURE << ". Result: " << result);
// Add application
result = perm_app_install(APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_install. Loop index: " << i
<< ". Result: " << result);
// Add persistent permissions
result = perm_app_enable_permissions(APP_ID, APP_TYPE_OSP,
TEST_OSP_FEATURE_PRIVS, true);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_enable_permissions from OSP Feature. Loop index: "
<< i << ". Result: " << result);
result = perm_app_enable_permissions(APP_ID, APP_TYPE_WGT,
TEST_WGT_FEATURE_PRIVS, true);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_enable_permissions from WGT Feature. Loop index: "
<< i << ". Result: " << result);
// Add app shared dir - APP_PATH_PRIVATE
result = perm_app_setup_path(APP_ID, TEST_APP_DIR,
APP_PATH_PRIVATE);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_setup_path. Loop index: " << i
<< ". Result: " << result);
// Add app shared dir - APP_PATH_PUBLIC_RO
result = perm_app_setup_path(APP_ID, TEST_NON_APP_DIR,
APP_PATH_PUBLIC_RO);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_setup_path. Loop index: " << i
<< ". Result: " << result);
// Verify that some previously installed app does not have any access
// to APP_ID private label
result = check_no_accesses(smack, rules_to_test_any_access1);
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
"Error - other app has access to private label. Loop index: "
<< i);
char *label;
result = smack_getlabel(TEST_NON_APP_DIR, &label,
SMACK_LABEL_ACCESS );
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
"Cannot get access label from Public RO shared dir. Loop index: "
<< i << ". Result: " << result);
shared_dir_auto_label = label;
// correctly, also to other app
result = smack_have_access(APP_ID, shared_dir_auto_label.c_str(), "rwxatl");
- RUNNER_ASSERT_MSG_BT(result == expected_smack_result,
+ RUNNER_ASSERT_MSG(result == expected_smack_result,
"Not all accesses to Public RO dir are granted. Loop index: "
<< i);
result = smack_have_access(TEST_OSP_FEATURE_APP_ID, shared_dir_auto_label.c_str(), "rx" );
- RUNNER_ASSERT_MSG_BT(result == expected_smack_result,
+ RUNNER_ASSERT_MSG(result == expected_smack_result,
"Not all accesses to Public RO dir are granted. Loop index: "
<< i);
// Add app shared dir - APP_PATH_SETTINGS_RW
result = perm_app_setup_path(APP_ID, TEST_APP_DIR,
APP_PATH_SETTINGS_RW);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_setup_path. Loop index: " << i
<< ". Result: " << result);
// Add app shared dir - APP_PATH_GROUP_RW
result = perm_app_setup_path(APP_ID, TEST_NON_APP_DIR,
APP_PATH_GROUP_RW);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_setup_path. Loop index: " << i
<< ". Result: " << result);
char *label;
result = smack_getlabel(TEST_APP_DIR, &label,
SMACK_LABEL_ACCESS );
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
"Cannot get access label from App-Setting shared dir. Loop index: "
<< i << ". Result: " << result);
shared_dir_auto_label = label;
// Verify that setting app has rwx permission to app dir
// and rx permissions to app
result = smack_have_access(APP_ID, shared_dir_auto_label.c_str(), "rwxatl");
- RUNNER_ASSERT_MSG_BT(result == expected_smack_result,
+ RUNNER_ASSERT_MSG(result == expected_smack_result,
"Not all accesses to App-Setting dir are granted. "
<< APP_ID << " "<< shared_dir_auto_label << " rwxatl "
<< "Loop index: " << i);
result = smack_have_access(APP_TEST_SETTINGS_ASP1, shared_dir_auto_label.c_str(), "rwx");
- RUNNER_ASSERT_MSG_BT(result == expected_smack_result,
+ RUNNER_ASSERT_MSG(result == expected_smack_result,
"Not all accesses to App-Setting dir are granted. "
<< APP_TEST_SETTINGS_ASP1 << " " << shared_dir_auto_label << " rwx. "
<< "Loop index: " << i);
result = smack_have_access(APP_TEST_SETTINGS_ASP1, APP_ID, "rx");
- RUNNER_ASSERT_MSG_BT(result == expected_smack_result,
+ RUNNER_ASSERT_MSG(result == expected_smack_result,
"Not all accesses to App-Setting dir are granted. "
<< APP_TEST_SETTINGS_ASP1 << " " << APP_ID << " rx"
<< "Loop index: " << i);
// Verify that all permissions to public dir have been added
// correctly, also to other app
result = smack_have_access(APP_ID, LABEL_FOR_PUBLIC_SHARED_DIRS, "rwxatl");
- RUNNER_ASSERT_MSG_BT(result == expected_smack_result,
+ RUNNER_ASSERT_MSG(result == expected_smack_result,
"Not all accesses to Group RW dir are granted. Loop index: "
<< i);
(const rules_t) {
{ APP_ID, TEST_OSP_FEATURE_APP_ID, "rxl" },
{ APP_ID, TEST_WGT_FEATURE_APP_ID, "rwxl" } } );
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
"Not all permisions from api features added. Loop index: "
<< i);
// revoke permissions
result = perm_app_revoke_permissions(APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_revoke_permissions. Loop index: " << i
<< ". Result: " << result);
// check if api-features permissions are removed properly
result = check_no_accesses(smack, rules_to_test_any_access2);
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
"Not all permisions revoked. Loop index: " << i);
// remove labels from app folder
result = nftw(TEST_APP_DIR, &nftw_remove_labels, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
"Unable to clean up Smack labels in " << TEST_APP_DIR
<< " . Loop index: " << i << ". Result: " << result);
// remove labels from shared folder
result = nftw(TEST_NON_APP_DIR, &nftw_remove_labels,
FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
"Unable to clean up Smack labels in " << TEST_NON_APP_DIR
<< " . Loop index: " << i << ". Result: " << result);
// uninstall app
result = perm_app_uninstall(APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_uninstall. Loop index: " << i
<< ". Result: " << result);
} // END Install app loop
// Uninstall setting app and additional app
result = perm_app_uninstall(TEST_OSP_FEATURE_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_uninstall. Result: " << result);
result = perm_app_uninstall(APP_TEST_SETTINGS_ASP1);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_uninstall. Result: " << result);
DB_END
for (int i = 0; i < app_count; ++i)
{
result = sprintf(app_ids[i], APP_ID "%d", i);
- RUNNER_ASSERT_MSG_BT(result > 0, "Cannot generate name for app nr: " << i);
+ RUNNER_ASSERT_MSG(result > 0, "Cannot generate name for app nr: " << i);
}
DB_BEGIN
for (int i = 0; i < app_count; ++i)
{
result = perm_app_revoke_permissions(app_ids[i]);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_revoke_permissions for app: "
<< app_ids[i] << ". Result: " << result);
result = perm_app_uninstall(app_ids[i]);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_uninstall for app: "
<< app_ids[i] << ". Result: " << result);
}
// Install setting app and give it app-setting permissions
result = perm_app_revoke_permissions(APP_TEST_SETTINGS_ASP1);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_revoke_permissions."
<< " Result: " << result);
result = perm_app_uninstall(APP_TEST_SETTINGS_ASP1);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_uninstall."
<< " Result: " << result);
result = perm_app_install(APP_TEST_SETTINGS_ASP1);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_install."
<< " Result: " << result);
// Register appsettings feature
result = perm_add_api_feature(APP_TYPE_OSP, PRIV_APPSETTING[0], PRIV_APPSETTING_RULES, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
" Error while registering api feature. Result: " << result);
result = perm_app_enable_permissions(APP_TEST_SETTINGS_ASP1,
APP_TYPE_OSP, PRIV_APPSETTING, true);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error registering App-Setting permissions."
<< " Result: " << result);
// Register two valid api features
result = perm_add_api_feature(APP_TYPE_OSP, TEST_OSP_FEATURE,
test_osp_feature_rule_set2, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_add_api_feature. Cannot add TEST_OSP_FEATURE: "
<< TEST_OSP_FEATURE << ". Result: " << result);
result = perm_add_api_feature(APP_TYPE_WGT, TEST_WGT_FEATURE,
test_wgt_feature_rule_set2, NULL, 0);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_add_api_feature. Cannot add TEST_WGT_FEATURE: "
<< TEST_WGT_FEATURE << ". Result: " << result);
for (int j = 0; j < app_count; ++j)
{
result = perm_app_install(app_ids[j]);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_install. App id: "
<< app_ids[j]
<< " Loop index: " << i
// Create 10 directories
result = sprintf(app_dirs[j],"/tmp/" APP_ID "%d_%d", j, i);
- RUNNER_ASSERT_MSG_BT(result > 0,
+ RUNNER_ASSERT_MSG(result > 0,
"Cannot generate directory name for app nr: " << j
<< " Loop index: " << i);
result = mkdir(app_dirs[j], S_IRWXU | S_IRGRP | S_IXGRP);
- RUNNER_ASSERT_MSG_BT(result == 0 || errno == EEXIST,
- "Cannot create directory: " << app_dirs[j]);
+ RUNNER_ASSERT_ERRNO_MSG(result == 0 || errno == EEXIST,
+ "Cannot create directory: " << app_dirs[j]);
result = nftw(app_dirs[j], &nftw_remove_labels, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
"Unable to clean up Smack labels in: " << app_dirs[j]
<< ". Result: " << result);
}
// add persistent api feature permissions
result = perm_app_enable_permissions(app_ids[j], APP_TYPE_OSP,
TEST_OSP_FEATURE_PRIVS, true);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app__permissions from OSP Feature. App id: "
<< app_ids[j] << " Loop index: " << i << ". Result: " << result);
result = perm_app_enable_permissions(app_ids[j+5], APP_TYPE_WGT,
TEST_WGT_FEATURE_PRIVS, true);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_enable_permissions from WGT Feature. App id: "
<< app_ids[j+5] << " Loop index: " << i << ". Result: " << result);
}
// Add app shared dirs - APP_PATH_PRIVATE (apps 0, 5)
result = perm_app_setup_path(app_ids[0], app_dirs[0], APP_PATH_PRIVATE);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_setup_path. App id: " << app_ids[0]
<< " Loop index: " << i << ". Result: " << result);
result = perm_app_setup_path(app_ids[5], app_dirs[5], APP_PATH_PRIVATE);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_setup_path. App id: " << app_ids[5]
<< " Loop index: " << i << ". Result: " << result);
// Add app shared dir - APP_PATH_GROUP_RW (apps 1, 2, 6)
result = perm_app_setup_path(app_ids[1], app_dirs[1],
APP_PATH_GROUP_RW);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_setup_path. App id: " << app_ids[1]
<< " Loop index: " << i << ". Result: " << result);
result = perm_app_setup_path(app_ids[2], app_dirs[2],
APP_PATH_GROUP_RW);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_setup_path. App id: " << app_ids[2]
<< " Loop index: " << i << ". Result: " << result);
result = perm_app_setup_path(app_ids[6], app_dirs[6],
APP_PATH_GROUP_RW);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_setup_path. App id: " << app_ids[6]
<< " Loop index: " << i << ". Result: " << result);
// Add app shared dir - APP_PATH_PUBLIC_RO (apps 3, 7, 8)
result = perm_app_setup_path(app_ids[3], app_dirs[3],
APP_PATH_PUBLIC_RO);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_setup_path. App id: " << app_ids[1]
<< " Loop index: " << i << ". Result: " << result);
result = perm_app_setup_path(app_ids[7], app_dirs[7],
APP_PATH_PUBLIC_RO);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_setup_path. App id: " << app_ids[7]
<< " Loop index: " << i << ". Result: " << result);
result = perm_app_setup_path(app_ids[8], app_dirs[8],
APP_PATH_PUBLIC_RO);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_setup_path. App id: " << app_ids[8]
<< " Loop index: " << i << ". Result: " << result);
// Add app shared dir - APP_PATH_SETTINGS_RW (apps ,4, 9)
result = perm_app_setup_path(app_ids[4], app_dirs[4],
APP_PATH_SETTINGS_RW);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_setup_path. App id: " << app_ids[4]
<< " Loop index: " << i << ". Result: " << result);
result = perm_app_setup_path(app_ids[9], app_dirs[9],
APP_PATH_SETTINGS_RW);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_setup_path. App id: " << app_ids[9]
<< " Loop index: " << i << ". Result: " << result);
result = check_no_accesses(smack,
FMT_VECTOR_TO_TEST_ANY_ACCESS(app_ids[j], app_ids[0])
);
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
"Other app (app id: " << app_ids[j] <<
") has access to private label of: " << app_ids[0] <<
". It may not be shared. Loop index: " << i << ".");
result = check_no_accesses(smack,
FMT_VECTOR_TO_TEST_ANY_ACCESS(app_ids[j], app_ids[5])
);
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
"Other app (app id: " << app_ids[j] <<
") has access to private label of: " << app_ids[5] <<
". It may not be shared. Loop index: " << i << ".");
{ app_ids[1], LABEL_FOR_PUBLIC_SHARED_DIRS, "rwxatl" },
{ app_ids[2], LABEL_FOR_PUBLIC_SHARED_DIRS, "rwxatl" },
{ app_ids[6], LABEL_FOR_PUBLIC_SHARED_DIRS, "rwxatl" } } );
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
"Not all accesses to Group RW dir are granted. Loop index: "
<< i);
char *label;
result = smack_getlabel(app_dirs[3], &label,
SMACK_LABEL_ACCESS );
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
"Cannot get access label from Public RO shared dir: " << app_dirs[3]
<< " . Loop index: " << i << ". Result: " << result);
shared_dir3_auto_label = label;
result = smack_getlabel(app_dirs[7], &label,
SMACK_LABEL_ACCESS );
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
"Cannot get access label from Public RO shared dir: " << app_dirs[7]
<< " . Loop index: " << i << ". Result: " << result);
shared_dir7_auto_label = label;
result = smack_getlabel(app_dirs[8], &label,
SMACK_LABEL_ACCESS );
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
"Cannot get access label from Public RO shared dir: " << app_dirs[8]
<< " . Loop index: " << i << ". Result: " << result);
shared_dir8_auto_label = label;
result = check_all_accesses(smack,
(const rules_t) {
{ app_ids[j], shared_dir3_auto_label.c_str(), "rwxatl" } } );
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
"Not all accesses to owned Public RO dir are granted. App id: "
<< app_ids[j] << " Loop index: " << i);
// Verify that there are no extra permissions to public dirs
{ app_ids[j], shared_dir7_auto_label.c_str(), "t" },
{ app_ids[j], shared_dir8_auto_label.c_str(), "w" },
{ app_ids[j], shared_dir8_auto_label.c_str(), "t" } } );
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
"Unexpected extra permissions added for app:" << app_ids[j]
<< ". Loop index: " << i);
}
result = check_all_accesses(smack,
(const rules_t) {
{ app_ids[j], shared_dir7_auto_label.c_str(), "rwxatl" } } );
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
"Not all accesses to owned Public RO dir are granted. App id: "
<< app_ids[j] << " Loop index: " << i);
// Verify that there are no extra permissions to public dirs
{ app_ids[j], shared_dir3_auto_label.c_str(), "t" },
{ app_ids[j], shared_dir8_auto_label.c_str(), "w" },
{ app_ids[j], shared_dir8_auto_label.c_str(), "t" } } );
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
"Unexpected extra permissions added for app:" << app_ids[j]
<< ". Loop index: " << i);
}
result = check_all_accesses(smack,
(const rules_t) {
{ app_ids[j], shared_dir8_auto_label.c_str(), "rwxatl" } } );
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
"Not all accesses to owned Public RO dir are granted. App id: "
<< app_ids[j] << " Loop index: " << i);
// Verify that there are no extra permissions to other public dirs
{ app_ids[j], shared_dir3_auto_label.c_str(), "t" },
{ app_ids[j], shared_dir7_auto_label.c_str(), "w" },
{ app_ids[j], shared_dir7_auto_label.c_str(), "t" } } );
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
"Unexpected extra permissions added for app:" << app_ids[j]
<< ". Loop index: " << i);
}
{ app_ids[j], shared_dir3_auto_label.c_str(), "rx" },
{ app_ids[j], shared_dir7_auto_label.c_str(), "rx" },
{ app_ids[j], shared_dir8_auto_label.c_str(), "rx" } } );
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
"Not all accesses to Public RO dirs are granted. App id: "
<< app_ids[j] << ". Loop index: " << i);
} // End for Verify PUBLIC_RO
// Get autogenerated SETTING_RW labels
result = smack_getlabel(app_dirs[4], &label,
SMACK_LABEL_ACCESS );
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
"Cannot get access label from App-Setting shared dir: "
<< app_dirs[4] << " . Loop index: " << i
<< ". Result: " << result);
result = smack_getlabel(app_dirs[9], &label,
SMACK_LABEL_ACCESS );
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
"Cannot get access label from App-Setting shared dir: "
<< app_dirs[9] << " . Loop index: " << i
<< ". Result: " << result);
// Verify that setting app has rwx permission to app-settings dirs and rx to apps
result = smack_have_access(app_ids[4], setting_dir4_auto_label.c_str(), "rwxatl");
- RUNNER_ASSERT_MSG_BT(result == expected_smack_result,
+ RUNNER_ASSERT_MSG(result == expected_smack_result,
"Not all accesses to App-Setting dir are granted."
<< app_ids[4] << " " << setting_dir4_auto_label
<< " Loop index: " << i);
result = smack_have_access(app_ids[9], setting_dir9_auto_label.c_str(), "rwxatl");
- RUNNER_ASSERT_MSG_BT(result == expected_smack_result,
+ RUNNER_ASSERT_MSG(result == expected_smack_result,
"Not all accesses to App-Setting dir are granted."
<< app_ids[9] << " " << setting_dir9_auto_label
<< " Loop index: " << i);
result = smack_have_access(APP_TEST_SETTINGS_ASP1, app_ids[4], "rx");
- RUNNER_ASSERT_MSG_BT(result == expected_smack_result,
+ RUNNER_ASSERT_MSG(result == expected_smack_result,
"Not all accesses to App-Setting dir are granted."
<< APP_TEST_SETTINGS_ASP1 << " " << app_ids[4]
<< " Loop index: " << i);
result = smack_have_access(APP_TEST_SETTINGS_ASP1, app_ids[9], "rx");
- RUNNER_ASSERT_MSG_BT(result == expected_smack_result,
+ RUNNER_ASSERT_MSG(result == expected_smack_result,
"Not all accesses to App-Setting dir are granted."
<< APP_TEST_SETTINGS_ASP1 << " " << app_ids[9]
<< " Loop index: " << i);
result = smack_have_access(APP_TEST_SETTINGS_ASP1, setting_dir4_auto_label.c_str(), "rwx");
- RUNNER_ASSERT_MSG_BT(result == expected_smack_result,
+ RUNNER_ASSERT_MSG(result == expected_smack_result,
"Not all accesses to App-Setting dir are granted."
<< APP_TEST_SETTINGS_ASP1 << " " << setting_dir4_auto_label
<< " Loop index: " << i);
result = smack_have_access(APP_TEST_SETTINGS_ASP1, setting_dir9_auto_label.c_str(), "rwx");
- RUNNER_ASSERT_MSG_BT(result == expected_smack_result,
+ RUNNER_ASSERT_MSG(result == expected_smack_result,
"Not all accesses to App-Setting dir are granted."
<< APP_TEST_SETTINGS_ASP1 << " " << setting_dir9_auto_label
<< " Loop index: " << i);
{ app_ids[j], app_ids[7], "rxl" },
{ app_ids[j], app_ids[8], "rwxal" },
{ app_ids[j], app_ids[9], "rwxatl" } } );
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
"Not all permisions from api features added for app id: "
<< app_ids[j] << ". Loop index: " << i);
}
{ app_ids[j], app_ids[2], "rxl" },
{ app_ids[j], app_ids[3], "rwxal" },
{ app_ids[j], app_ids[4], "rwxatl" } } );
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
"Not all permisions from api features added for app id: "
<< app_ids[j] << ". Loop index: " << i);
}
for (int j = 0; j < app_count; ++j)
{
result = perm_app_revoke_permissions(app_ids[j]);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_revoke_permissions. App id: "
<< app_ids[j] << " Loop index: " << i
<< ". Result: " << result);
result = check_no_accesses(smack,
FMT_VECTOR_TO_TEST_ANY_ACCESS(app_ids[j], app_ids[k])
);
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
"Not all permisions revoked. Subject: " << app_ids[j]
<< " Object: " << app_ids[k] << " Loop index: " << i);
}
{
result = nftw(app_dirs[j], &nftw_remove_labels,
FTW_MAX_FDS, FTW_PHYS); // rm labels from app folder
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
"Unable to clean up Smack labels in: "
<< app_dirs[j] << " . Loop index: " << i
<< ". Result: " << result);
result = perm_app_uninstall(app_ids[j]);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_uninstall for app: "
<< app_ids[j] << " . Loop index: " << i
<< ". Result: " << result);
for (int j = 0; j < app_count; ++j)
{
result = rmdir(app_dirs[j]);
- RUNNER_ASSERT_MSG_BT(result == 0,
- "Cannot remove directory: " << app_dirs[j]);
+ RUNNER_ASSERT_ERRNO_MSG(result == 0,
+ "Cannot remove directory: " << app_dirs[j]);
}
} // END Install app loop
// Uninstall setting app
result = perm_app_uninstall(APP_TEST_SETTINGS_ASP1);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error in perm_app_uninstall. Result: " << result);
}
void *h2 = MAP_FAILED;
//getting files information
- RUNNER_ASSERT_MSG_BT(fstat(fd1, &fs1) == 0, "fstat failed: " << strerror(errno));
- RUNNER_ASSERT_MSG_BT(fstat(fd2, &fs2) == 0, "fstat failed: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(fstat(fd1, &fs1) == 0, "fstat failed");
+ RUNNER_ASSERT_ERRNO_MSG(fstat(fd2, &fs2) == 0, "fstat failed");
if (fs1.st_size != fs2.st_size) //if files are identical size will be the same
return -1;
//mapping files to process memory
- RUNNER_ASSERT_MSG_BT((h1 = mmap(0, fs1.st_size, PROT_READ, MAP_SHARED, fd1, 0 )) != MAP_FAILED,
- "mmap failed for fd=" << fd1 << " : " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG((h1 = mmap(0, fs1.st_size, PROT_READ, MAP_SHARED, fd1, 0 )) != MAP_FAILED,
+ "mmap failed for fd=" << fd1);
if ((h2 = mmap(0, fs2.st_size, PROT_READ, MAP_SHARED, fd2, 0 )) == MAP_FAILED) {
munmap(h1, fs1.st_size);
- RUNNER_ASSERT_MSG_BT(h2 != MAP_FAILED, "mmap failed for fd=" << fd2
- << " : " << strerror(errno));
+ RUNNER_ASSERT_MSG(h2 != MAP_FAILED, "mmap failed for fd=" << fd2
+ << ". " << strerror(errno));
}
int result = memcmp(h1, h2, fs1.st_size);
clean_up();
struct smack_accesses *rules = NULL;
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
SmackAccessesPtr rules_ptr(rules);
// THE TEST
result = smack_accesses_add_modify(rules,TEST_SUBJECT, TEST_OBJECT,"xr","");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add modify by empty rules");
- RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to add modify by empty rules");
+ RUNNER_ASSERT_MSG(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,"xr");
- RUNNER_ASSERT_MSG_BT(result == 1, "Rule modified (added 'xr'), but no change made.");
+ RUNNER_ASSERT_MSG(result == 1, "Rule modified (added 'xr'), but no change made.");
// CLEAN UP
clean_up();
RUNNER_TEST_SMACK(smack_accesses_add_modify_test_2){
int result;
struct smack_accesses *rules = NULL;
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
SmackAccessesPtr rules_ptr(rules);
clean_up();
// THE TEST
result = smack_accesses_add_modify(rules_ptr.get(),TEST_SUBJECT, TEST_OBJECT,"r","");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule.");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule.");
result = smack_accesses_add_modify(rules_ptr.get(),TEST_SUBJECT, TEST_OBJECT,"","r");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule.");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule.");
- RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
- RUNNER_ASSERT_MSG_BT(smack_have_access(TEST_SUBJECT, TEST_OBJECT,"r") == 0,
+ RUNNER_ASSERT_MSG(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG(smack_have_access(TEST_SUBJECT, TEST_OBJECT,"r") == 0,
"Modification didn't work");
// CLEAN UP
RUNNER_TEST_SMACK(smack_accesses_add_modify_test_3){
int result;
struct smack_accesses *rules = NULL;
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
SmackAccessesPtr rules_ptr(rules);
clean_up();
// THE TEST
// Add r privilage
result = smack_accesses_add_modify(rules_ptr.get(),TEST_SUBJECT, TEST_OBJECT,"r","");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule.");
- RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
- RUNNER_ASSERT_MSG_BT(smack_have_access(TEST_SUBJECT, TEST_OBJECT,"r") == 1,
+ RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule.");
+ RUNNER_ASSERT_MSG(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG(smack_have_access(TEST_SUBJECT, TEST_OBJECT,"r") == 1,
"Adding privileges didn't work");
// Revoke r privilege
rules_ptr.release();
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
rules_ptr.reset(rules);
result = smack_accesses_add_modify(rules_ptr.get(),TEST_SUBJECT, TEST_OBJECT,"","r");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule.");
- RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule.");
+ RUNNER_ASSERT_MSG(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,"r");
- RUNNER_ASSERT_MSG_BT(result == 0, "Modification didn't work, rule has still 'r' privileges.");
+ RUNNER_ASSERT_MSG(result == 0, "Modification didn't work, rule has still 'r' privileges.");
// CLEAN UP
clean_up();
RUNNER_TEST_SMACK(smack_accesses_add_modify_test_4){
int result;
struct smack_accesses *rules = NULL;
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
SmackAccessesPtr rules_ptr(rules);
clean_up();
// THE TEST
result = smack_accesses_add_modify(rules_ptr.get(),TEST_SUBJECT, TEST_OBJECT,"rwxat","");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule.");
- RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule.");
+ RUNNER_ASSERT_MSG(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
result = smack_accesses_add_modify(rules_ptr.get(),TEST_SUBJECT, TEST_OBJECT,"","r");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule.");
- RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule.");
+ RUNNER_ASSERT_MSG(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,"awxt");
- RUNNER_ASSERT_MSG_BT(result == 1, "Modification didn't work. Rule should have 'awxt' privileges.");
+ RUNNER_ASSERT_MSG(result == 1, "Modification didn't work. Rule should have 'awxt' privileges.");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,"r");
- RUNNER_ASSERT_MSG_BT(result != 1, "Modification didn't work. Rule should NOT have 'r' privilege.");
+ RUNNER_ASSERT_MSG(result != 1, "Modification didn't work. Rule should NOT have 'r' privilege.");
// CLEAN UP
clean_up();
RUNNER_TEST_SMACK(smack_accesses_add_modify_test_5){
int result;
struct smack_accesses *rules = NULL;
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
SmackAccessesPtr rules_ptr(rules);
clean_up();
// THE TEST
result = smack_accesses_add_modify(rules_ptr.get(),TEST_SUBJECT, TEST_OBJECT,"rwxat","");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule.");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule.");
result = smack_accesses_add_modify(rules_ptr.get(),TEST_SUBJECT, TEST_OBJECT,"","r");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule.");
- RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule.");
+ RUNNER_ASSERT_MSG(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,"awxt");
- RUNNER_ASSERT_MSG_BT(result == 1, "Modification didn't work. Rule should have 'awxt' privileges.");
+ RUNNER_ASSERT_MSG(result == 1, "Modification didn't work. Rule should have 'awxt' privileges.");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,"r");
- RUNNER_ASSERT_MSG_BT(result != 1, "Modification didn't work. Rule should NOT have 'r' privilege.");
+ RUNNER_ASSERT_MSG(result != 1, "Modification didn't work. Rule should NOT have 'r' privilege.");
// CLEAN UP
clean_up();
RUNNER_TEST_SMACK(smack_accesses_add_modify_test_6){
int result;
struct smack_accesses *rules = NULL;
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
SmackAccessesPtr rules_ptr(rules);
clean_up();
// THE TEST
result = smack_accesses_add_modify(rules_ptr.get(),TEST_SUBJECT, TEST_OBJECT,"rwt","");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule.");
- RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule.");
+ RUNNER_ASSERT_MSG(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
result = smack_accesses_add_modify(rules_ptr.get(),TEST_SUBJECT, TEST_OBJECT,"ax","rt");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule.");
- RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule.");
+ RUNNER_ASSERT_MSG(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,"wax");
- RUNNER_ASSERT_MSG_BT(result == 1, "Modification didn't work. Rule should have 'wax' privileges.");
+ RUNNER_ASSERT_MSG(result == 1, "Modification didn't work. Rule should have 'wax' privileges.");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,"r");
- RUNNER_ASSERT_MSG_BT(result != 1, "Modification didn't work. Rule should NOT have 'r' privilege.");
+ RUNNER_ASSERT_MSG(result != 1, "Modification didn't work. Rule should NOT have 'r' privilege.");
// CLEAN UP
clean_up();
struct smack_accesses *rules = NULL;
for (i = 0; i < accessesBasic.size(); ++i) {
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
SmackAccessesPtr rules_ptr(rules);
result = smack_accesses_add_modify(rules_ptr.get(),TEST_SUBJECT, TEST_OBJECT,
accessesBasic[i].c_str(), accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify accesses instance");
- RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to modify accesses instance");
+ RUNNER_ASSERT_MSG(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
- RUNNER_ASSERT_MSG_BT(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT),
+ RUNNER_ASSERT_MSG(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT),
" Error while checking smack access. Accesses exist.");
// CLEAN UP
for (i = 0; i < accessesBasic.size(); ++i) {
// Creating and adding rules with TEST_OBJECT and TEST_OBJECT_2
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
SmackAccessesPtr rules_ptr(rules);
result = smack_accesses_add_modify(rules_ptr.get(),TEST_SUBJECT, TEST_OBJECT,
accessesBasic[i].c_str(),"");
result = smack_accesses_add_modify(rules_ptr.get(),TEST_SUBJECT, TEST_OBJECT_2,
accessesBasic[i].c_str(),"");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify accesses instance");
- RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to modify accesses instance");
+ RUNNER_ASSERT_MSG(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG_BT(result == 1, "Modification didn't work. "
+ RUNNER_ASSERT_MSG(result == 1, "Modification didn't work. "
"Rule " << accessesBasic[i].c_str() << " does not exist.");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT_2,accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG_BT(result == 1, "Modification didn't work. "
+ RUNNER_ASSERT_MSG(result == 1, "Modification didn't work. "
"Rule " << accessesBasic[i].c_str() << " does not exist.");
// Revoking subject
result = smack_revoke_subject(TEST_SUBJECT);
- RUNNER_ASSERT_MSG_BT(result == 0, "Revoking subject didn't work.");
+ RUNNER_ASSERT_MSG(result == 0, "Revoking subject didn't work.");
- RUNNER_ASSERT_MSG_BT(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT),
+ RUNNER_ASSERT_MSG(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT),
" Revoke didn't work. Accesses exist.");
- RUNNER_ASSERT_MSG_BT(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT_2),
+ RUNNER_ASSERT_MSG(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT_2),
" Revoke didn't work. Accesses exist.");
// Revoking subject again
result = smack_revoke_subject(TEST_SUBJECT);
- RUNNER_ASSERT_MSG_BT(result == 0, "Revoking subject didn't work.");
+ RUNNER_ASSERT_MSG(result == 0, "Revoking subject didn't work.");
- RUNNER_ASSERT_MSG_BT(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT),
+ RUNNER_ASSERT_MSG(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT),
" Revoke didn't work. Accesses exist.");
- RUNNER_ASSERT_MSG_BT(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT_2),
+ RUNNER_ASSERT_MSG(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT_2),
" Revoke didn't work. Accesses exist.");
}
for (i = 0; i < accessesBasic.size(); ++i) {
// Creating and adding rules with TEST_OBJECT and TEST_OBJECT_2
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
SmackAccessesPtr rules_ptr(rules);
result = smack_accesses_add(rules_ptr.get(),TEST_SUBJECT, TEST_OBJECT,
accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify accesses instance");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to modify accesses instance");
result = smack_accesses_add(rules_ptr.get(),TEST_SUBJECT, TEST_OBJECT_2,
accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify accesses instance");
- RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to modify accesses instance");
+ RUNNER_ASSERT_MSG(smack_accesses_apply(rules_ptr.get()) == 0, "Unable to apply rules");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG_BT(result == 1, "Modification didn't work. Rule "
+ RUNNER_ASSERT_MSG(result == 1, "Modification didn't work. Rule "
<< accessesBasic[i].c_str() << " does not exist.");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT_2,accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG_BT(result == 1, "Modification didn't work. Rule "
+ RUNNER_ASSERT_MSG(result == 1, "Modification didn't work. Rule "
<< accessesBasic[i].c_str() << " does not exist.");
// Creating and clearing rules with TEST_OBJECT
rules_ptr.release();
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
rules_ptr.reset(rules);
result = smack_accesses_add(rules_ptr.get(),TEST_SUBJECT, TEST_OBJECT,
accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify accesses instance");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to modify accesses instance");
result = smack_accesses_clear(rules_ptr.get());
- RUNNER_ASSERT_MSG_BT(result == 0, "Clearing rules didn't work.");
+ RUNNER_ASSERT_MSG(result == 0, "Clearing rules didn't work.");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG_BT(result == 0, "Clearing rules didn't work. Rule "
+ RUNNER_ASSERT_MSG(result == 0, "Clearing rules didn't work. Rule "
<< accessesBasic[i].c_str() << " does exist.");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT_2,accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG_BT(result == 1, "Clearing rules didn't work. Rule "
+ RUNNER_ASSERT_MSG(result == 1, "Clearing rules didn't work. Rule "
<< accessesBasic[i].c_str() << " does not exist.");
// Creating and clearing rules with TEST_OBJECT
rules_ptr.release();
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
rules_ptr.reset(rules);
result = smack_accesses_add(rules_ptr.get(),TEST_SUBJECT, TEST_OBJECT_2,
accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify accesses instance");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to modify accesses instance");
result = smack_accesses_clear(rules_ptr.get());
- RUNNER_ASSERT_MSG_BT(result == 0, "Clearing rules didn't work.");
+ RUNNER_ASSERT_MSG(result == 0, "Clearing rules didn't work.");
- RUNNER_ASSERT_MSG_BT(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT),
+ RUNNER_ASSERT_MSG(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT),
" Clear didn't work. Accesses exist.");
- RUNNER_ASSERT_MSG_BT(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT_2),
+ RUNNER_ASSERT_MSG(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT_2),
" Clear didn't work. Accesses exist.");
}
}
int fd, tmp, sample; //file descripptors for save / restore rules tests
//int smack_accesses_new(struct smack_accesses **accesses);
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
SmackAccessesPtr rules_ptr(rules);
- RUNNER_ASSERT_BT(smack_accesses_new(&import_test) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&import_test) == 0);
SmackAccessesPtr import_ptr(import_test);
//opening files
fd = open("/tmp/smack01_rules", O_RDWR | O_CREAT | O_TRUNC, 0644); //for export prepared rules
- RUNNER_ASSERT_MSG_BT(fd >= 0, "Unable to create /tmp/smack01_rules");
+ RUNNER_ASSERT_ERRNO_MSG(fd >= 0, "Unable to create /tmp/smack01_rules");
FdUniquePtr fd_ptr(&fd);
tmp = open("/tmp/smack01_tmp", O_RDWR | O_CREAT | O_TRUNC, 0644); //for import rules exported before
- RUNNER_ASSERT_MSG_BT(fd >= 0, "Unable to create /tmp/smack01_tmp");
+ RUNNER_ASSERT_ERRNO_MSG(fd >= 0, "Unable to create /tmp/smack01_tmp");
FdUniquePtr tmp_ptr(&tmp);
sample = open("/etc/smack/test_smack_rules", O_RDONLY, 0644); //reference preinstalled rules
- RUNNER_ASSERT_MSG_BT(sample >= 0, "Unable to open /etc/smack/test_smack_rules");
+ RUNNER_ASSERT_ERRNO_MSG(sample >= 0, "Unable to open /etc/smack/test_smack_rules");
FdUniquePtr sample_ptr(&sample);
result = smack_accesses_add(rules_ptr.get(), "writer", "book", "rw");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
result = smack_accesses_add(rules_ptr.get(), "reader", "book", "wx");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
result = smack_accesses_add_modify(rules_ptr.get(), "reader", "book", "r", "wx");
- RUNNER_ASSERT_MSG_BT(0 == result, "Unable to modify smack rules");
+ RUNNER_ASSERT_MSG(0 == result, "Unable to modify smack rules");
result = smack_accesses_save(rules_ptr.get(), fd);
- RUNNER_ASSERT_MSG_BT(0 == result, "Unable to save smack_accesses instance in file");
+ RUNNER_ASSERT_MSG(0 == result, "Unable to save smack_accesses instance in file");
result = lseek(fd, 0, SEEK_SET);
- RUNNER_ASSERT_MSG_BT(result == 0, "lseek() error");
+ RUNNER_ASSERT_ERRNO_MSG(result == 0, "lseek() error");
result = smack_accesses_add_from_file(import_ptr.get(), fd);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to import rules from file");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to import rules from file");
result = smack_accesses_save(import_ptr.get(), tmp);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to save smack_accesses instance in file");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to save smack_accesses instance in file");
//comparing rules saved in file, restored from it and stored one more time
result = files_compare(fd, tmp);
- RUNNER_ASSERT_MSG_BT(result == 0, "No match in stored and restored rules");
+ RUNNER_ASSERT_MSG(result == 0, "No match in stored and restored rules");
//comparing rules stored in file with reference preinstalled rules
result = files_compare(tmp, sample);
- RUNNER_ASSERT_MSG_BT(result == 0, "No match in stored rules and pattern file");
+ RUNNER_ASSERT_MSG(result == 0, "No match in stored rules and pattern file");
}
RUNNER_TEST_SMACK(smack02_aplying_rules_into_kernel)
struct smack_accesses *rules = NULL; //rules prepared in this test case
int result; //for storing functions results
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
SmackAccessesPtr rules_ptr(rules);
//adding test rules to struct
result = smack_accesses_add(rules_ptr.get(), "writer", "book", "rwx");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
result = smack_accesses_add(rules_ptr.get(), "reader", "book", "r");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
result = smack_accesses_add(rules_ptr.get(), "spy", "book", "rwx");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
result = smack_accesses_apply(rules_ptr.get()); //applying rules to kernel
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to apply rules into kernel");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to apply rules into kernel");
//should have access - rule exist
result = smack_have_access("spy", "book", "rwx");
- RUNNER_ASSERT_MSG_BT(result == 1, "Error while checking Smack access");
+ RUNNER_ASSERT_MSG(result == 1, "Error while checking Smack access");
//should have no access - wrong rule, should be "r" only
result = smack_have_access("reader", "book", "rwx");
- RUNNER_ASSERT_MSG_BT(result == 0, "Error while checking Smack access");
+ RUNNER_ASSERT_MSG(result == 0, "Error while checking Smack access");
//should have no access - rule not exist
result = smack_have_access("s02badsubjectlabel", "book", "rwx");
- RUNNER_ASSERT_MSG_BT(result == 0, "Error while checking Smack access");
+ RUNNER_ASSERT_MSG(result == 0, "Error while checking Smack access");
//this subject do not exist in kernel rules
result = smack_revoke_subject("s02nonexistinglabel");
- RUNNER_ASSERT_MSG_BT(result == 0, "Error in removing not existing subject from kernel");
+ RUNNER_ASSERT_MSG(result == 0, "Error in removing not existing subject from kernel");
result = smack_revoke_subject("spy"); //this subject exist in kernel rules
- RUNNER_ASSERT_MSG_BT(result == 0, "Error in removing existing subject from kernel");
+ RUNNER_ASSERT_MSG(result == 0, "Error in removing existing subject from kernel");
//testing access after revoke_subject() from kernel
result = smack_have_access("spy", "book", "rwx");
//now spy should have no access
- RUNNER_ASSERT_MSG_BT(result == 0, "Error in acces aplied to kernel");
+ RUNNER_ASSERT_MSG(result == 0, "Error in acces aplied to kernel");
//for create new rule as a consequence of use accesses_clear() below
result = smack_accesses_add(rules_ptr.get(), "s02subjectlabel", "book", "rwx");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
//"spy" removed before by using smack_revoke_subject()
result = smack_accesses_clear(rules_ptr.get());
- RUNNER_ASSERT_MSG_BT(result == 0, "Error in clearing rules in kernel");
+ RUNNER_ASSERT_MSG(result == 0, "Error in clearing rules in kernel");
//testing acces after acces_clear()
result = smack_have_access("writer", "book", "rwx");
//now writer also should have no access
- RUNNER_ASSERT_MSG_BT(result == 0, "Error in acces aplied to kernel");
+ RUNNER_ASSERT_MSG(result == 0, "Error in acces aplied to kernel");
}
int result; //for storing functions results
int expected;
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
SmackAccessesPtr rules_ptr(rules);
//adding test rules with mixed string
(*rule)[0].c_str(),
"book",
(*rule)[1].c_str());
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
}
//clearing
//FIXME: Using clear() here can cover error in accesses_apply() function
//result = smack_accesses_clear(rules);
- //RUNNER_ASSERT_MSG_BT(result == 0, "Error in clearing rules in kernel");
+ //RUNNER_ASSERT_MSG(result == 0, "Error in clearing rules in kernel");
//applying rules to kernel
result = smack_accesses_apply(rules_ptr.get());
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to apply rules into kernel");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to apply rules into kernel");
//checking accesses using normal rules
for (auto rule=correct_rules.begin(); rule != correct_rules.end(); ++rule) {
result = smack_have_access((*rule)[0].c_str(),
"book",
(*rule)[2].c_str());
- RUNNER_ASSERT_MSG_BT(result == expected, "Error while checking Smack access");
+ RUNNER_ASSERT_MSG(result == expected, "Error while checking Smack access");
}
}
result = smack_have_access((*rule)[0].c_str(),
"book",
(*rule)[1].c_str());
- RUNNER_ASSERT_MSG_BT(result == expected, "Error while checking Smack access");
+ RUNNER_ASSERT_MSG(result == expected, "Error while checking Smack access");
}
}
const char *def_rule = "_";
result = smack_new_label_from_self(&label);
- RUNNER_ASSERT_MSG_BT(result >= 0, "Error in getting self label");
+ RUNNER_ASSERT_MSG(result >= 0, "Error in getting self label");
//comparing this label with default one "_"
result = strcmp(label, def_rule);
free(label);
- RUNNER_ASSERT_MSG_BT(result == 0, "Wrong default process label");
+ RUNNER_ASSERT_MSG(result == 0, "Wrong default process label");
//comparing this rule with received from /proc/self/attr/current
fd = open("/proc/self/attr/current", O_RDONLY, 0644);
- RUNNER_ASSERT_MSG_BT(fd >= 0, "Unable to open /proc/self/attr/current");
+ RUNNER_ASSERT_ERRNO_MSG(fd >= 0, "Unable to open /proc/self/attr/current");
FdUniquePtr fd_ptr(&fd);
result = read(fd, buff, B_SIZE);
- RUNNER_ASSERT_MSG_BT(result >= 0, "Error in reading from file /proc/self/attr/current");
+ RUNNER_ASSERT_ERRNO_MSG(result >= 0, "Error in reading from file /proc/self/attr/current");
result = strncmp(buff, def_rule, result);
- RUNNER_ASSERT_MSG_BT(result == 0, "Wrong default process rule");
+ RUNNER_ASSERT_MSG(result == 0, "Wrong default process rule");
//now time for setting labels:
result = smack_set_label_for_self("cola");
- RUNNER_ASSERT_MSG_BT(result == 0, "Error in setting self label");
+ RUNNER_ASSERT_MSG(result == 0, "Error in setting self label");
//checking new label using smack function
result = smack_new_label_from_self(&label);
- RUNNER_ASSERT_MSG_BT(result >= 0, "Error in getting self label");
+ RUNNER_ASSERT_MSG(result >= 0, "Error in getting self label");
result = strcmp(label, "cola");
free(label);
- RUNNER_ASSERT_MSG_BT(result == 0, "Wrong process label");
+ RUNNER_ASSERT_MSG(result == 0, "Wrong process label");
//checking new label using /proc/self/attr/current
result = lseek(fd, 0, SEEK_SET); //going to the file beginning
- RUNNER_ASSERT_MSG_BT(result == 0, "lseek() error");
+ RUNNER_ASSERT_ERRNO_MSG(result == 0, "lseek() error");
result = read(fd, buff, B_SIZE);
- RUNNER_ASSERT_MSG_BT(result >= 0, "Error in reading from file /proc/self/attr/current");
+ RUNNER_ASSERT_ERRNO_MSG(result >= 0, "Error in reading from file /proc/self/attr/current");
result = strncmp(buff, "cola", result);
- RUNNER_ASSERT_MSG_BT(result == 0, "Proces rule in /proc/self/attr/current other than set");
+ RUNNER_ASSERT_MSG(result == 0, "Proces rule in /proc/self/attr/current other than set");
}
RUNNER_TEST_SMACK(smack06_setlabel_getlabel_test_0)
for (i = 0; i < accessesBasic.size(); ++i)
{
// Creating rules
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
SmackAccessesPtr rules_ptr(rules);
// Adding accesses
result = smack_accesses_add(rules_ptr.get(), TEST_SUBJECT, TEST_OBJECT, accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add modify rulesBasic. Result: " << result);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to add modify rulesBasic. Result: " << result);
// Applying rules
result = smack_accesses_apply(rules_ptr.get());
- RUNNER_ASSERT_MSG_BT(result == 0, "Error while applying accesses. Result: " << result);
+ RUNNER_ASSERT_MSG(result == 0, "Error while applying accesses. Result: " << result);
// Checking if accesses were created
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT, accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack access. Result: " << result);
// Deleting all rules
for (i = 0; i < 3; ++i)
{
// --- Creating rules (r or w or x)
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
SmackAccessesPtr rules_ptr(rules);
// Adding accesses
result = smack_accesses_add(rules_ptr.get(), TEST_SUBJECT, TEST_OBJECT, accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add rulesBasic. Result: " << result);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to add rulesBasic. Result: " << result);
// Applying rules
result = smack_accesses_apply(rules_ptr.get());
- RUNNER_ASSERT_MSG_BT(result == 0, "Error while applying accesses. Result: " << result);
+ RUNNER_ASSERT_MSG(result == 0, "Error while applying accesses. Result: " << result);
// Checking if accesses were created
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT, accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack access. Result: " << result);
// Checking if wrong accesses were not created
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT, accessesBasic[i + 3].c_str());
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
" Error while checking smack access. Result: " << result);
// --- Modifying accesses (r for wx or w for rx or x for rw)
result = smack_accesses_add_modify(rules_ptr.get(),TEST_SUBJECT, TEST_OBJECT,
accessesBasic[i + 3].c_str(),accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add modify rulesBasic. Result: " << result);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to add modify rulesBasic. Result: " << result);
// Applying rules
result = smack_accesses_apply(rules_ptr.get());
- RUNNER_ASSERT_MSG_BT(result == 0, "Error while applying accesses. Result: " << result);
+ RUNNER_ASSERT_MSG(result == 0, "Error while applying accesses. Result: " << result);
// Checking if accesses were created
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT, accessesBasic[i + 3].c_str());
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack access. Result: " << result);
// Checking if wrong accesses were not created
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT, accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
" Error while checking smack access. Result: " << result);
rules_ptr.release();
// --- Creating complementary rules (r or w or x)
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
rules_ptr.reset(rules);
// Adding accesses
result = smack_accesses_add(rules_ptr.get(), TEST_SUBJECT, TEST_OBJECT,
accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add rulesBasic. Result: " << result);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to add rulesBasic. Result: " << result);
// Checking if accesses were created
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT, accessesBasic[i + 3].c_str());
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack access. Result: " << result);
// Applying rules
result = smack_accesses_apply(rules_ptr.get());
- RUNNER_ASSERT_MSG_BT(result == 0, "Error while applying accesses. Result: " << result);
+ RUNNER_ASSERT_MSG(result == 0, "Error while applying accesses. Result: " << result);
// Checking if accesses were created
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT, accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack access. Result: " << result);
// --- Modifying accesses (adding rwx and removing r or w or x)
result = smack_accesses_add_modify(rules_ptr.get(),TEST_SUBJECT, TEST_OBJECT,"rwx",
accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add modify rulesBasic. Result: " << result);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to add modify rulesBasic. Result: " << result);
// Applying rules
result = smack_accesses_apply(rules_ptr.get());
- RUNNER_ASSERT_MSG_BT(result == 0, "Error while applying accesses. Result: " << result);
+ RUNNER_ASSERT_MSG(result == 0, "Error while applying accesses. Result: " << result);
// Checking if accesses were created
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT, accessesBasic[i + 3].c_str());
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack access. Result: " << result);
// Checking if wrong accesses were not created
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT, accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
" Error while checking smack access. Result: " << result);
// --- Adding crossing accesses (rx or rw or wx)
result = smack_accesses_add_modify(rules_ptr.get(),TEST_SUBJECT, TEST_OBJECT,
accessesBasic[3 + ((i + 1) % 3)].c_str(),"");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add modify rulesBasic. Result: " << result);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to add modify rulesBasic. Result: " << result);
// Applying rules
result = smack_accesses_apply(rules_ptr.get());
- RUNNER_ASSERT_MSG_BT(result == 0, "Error while applying accesses. Result: " << result);
+ RUNNER_ASSERT_MSG(result == 0, "Error while applying accesses. Result: " << result);
// Checking if accesses were created
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,
accessesBasic[3 + ((i + 1) % 3)].c_str());
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack access. Result: " << result);
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT, "rwx");
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack access. Result: " << result);
// Deleting all rules
result = smack_accesses_add_modify(rules,TEST_SUBJECT, TEST_OBJECT,"","rwx");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add modify rulesBasic. Result: " << result);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to add modify rulesBasic. Result: " << result);
result = smack_accesses_apply(rules_ptr.get());
- RUNNER_ASSERT_MSG_BT(result == 0, "Error while checking smack access. Result: " << result);
+ RUNNER_ASSERT_MSG(result == 0, "Error while checking smack access. Result: " << result);
// Deleting all rules
clean_up();
// Pre-cleanup
removeAccessesAll();
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
SmackAccessesPtr rules_ptr(rules);
// Loading file with rwxat rules - test_smack_rules_full
fd = open("/etc/smack/test_smack_rules_full", O_RDONLY, 0644);
- RUNNER_ASSERT_MSG_BT(fd >= 0, "Unable to open /etc/smack/test_smack_rules_full");
+ RUNNER_ASSERT_ERRNO_MSG(fd >= 0, "Unable to open /etc/smack/test_smack_rules_full");
// Adding rules from file
result = smack_accesses_add_from_file(rules_ptr.get(), fd);
close(fd);
- RUNNER_ASSERT_MSG_BT(result == 0, "Error importing accesses from file");
+ RUNNER_ASSERT_MSG(result == 0, "Error importing accesses from file");
// Applying rules
result = smack_accesses_apply(rules_ptr.get());
- RUNNER_ASSERT_MSG_BT(result == 0, "Error while applying accesses. Result: " << result);
+ RUNNER_ASSERT_MSG(result == 0, "Error while applying accesses. Result: " << result);
// Checking rules
result = smack_have_access("test_subject_01", "test_object_02", "rwxat");
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack accesses.");
result = smack_have_access("test_subject_01", "test_object_03", "rwxat");
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack accesses.");
result = smack_have_access("test_subject_02", "test_object_01", "rwxat");
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack accesses.");
result = smack_have_access("test_subject_02", "test_object_02", "rwxat");
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack accesses.");
result = smack_have_access("test_subject_02", "test_object_03", "rwxat");
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack accesses.");
result = smack_have_access("test_subject_03", "test_object_01", "rwxat");
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack accesses.");
result = smack_have_access("test_subject_03", "test_object_02", "rwxat");
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack accesses.");
result = smack_have_access("test_subject_03", "test_object_03", "rwxat");
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack accesses.");
// Removing rules
// Creating rules
rules_ptr.release();
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
rules_ptr.reset(rules);
// Loading file with partial wrong rules - test_smack_rules2
fd = open("/etc/smack/test_smack_rules2", O_RDONLY, 0644);
- RUNNER_ASSERT_MSG_BT(fd >= 0, "Unable to open /etc/smack/test_smack_rules2");
+ RUNNER_ASSERT_ERRNO_MSG(fd >= 0, "Unable to open /etc/smack/test_smack_rules2");
// Adding rules from file
result = smack_accesses_add_from_file(rules_ptr.get(), fd);
close(fd);
- RUNNER_ASSERT_MSG_BT(result == 0, "Error importing accesses from file");
+ RUNNER_ASSERT_MSG(result == 0, "Error importing accesses from file");
// Applying rules
result = smack_accesses_apply(rules_ptr.get());
- RUNNER_ASSERT_MSG_BT(result == 0, "Error while applying accesses. Result: " << result);
+ RUNNER_ASSERT_MSG(result == 0, "Error while applying accesses. Result: " << result);
// Checking rules
- RUNNER_ASSERT_MSG_BT(checkNoAccesses("test_subject_01", "test_object_01"),
+ RUNNER_ASSERT_MSG(checkNoAccesses("test_subject_01", "test_object_01"),
" Error while checking smack access loaded from /etc/smack/test_smack_rules2. Accesses exist.");
result = smack_have_access("test_subject_01", "test_object_02", "rwatl");
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack access loaded from /etc/smack/test_smack_rules2. Result: " << result );
result = smack_have_access("test_subject_01", "test_object_03", "wat");
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack access loaded from /etc/smack/test_smack_rules2. Result: " << result );
- RUNNER_ASSERT_MSG_BT(checkNoAccesses("test_subject_02", "test_object_01"),
+ RUNNER_ASSERT_MSG(checkNoAccesses("test_subject_02", "test_object_01"),
" Error while checking smack access loaded from /etc/smack/test_smack_rules2. Accesses exist.");
result = smack_have_access("test_subject_02", "test_object_02", "wa-lt");
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack access loaded from /etc/smack/test_smack_rules2. Result: " << result );
result = smack_have_access("test_subject_02", "test_object_03", "wr");
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack access loaded from /etc/smack/test_smack_rules2. Result: " << result );
result = smack_have_access("test_subject_03", "test_object_01", "a");
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack access loaded from /etc/smack/test_smack_rules2. Result: " << result );
result = smack_have_access("test_subject_03", "test_object_02", "rwat");
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack access loaded from /etc/smack/test_smack_rules2. Result: " << result );
result = smack_have_access("test_subject_03", "test_object_03", "w---l-");
- RUNNER_ASSERT_MSG_BT(result == 1,
+ RUNNER_ASSERT_MSG(result == 1,
" Error while checking smack access loaded from /etc/smack/test_smack_rules2. Result: " << result );
// Removing rules
// Creating rules
rules_ptr.release();
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
rules_ptr.reset(rules);
// Loading file with partial wrong rules - test_smack_rules3
fd = open("/etc/smack/test_smack_rules3", O_RDONLY, 0644);
- RUNNER_ASSERT_MSG_BT(fd >= 0, "Unable to open /etc/smack/test_smack_rules3");
+ RUNNER_ASSERT_ERRNO_MSG(fd >= 0, "Unable to open /etc/smack/test_smack_rules3");
// Adding rules from file
result = smack_accesses_add_from_file(rules_ptr.get(), fd);
close(fd);
- RUNNER_ASSERT_MSG_BT(result != 0, "Accesses were loaded from file");
+ RUNNER_ASSERT_MSG(result != 0, "Accesses were loaded from file");
// Removing rules
removeAccessesAll();
// Creating rules
rules_ptr.release();
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
rules_ptr.reset(rules);
// Loading file with partial wrong rules - test_smack_rules4
fd = open("/etc/smack/test_smack_rules4", O_RDONLY, 0644);
- RUNNER_ASSERT_MSG_BT(fd >= 0, "Unable to open /etc/smack/test_smack_rules4");
+ RUNNER_ASSERT_ERRNO_MSG(fd >= 0, "Unable to open /etc/smack/test_smack_rules4");
// Adding rules from file
result = smack_accesses_add_from_file(rules_ptr.get(), fd);
close(fd);
- RUNNER_ASSERT_MSG_BT(result != 0, "Accesses were loaded from file");
+ RUNNER_ASSERT_MSG(result != 0, "Accesses were loaded from file");
// Removing rules
removeAccessesAll();
std::string smack_label("s" + std::to_string(number));
int result = smack_set_label_for_self(smack_label.c_str());
- RUNNER_ASSERT_MSG_BT(result == 0, "smack_set_label_for_self(" << smack_label << ") failed");
+ RUNNER_ASSERT_MSG(result == 0, "smack_set_label_for_self(" << smack_label << ") failed");
}
static void smack_unix_sock_server(int sock)
alarm(2);
fd = accept(sock, NULL, NULL);
alarm(0);
- RUNNER_ASSERT_BT(fd >= 0);
+ RUNNER_ASSERT_ERRNO(fd >= 0);
FdUniquePtr fd_ptr(&fd);
result = smack_new_label_from_self(&label);
- RUNNER_ASSERT_MSG_BT(result >= 0, "smack_new_label_from_self() failed");
+ RUNNER_ASSERT_MSG(result >= 0, "smack_new_label_from_self() failed");
CStringPtr label_ptr(label);
result = write(fd, label, strlen(label));
- RUNNER_ASSERT_MSG_BT(result == (int)strlen(label), "write() failed");
+ RUNNER_ASSERT_ERRNO_MSG(result == (int)strlen(label), "write() failed");
}
unlink(SOCK_PATH);
smack_set_another_label_for_self();
pid = fork();
- RUNNER_ASSERT_MSG_BT(pid >= 0, "Fork failed");
+ RUNNER_ASSERT_ERRNO_MSG(pid >= 0, "Fork failed");
if (!pid) { /* child process, server */
int sock, result;
sock = socket(AF_UNIX, SOCK_STREAM, 0);
- RUNNER_ASSERT_MSG_BT(sock >= 0, "socket failed: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(sock >= 0, "socket failed");
SockUniquePtr sock_ptr(&sock);
result = bind(sock, (struct sockaddr*) &sockaddr, sizeof(struct sockaddr_un));
- RUNNER_ASSERT_MSG_BT(result == 0, "bind failed: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(result == 0, "bind failed");
result = listen(sock, 1);
- RUNNER_ASSERT_MSG_BT(result == 0, "listen failed: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(result == 0, "listen failed");
smack_unix_sock_server(sock);
pid = fork();
- RUNNER_ASSERT_MSG_BT(pid >= 0, "Fork failed");
+ RUNNER_ASSERT_ERRNO_MSG(pid >= 0, "Fork failed");
/* Test if socket label was unaffected by fork() */
smack_unix_sock_server(sock);
if (!pid) {
char *smack_label2;
sock = socket(AF_UNIX, SOCK_STREAM, 0);
- RUNNER_ASSERT_MSG_BT(sock >= 0, "socket failed: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(sock >= 0, "socket failed");
SockUniquePtr sock_ptr(&sock);
result = connect(sock, (struct sockaddr*) &sockaddr, sizeof(struct sockaddr_un));
- RUNNER_ASSERT_MSG_BT(result == 0, "connect failed: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(result == 0, "connect failed");
alarm(2);
result = read(sock, smack_label1, SMACK_LABEL_LEN);
alarm(0);
- RUNNER_ASSERT_MSG_BT(result >= 0, "read failed: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(result >= 0, "read failed");
smack_label1[result] = '\0';
result = smack_new_label_from_socket(sock, &smack_label2);
SmackLabelPtr label2_ptr(smack_label2);
- RUNNER_ASSERT_MSG_BT(result >= 0, "smack_label_from_socket failed");
+ RUNNER_ASSERT_MSG(result >= 0, "smack_label_from_socket failed");
result = strcmp(smack_label1, label2_ptr.get());
if (i < 3)
- RUNNER_ASSERT_MSG_BT(result == 0, "smack labels differ: '" << smack_label1
+ RUNNER_ASSERT_MSG(result == 0, "smack labels differ: '" << smack_label1
<< "' != '" << smack_label2 << "' i == " << i);
else
- RUNNER_ASSERT_MSG_BT(result != 0, "smack labels do not differ: '" << smack_label1
+ RUNNER_ASSERT_MSG(result != 0, "smack labels do not differ: '" << smack_label1
<< "' != '" << smack_label2 << "' i == " << i);
}
}
int fd = open(filePath.c_str(), O_RDWR | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
//restore system mask
umask(systemMask);
- RUNNER_ASSERT_MSG_BT(fd > -1, "Unable to create file for tests: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(fd > -1, "Unable to create file for tests");
//for descriptor protection
FdUniquePtr fd_ptr(&fd);
//change owner and group to user APP
int ret = chown(filePath.c_str(), APP_UID, APP_GID);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Unable to change file owner: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "Unable to change file owner");
//set smack label on file
ret = smack_setlabel(filePath.c_str(), fileLabel.c_str(), SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Unable to set label for file: " << ret);
+ RUNNER_ASSERT_MSG(ret == 0, "Unable to set label for file: " << ret);
char *label = NULL;
ret = smack_getlabel(filePath.c_str(), &label, SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Unable to get label from file");
+ RUNNER_ASSERT_MSG(ret == 0, "Unable to get label from file");
std::string label_str(label ? label : "");
free(label);
- RUNNER_ASSERT_MSG_BT(label_str == fileLabel, "File label not match set label");
+ RUNNER_ASSERT_MSG(label_str == fileLabel, "File label not match set label");
}
void prepareEnvironment(const std::string &subject, const std::string &object, const std::string &access)
provider.apply();
int ret = smack_have_access(selfLabel.c_str(), filename.c_str(), "l");
- RUNNER_ASSERT_MSG_BT(ret == 1, "Error in adding laccess rule - l");
+ RUNNER_ASSERT_MSG(ret == 1, "Error in adding laccess rule - l");
}
//- Create file
provider.applyAndSwithToUser(APP_UID, APP_GID);
int ret = flock(fd, LOCK_EX | LOCK_NB);
- RUNNER_ASSERT_MSG_BT(ret < 0, "Error, able to lock file: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret < 0, "Error, able to lock file");
ret = flock(fd, LOCK_UN | LOCK_NB);
- RUNNER_ASSERT_MSG_BT(ret < 0, "Error, able to lock file: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret < 0, "Error, able to lock file");
ret = flock(fd, LOCK_SH | LOCK_NB);
- RUNNER_ASSERT_MSG_BT(ret < 0, "Error, able to lock file: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret < 0, "Error, able to lock file");
}
//- Create file
prepareEnvironment(selfLabel, filename, "l");
int ret = flock(fd, LOCK_EX | LOCK_NB);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to exclusive lock file: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "Error, unable to exclusive lock file");
ret = flock(fd, LOCK_UN | LOCK_NB);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to unlock file: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "Error, unable to unlock file");
ret = flock(fd, LOCK_SH | LOCK_NB);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to shared lock file: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "Error, unable to shared lock file");
}
//- Create file
prepareEnvironment(selfLabel, filename, "w");
int ret = flock(fd, LOCK_EX | LOCK_NB);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to exclusive lock file: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "Error, unable to exclusive lock file");
ret = flock(fd, LOCK_UN | LOCK_NB);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to unlock file: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "Error, unable to unlock file");
ret = flock(fd, LOCK_SH | LOCK_NB);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to shared lock file: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "Error, unable to shared lock file");
}
//- Create file
int fd = open(filePath.c_str(), O_RDWR);
FdUniquePtr fd_ptr(&fd);
int ret = flock(fd, LOCK_SH | LOCK_NB);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to shared lock file: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "Error, unable to shared lock file");
pid_t pid = fork();
if (pid == 0) {
prepareEnvironment(selfLabel, filename, "rw");
int child_fd = open(filePath.c_str(), O_RDWR);
- RUNNER_ASSERT_MSG_BT(child_fd > -1, "Unable to open created file: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(child_fd > -1, "Unable to open created file");
//for descriptor protection
FdUniquePtr child_fd_ptr(&child_fd);
ret = flock(child_fd, LOCK_SH | LOCK_NB);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to lock file with shared lock: "
- << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "Error, unable to lock file with shared lock");
}
}
int fd = open(filePath.c_str(), O_RDWR);
FdUniquePtr fd_str(&fd);
int ret = flock(fd, LOCK_SH | LOCK_NB);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to shared lock file: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "Error, unable to shared lock file");
pid_t pid = fork();
if (pid == 0) {
prepareEnvironment(selfLabel, filename, "rl");
int child_fd = open(filePath.c_str(), O_RDONLY, 0);
- RUNNER_ASSERT_MSG_BT(child_fd > -1, "Unable to open created file: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(child_fd > -1, "Unable to open created file");
//for descriptor protection
FdUniquePtr child_fd_ptr(&child_fd);
ret = flock(child_fd, LOCK_SH | LOCK_NB);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to lock file with shared lock: "
- << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "Error, unable to lock file with shared lock");
}
}
int fd = open(filePath.c_str(), O_RDWR);
FdUniquePtr fd_ptr(&fd);
int ret = flock(fd, LOCK_EX | LOCK_NB);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to exclusive lock file: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "Error, unable to exclusive lock file");
pid_t pid = fork();
if (pid == 0) {
prepareEnvironment(selfLabel, filename, "rw");
int child_fd = open(filePath.c_str(), O_RDWR, 0);
- RUNNER_ASSERT_MSG_BT(child_fd > -1, "Unable to open created file: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(child_fd > -1, "Unable to open created file");
//for descriptor protection
FdUniquePtr child_fd_ptr(&child_fd);
ret = flock(child_fd, LOCK_EX | LOCK_NB);
- RUNNER_ASSERT_MSG_BT(ret < 0, "Error, able to lock file with exclusive lock");
+ RUNNER_ASSERT_ERRNO_MSG(ret < 0, "Error, able to lock file with exclusive lock");
}
}
int fd = open(filePath.c_str(), O_RDWR, 0);
FdUniquePtr fd_ptr(&fd);
int ret = flock(fd, LOCK_EX | LOCK_NB);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to exclusive lock file: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "Error, unable to exclusive lock file");
pid_t pid = fork();
if (pid == 0) {
prepareEnvironment(selfLabel, filename, "rl");
int child_fd = open(filePath.c_str(), O_RDONLY, 0);
- RUNNER_ASSERT_MSG_BT(child_fd > -1, "Unable to open created file: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(child_fd > -1, "Unable to open created file");
//for descriptor protection
FdUniquePtr child_fd_ptr(&child_fd);
ret = flock(child_fd, LOCK_EX | LOCK_NB);
- RUNNER_ASSERT_MSG_BT(ret < 0, "Error, able to lock file with eclusive lock");
+ RUNNER_ASSERT_ERRNO_MSG(ret < 0, "Error, able to lock file with eclusive lock");
}
}
int result;
//init rules
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
//pass rules to unique_ptr
SmackAccessesPtr rules_ptr(rules);
//adding test rules to struct (same as SMACK version of smack02 test)
result = smack_accesses_add(rules_ptr.get(), "writer", "book", "rwx");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
result = smack_accesses_add(rules_ptr.get(), "reader", "book", "r");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
result = smack_accesses_add(rules_ptr.get(), "spy", "book", "rwx");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
//applying rules to kernel (should fail)
result = smack_accesses_apply(rules_ptr.get());
- RUNNER_ASSERT_MSG_BT(result == -1, "Unable to apply rules into kernel");
+ RUNNER_ASSERT_MSG(result == -1, "Unable to apply rules into kernel");
//calls from SMACK version of this test - all should fail because of SMACK being turned off
result = smack_have_access("spy", "book", "rwx");
- RUNNER_ASSERT_MSG_BT(result == -1, "smack_have_access should return error (SMACK is off)");
+ RUNNER_ASSERT_MSG(result == -1, "smack_have_access should return error (SMACK is off)");
result = smack_have_access("reader", "book", "rwx");
- RUNNER_ASSERT_MSG_BT(result == -1, "smack_have_access should return error (SMACK is off)");
+ RUNNER_ASSERT_MSG(result == -1, "smack_have_access should return error (SMACK is off)");
result = smack_have_access("s02badsubjectlabel", "book", "rwx");
- RUNNER_ASSERT_MSG_BT(result == -1, "smack_have_access should return error (SMACK is off)");
+ RUNNER_ASSERT_MSG(result == -1, "smack_have_access should return error (SMACK is off)");
//testing subject revoking - should return error (no accesses applied = no subjects to revoke)
result = smack_revoke_subject("s02nonexistinglabel");
- RUNNER_ASSERT_MSG_BT(result == -1, "smack_revoke_subject error - subject doesn't exist.");
+ RUNNER_ASSERT_MSG(result == -1, "smack_revoke_subject error - subject doesn't exist.");
result = smack_revoke_subject("spy");
- RUNNER_ASSERT_MSG_BT(result == -1, "smack_revoke_subject error - subject doesn't exist.");
+ RUNNER_ASSERT_MSG(result == -1, "smack_revoke_subject error - subject doesn't exist.");
//after revoking smack_have_access still should return error
result = smack_have_access("spy", "book", "rwx");
- RUNNER_ASSERT_MSG_BT(result == -1, "smack_have_access should return error (SMACK is off).");
+ RUNNER_ASSERT_MSG(result == -1, "smack_have_access should return error (SMACK is off).");
result = smack_accesses_add(rules_ptr.get(), "s02subjectlabel", "book", "rwx");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
//smack_accesses_clear should return error aswell
result = smack_accesses_clear(rules_ptr.get());
- RUNNER_ASSERT_MSG_BT(result == -1, "Clearing rules should return error - no SMACK on system.");
+ RUNNER_ASSERT_MSG(result == -1, "Clearing rules should return error - no SMACK on system.");
result = smack_have_access("writer", "book", "rwx");
- RUNNER_ASSERT_MSG_BT(result == -1, "smack_have_access should return error (SMACK is off).");
+ RUNNER_ASSERT_MSG(result == -1, "smack_have_access should return error (SMACK is off).");
}
/**
smack_accesses* tmp = NULL;
- RUNNER_ASSERT_BT(smack_accesses_new(&tmp) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&tmp) == 0);
SmackAccessesPtr rules(tmp);
//open file with rules
fd = open("/etc/smack/test_smack_rules_full", O_RDONLY, 0644);
- RUNNER_ASSERT_MSG_BT(fd >= 0,
- "Unable to open /etc/smack/test_smack_rules_full. Errno: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(fd >= 0, "Unable to open /etc/smack/test_smack_rules_full");
//load accesses from file
result = smack_accesses_add_from_file(rules.get(), fd);
close(fd);
- RUNNER_ASSERT_MSG_BT(result == 0, "Error while importing accesses from file. Result: " << result);
+ RUNNER_ASSERT_MSG(result == 0, "Error while importing accesses from file. Result: " << result);
}
/**
//smack_new_label_from_self should fail
result = smack_new_label_from_self(&label);
- RUNNER_ASSERT_MSG_BT(result == -1, "new_label_from_self should return error (SMACK is off).");
- RUNNER_ASSERT_MSG_BT(label == NULL, "new_label_from_self shouldn't allocate memory to label.");
+ RUNNER_ASSERT_MSG(result == -1, "new_label_from_self should return error (SMACK is off).");
+ RUNNER_ASSERT_MSG(label == NULL, "new_label_from_self shouldn't allocate memory to label.");
//We don't need to remember about freeing label - smack_new_label_from_self must return NULL
//label if it's working properly.
// /proc/self/attr/current shouldn't keep any rules inside
fd = open("/proc/self/attr/current", O_RDONLY, 0644); //file exists, so it should open
- RUNNER_ASSERT_MSG_BT(fd >= 0, "/proc/self/attr/current failed to open.");
+ RUNNER_ASSERT_ERRNO_MSG(fd >= 0, "/proc/self/attr/current failed to open");
FdUniquePtr fd_ptr(&fd);
result = read(fd, buff, SMACK_LABEL_LEN); //however reading it should return error
- RUNNER_ASSERT_MSG_BT(result < 0, "Reading /proc/self/attr/current should return error.");
+ RUNNER_ASSERT_ERRNO_MSG(result < 0, "Reading /proc/self/attr/current should return error");
//setting label for self should fail
result = smack_set_label_for_self("s04testlabel");
- RUNNER_ASSERT_MSG_BT(result == -1, "set_label_for_self should return error (SMACK is off).");
+ RUNNER_ASSERT_MSG(result == -1, "set_label_for_self should return error (SMACK is off).");
//getting previously set label should also fail
result = smack_new_label_from_self(&label);
- RUNNER_ASSERT_MSG_BT(result == -1, "new_label_from_self should return error (SMACK is off).");
- RUNNER_ASSERT_MSG_BT(label == NULL, "new_label_from_self shouldn't allocate memory to label.");
+ RUNNER_ASSERT_MSG(result == -1, "new_label_from_self should return error (SMACK is off).");
+ RUNNER_ASSERT_MSG(label == NULL, "new_label_from_self shouldn't allocate memory to label.");
// /proc/self/attr/current still shouldn't keep any rules inside
result = lseek(fd, 0, SEEK_SET); //going to the file beginning
- RUNNER_ASSERT_MSG_BT(result == 0, "lseek() error.");
+ RUNNER_ASSERT_ERRNO_MSG(result == 0, "lseek() error");
result = read(fd, buff, SMACK_LABEL_LEN); //however it should return error
- RUNNER_ASSERT_MSG_BT(result < 0, "Reading /proc/self/attr/current should return error.");
+ RUNNER_ASSERT_ERRNO_MSG(result < 0, "Reading /proc/self/attr/current should return error");
}
/**
int result;
smack_accesses* rules = NULL;
- RUNNER_ASSERT_BT(smack_accesses_new(&rules) == 0);
+ RUNNER_ASSERT(smack_accesses_new(&rules) == 0);
SmackAccessesPtr rules_ptr(rules);
//rule struct and removal of currenctly added and applied rules. clean_up() must be done only
//after smack_accesses_apply().
result = smack_accesses_add_modify(rules_ptr.get(), TEST_SUBJECT, TEST_OBJECT, "rwx", "");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule. Result: " << result);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule. Result: " << result);
result = smack_accesses_add_modify(rules_ptr.get(), TEST_SUBJECT, TEST_OBJECT, "rwx", "");
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule. Result: " << result);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule. Result: " << result);
result = smack_accesses_apply(rules_ptr.get());
- RUNNER_ASSERT_MSG_BT(result == -1,
+ RUNNER_ASSERT_MSG(result == -1,
"smack_accesses_apply should return error (SMACK is off). Result: " << result);
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT, "rwx");
if(result != -1) {
clean_up();
- RUNNER_ASSERT_MSG_BT(false,
- "smack_have_access should return error (SMACK is off). Result: " << result);
+ RUNNER_FAIL_MSG("smack_have_access should return error (SMACK is off). Result: "
+ << result);
}
clean_up();
char* smack_label;
pid = fork();
- RUNNER_ASSERT_MSG_BT(pid >= 0, "Fork failed");
+ RUNNER_ASSERT_ERRNO_MSG(pid >= 0, "Fork failed");
if (!pid) { //child (server)
int sock, result;
int fd;
//Create new socket
sock = socket(AF_UNIX, SOCK_STREAM, 0);
- RUNNER_ASSERT_MSG_BT(sock >= 0, "socket failed: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(sock >= 0, "socket failed");
SockUniquePtr sock_ptr(&sock);
//Bind it to sockaddr
result = bind(sock, (struct sockaddr*) &sockaddr, sizeof(struct sockaddr_un));
- RUNNER_ASSERT_MSG_BT(result == 0, "bind failed: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(result == 0, "bind failed");
//Prepare for listening
result = listen(sock, 1);
- RUNNER_ASSERT_MSG_BT(result == 0, "listen failed: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(result == 0, "listen failed");
//Accept client
alarm(2);
fd = accept(sock, NULL, NULL);
alarm(0);
- RUNNER_ASSERT_MSG_BT(fd >= 0, "Failed when accepting connection from client.");
+ RUNNER_ASSERT_ERRNO_MSG(fd >= 0, "Failed when accepting connection from client");
FdUniquePtr fd_ptr(&fd);
//wait for smack_new_label_from_socket execution
//Create socket
sock = socket(AF_UNIX, SOCK_STREAM, 0);
+ RUNNER_ASSERT_ERRNO_MSG(sock >= 0, "socket failed");
SockUniquePtr sock_ptr(&sock);
- RUNNER_ASSERT_MSG_BT(sock >= 0, "socket failed: " << strerror(errno));
//Connect to sockaddr
result = connect(sock, (struct sockaddr*) &sockaddr,
sizeof(struct sockaddr_un));
- RUNNER_ASSERT_MSG_BT(result == 0, "connect failed: " << strerror(errno));
+ RUNNER_ASSERT_ERRNO_MSG(result == 0, "connect failed");
//Try getting label, should fail beacuse getsockopt won't get anything
result = smack_new_label_from_socket(sock, &smack_label);
- RUNNER_ASSERT_MSG_BT(result == -1, "smack_new_label_from_socket should fail.");
+ RUNNER_ASSERT_MSG(result == -1, "smack_new_label_from_socket should fail.");
}
}
if (!m_base.is_open())
m_base.open();
- RUNNER_ASSERT_MSG_BT(!app_name.empty(), "Request is corrupted, appId is empty");
- RUNNER_ASSERT_MSG_BT(!pkg_name.empty(), "Request is corrupted, pkgId is empty");
+ RUNNER_ASSERT_MSG(!app_name.empty(), "Request is corrupted, appId is empty");
+ RUNNER_ASSERT_MSG(!pkg_name.empty(), "Request is corrupted, pkgId is empty");
check_app_and_pkg(app_name, pkg_name, NOT_REMOVED);
if (!m_base.is_open())
m_base.open();
- RUNNER_ASSERT_MSG_BT(!app_name.empty(), "Request is corrupted, appId is empty");
- RUNNER_ASSERT_MSG_BT(!pkg_name.empty(), "Request is corrupted, pkgId is empty");
+ RUNNER_ASSERT_MSG(!app_name.empty(), "Request is corrupted, appId is empty");
+ RUNNER_ASSERT_MSG(!pkg_name.empty(), "Request is corrupted, pkgId is empty");
check_app_and_pkg(app_name, pkg_name, REMOVED);
check_pkg(pkg_name, is_pkg_removed);
{
bool result;
- RUNNER_ASSERT_MSG_BT(!app_name.empty(), "Request is corrupted, appId is empty");
- RUNNER_ASSERT_MSG_BT(!pkg_name.empty(), "Request is corrupted, pkgId is empty");
+ RUNNER_ASSERT_MSG(!app_name.empty(), "Request is corrupted, appId is empty");
+ RUNNER_ASSERT_MSG(!pkg_name.empty(), "Request is corrupted, pkgId is empty");
for (auto it = privileges.begin(); it != privileges.end(); ++it) {
result = check_privilege(app_name, pkg_name, *it);
- RUNNER_ASSERT_MSG_BT(result == true, "privilege: <" << *it << "> not added to app: <" <<
+ RUNNER_ASSERT_MSG(result == true, "privilege: <" << *it << "> not added to app: <" <<
app_name << "> from pkg_id: <" << pkg_name << ">");
}
}
{
bool result;
- RUNNER_ASSERT_MSG_BT(!app_name.empty(), "Request is corrupted, appId is empty");
- RUNNER_ASSERT_MSG_BT(!pkg_name.empty(), "Request is corrupted, pkgId is empty");
+ RUNNER_ASSERT_MSG(!app_name.empty(), "Request is corrupted, appId is empty");
+ RUNNER_ASSERT_MSG(!pkg_name.empty(), "Request is corrupted, pkgId is empty");
for (auto it = privileges.begin(); it != privileges.end(); ++it) {
result = check_privilege(app_name, pkg_name, *it);
- RUNNER_ASSERT_MSG_BT(result == false, "privilege: <" << *it << "> not removed for app: <" <<
+ RUNNER_ASSERT_MSG(result == false, "privilege: <" << *it << "> not removed for app: <" <<
app_name << "> from pkg_id: <" << pkg_name << ">");
}
}
m_base.execute(sql.str(), result);
if (is_app_removed) /* expect 0 results */
- RUNNER_ASSERT_MSG_BT(result.rows.size() == 0, "query : <" << sql.str() <<
+ RUNNER_ASSERT_MSG(result.rows.size() == 0, "query : <" << sql.str() <<
"> returned [" << result.rows.size() << "] rows, expected [0]");
else /* expect exactly 1 result with 2 columns */
- RUNNER_ASSERT_MSG_BT(result.rows.size() == 1 && result.rows[0].size() == 2, "query : <" <<
+ RUNNER_ASSERT_MSG(result.rows.size() == 1 && result.rows[0].size() == 2, "query : <" <<
sql.str() << "> returned [" << result.rows.size() << "] rows, expected [1]");
}
" WHERE name == '" << pkg_name << "' ;";
m_base.execute(sql.str(), result);
- RUNNER_ASSERT_MSG_BT(result.rows.size() == expected_rows, "query : <" <<
+ RUNNER_ASSERT_MSG(result.rows.size() == expected_rows, "query : <" <<
sql.str() << "> returned [" << result.rows.size() << "] rows, expected [" <<
expected_rows << "] rows");
}
m_base.execute(sql.str(), result);
/* only 0 or 1 resulting rows are alowed */
- RUNNER_ASSERT_MSG_BT(result.rows.size() == 0 || result.rows.size() == 1, "query : <" << sql.str() << "> returned [" <<
+ RUNNER_ASSERT_MSG(result.rows.size() == 0 || result.rows.size() == 1, "query : <" << sql.str() << "> returned [" <<
result.rows.size() << "] rows");
return result.rows.size() == 1;
return false;
target = realpath(fpath, NULL);
- RUNNER_ASSERT_MSG_BT(target != 0, "Could not obtain real path from link.");
+ RUNNER_ASSERT_ERRNO_MSG(target != 0, "Could not obtain real path from link");
ret = stat(target, &buf);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Could not obtain real path's stat from link.");
+ RUNNER_ASSERT_ERRNO_MSG(ret == 0, "Could not obtain real path's stat from link");
if (buf.st_mode != (buf.st_mode | S_IXUSR | S_IFREG))
return false;
/* ACCESS */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path");
+ RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
labelPtr.reset(label);
- RUNNER_ASSERT_MSG_BT(label != NULL, "ACCESS label on " << fpath << " is not set");
+ RUNNER_ASSERT_MSG(label != NULL, "ACCESS label on " << fpath << " is not set");
result = strcmp(correctLabel, label);
- RUNNER_ASSERT_MSG_BT(result == 0, "ACCESS label on " << fpath << " is incorrect"
+ RUNNER_ASSERT_MSG(result == 0, "ACCESS label on " << fpath << " is incorrect"
" (should be '" << correctLabel << "' and is '" << label << "')");
/* EXEC */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_EXEC);
- RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path");
+ RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
labelPtr.reset(label);
if (S_ISREG(sb->st_mode) && (sb->st_mode & S_IXUSR) && exec_test) {
- RUNNER_ASSERT_MSG_BT(label != NULL, "EXEC label on " << fpath << " is not set");
+ RUNNER_ASSERT_MSG(label != NULL, "EXEC label on " << fpath << " is not set");
result = strcmp(correctLabel, label);
- RUNNER_ASSERT_MSG_BT(result == 0, "Incorrect EXEC label on executable file " << fpath);
+ RUNNER_ASSERT_MSG(result == 0, "Incorrect EXEC label on executable file " << fpath);
} else
- RUNNER_ASSERT_MSG_BT(label == NULL, "EXEC label on " << fpath << " is set");
+ RUNNER_ASSERT_MSG(label == NULL, "EXEC label on " << fpath << " is set");
/* LINK TO EXEC */
if (isLinkToExec(fpath, sb) && exec_test) {
char buf[SMACK_LABEL_LEN+1];
result = lgetxattr(fpath, XATTR_NAME_TIZENEXEC, buf, sizeof(buf));
- RUNNER_ASSERT_MSG_BT(result != -1, "Could not get label for the path "
- << fpath << "("<<strerror(errno)<<")");
+ RUNNER_ASSERT_ERRNO_MSG(result != -1, "Could not get label for the path " << fpath);
buf[result]='\0';
result = strcmp(correctLabel, buf);
- RUNNER_ASSERT_MSG_BT(result == 0, "Incorrect TIZEN_EXEC_LABEL attribute"
+ RUNNER_ASSERT_MSG(result == 0, "Incorrect TIZEN_EXEC_LABEL attribute"
" on link to executable " << fpath);
}
/* TRANSMUTE */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_TRANSMUTE);
- RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path");
+ RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
labelPtr.reset(label);
if (S_ISDIR(sb->st_mode) && transmute_test == true) {
- RUNNER_ASSERT_MSG_BT(label != NULL, "TRANSMUTE label on " << fpath << " is not set at all");
- RUNNER_ASSERT_MSG_BT(strcmp(label,"TRUE") == 0,
+ RUNNER_ASSERT_MSG(label != NULL, "TRANSMUTE label on " << fpath << " is not set at all");
+ RUNNER_ASSERT_MSG(strcmp(label,"TRUE") == 0,
"TRANSMUTE label on " << fpath << " is not set properly: '"<<label<<"'");
} else {
- RUNNER_ASSERT_MSG_BT(label == NULL, "TRANSMUTE label on " << fpath << " is set");
+ RUNNER_ASSERT_MSG(label == NULL, "TRANSMUTE label on " << fpath << " is set");
}
return 0;
app_inst_req *req = NULL;
result = security_manager_app_inst_req_new(&req);
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"creation of new request failed. Result: " << result);
- RUNNER_ASSERT_MSG_BT(req != NULL, "creation of new request did not allocate memory");
+ RUNNER_ASSERT_MSG(req != NULL, "creation of new request did not allocate memory");
return req;
}
int result;
result = nftw(SM_PRIVATE_PATH, &nftw_remove_labels, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to clean Smack labels in " << SM_PRIVATE_PATH);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to clean Smack labels in " << SM_PRIVATE_PATH);
result = nftw(SM_PUBLIC_PATH, &nftw_remove_labels, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to clean Smack labels in " << SM_PUBLIC_PATH);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to clean Smack labels in " << SM_PUBLIC_PATH);
result = nftw(SM_PUBLIC_RO_PATH, &nftw_remove_labels, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to clean Smack labels in " << SM_PUBLIC_RO_PATH);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to clean Smack labels in " << SM_PUBLIC_RO_PATH);
result = nftw(SM_DENIED_PATH, &nftw_set_labels_non_app_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to set Smack labels in " << SM_DENIED_PATH);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to set Smack labels in " << SM_DENIED_PATH);
}
static void prepare_app_env()
int result;
result = nftw(SM_PRIVATE_PATH, &nftw_check_sm_labels_app_private_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to check Smack labels for " << SM_PRIVATE_PATH);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to check Smack labels for " << SM_PRIVATE_PATH);
result = nftw(SM_PUBLIC_PATH, &nftw_check_sm_labels_app_public_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to check Smack labels for " << SM_PUBLIC_PATH);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to check Smack labels for " << SM_PUBLIC_PATH);
result = nftw(SM_PUBLIC_RO_PATH, &nftw_check_sm_labels_app_floor_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to check Smack labels for " << SM_PUBLIC_RO_PATH);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to check Smack labels for " << SM_PUBLIC_RO_PATH);
result = nftw(SM_DENIED_PATH, &nftw_check_labels_non_app_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG_BT(result == 0, "Unable to check Smack labels for " << SM_DENIED_PATH);
+ RUNNER_ASSERT_MSG(result == 0, "Unable to check Smack labels for " << SM_DENIED_PATH);
}
request.reset(do_app_inst_req_new());
result = security_manager_app_inst_req_set_app_id(request.get(), app_id);
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"setting app id failed. Result: " << result);
result = security_manager_app_inst_req_set_pkg_id(request.get(), pkg_id);
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"setting pkg id failed. Result: " << result);
result = security_manager_app_install(request.get());
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"installing app failed. Result: " << result);
check_app_after_install(app_id, pkg_id);
request.reset(do_app_inst_req_new());
result = security_manager_app_inst_req_set_app_id(request.get(), app_id);
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"setting app id failed. Result: " << result);
result = security_manager_app_uninstall(request.get());
- RUNNER_ASSERT_MSG_BT(!expect_installed || (lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG(!expect_installed || (lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"uninstalling app failed. Result: " << result);
check_app_after_uninstall(app_id, pkg_id, expect_pkg_removed);
request.reset(do_app_inst_req_new());
result = security_manager_app_inst_req_set_app_id(request.get(), SM_APP_ID1);
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"setting app id failed. Result: " << result);
result = security_manager_app_inst_req_set_pkg_id(request.get(), SM_PKG_ID1);
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"setting pkg id failed. Result: " << result);
result = security_manager_app_install(request.get());
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"installing app failed. Result: " << result);
result = security_manager_app_install(request.get());
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"installing already installed app failed. Result: " << result);
/* Check records in the security-manager database */
request.reset(do_app_inst_req_new());
result = security_manager_app_inst_req_set_app_id(request.get(), SM_APP_ID1);
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"setting app id failed. Result: " << result);
result = security_manager_app_uninstall(request.get());
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"uninstalling app failed. Result: " << result);
result = security_manager_app_uninstall(request.get());
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"uninstalling already uninstalled app failed. Result: " << result);
/* Check records in the security-manager database */
request.reset(do_app_inst_req_new());
result = security_manager_app_inst_req_set_app_id(request.get(), SM_APP_ID2);
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"setting app id failed. Result: " << result);
result = security_manager_app_inst_req_set_pkg_id(request.get(), SM_PKG_ID2);
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"setting pkg id failed. Result: " << result);
result = security_manager_app_inst_req_add_privilege(request.get(), SM_ALLOWED_PRIVILEGES[0].c_str());
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"setting allowed permission failed. Result: " << result);
result = security_manager_app_inst_req_add_privilege(request.get(), SM_ALLOWED_PRIVILEGES[1].c_str());
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"setting allowed permission failed. Result: " << result);
result = security_manager_app_inst_req_add_path(request.get(), SM_PRIVATE_PATH,
SECURITY_MANAGER_PATH_PRIVATE);
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"setting allowed path failed. Result: " << result);
result = security_manager_app_inst_req_add_path(request.get(), SM_PUBLIC_PATH,
SECURITY_MANAGER_PATH_PUBLIC);
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"setting allowed path failed. Result: " << result);
result = security_manager_app_inst_req_add_path(request.get(), SM_PUBLIC_RO_PATH,
SECURITY_MANAGER_PATH_PUBLIC_RO);
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"setting allowed path failed. Result: " << result);
result = security_manager_app_install(request.get());
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"installing app failed. Result: " << result);
/* Check records in the security-manager database */
request.reset(do_app_inst_req_new());
result = security_manager_app_inst_req_set_app_id(request.get(), SM_APP_ID2);
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"setting app id failed. Result: " << result);
result = security_manager_app_uninstall(request.get());
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"uninstalling app failed. Result: " << result);
/* Check records in the security-manager database,
CStringPtr labelPtr;
result = security_manager_set_process_label_from_binary(testBinaryPath);
- RUNNER_ASSERT_MSG_BT(result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG(result == SECURITY_MANAGER_SUCCESS,
"security_manager_set_process_label_from_binary(" <<
testBinaryPath << ") failed. Result: " << result);
result = smack_new_label_from_self(&label);
- RUNNER_ASSERT_MSG_BT(result >= 0,
+ RUNNER_ASSERT_MSG(result >= 0,
" Error getting current process label");
- RUNNER_ASSERT_MSG_BT(label != NULL,
+ RUNNER_ASSERT_MSG(label != NULL,
" Process label is not set");
labelPtr.reset(label);
result = strcmp(expectedLabel, label);
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
" Process label is incorrect. Expected: \"" << expectedLabel << "\" Actual: \""
<< label << "\"");
}
int result;
result = security_manager_set_process_label_from_binary(testBinaryPath);
- RUNNER_ASSERT_MSG_BT(result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG(result == SECURITY_MANAGER_SUCCESS,
"security_manager_set_process_label_from_binary(" <<
testBinaryPath << ") failed. Result: " << result);
}
install_app(app_id, pkg_id);
result = security_manager_set_process_label_from_appid(app_id);
- RUNNER_ASSERT_MSG_BT(result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG(result == SECURITY_MANAGER_SUCCESS,
"security_manager_set_process_label_from_appid(" <<
app_id << ") failed. Result: " << result);
result = smack_new_label_from_self(&label);
- RUNNER_ASSERT_MSG_BT(result >= 0,
+ RUNNER_ASSERT_MSG(result >= 0,
" Error getting current process label");
- RUNNER_ASSERT_MSG_BT(label != NULL,
+ RUNNER_ASSERT_MSG(label != NULL,
" Process label is not set");
labelPtr.reset(label);
result = strcmp(expected_label, label);
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
" Process label is incorrect. Expected: \"" << expected_label <<
"\" Actual: \"" << label << "\"");
install_app(app_id, pkg_id);
result = security_manager_set_process_label_from_appid(app_id);
- RUNNER_ASSERT_MSG_BT(result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG(result == SECURITY_MANAGER_SUCCESS,
"security_manager_set_process_label_from_appid(" <<
app_id << ") failed. Result: " << result);
request.reset(do_app_inst_req_new());
result = security_manager_app_inst_req_set_app_id(request.get(), app_id);
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"setting app id failed. Result: " << result);
result = security_manager_app_inst_req_set_pkg_id(request.get(), pkg_id);
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"setting pkg id failed. Result: " << result);
result = security_manager_app_inst_req_add_path(request.get(), path, pathType);
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"setting allowed path failed. Result: " << result);
}
//switch user to non-root
result = drop_root_privileges();
- RUNNER_ASSERT_MSG_BT(result == 0, "drop_root_privileges failed");
+ RUNNER_ASSERT_MSG(result == 0, "drop_root_privileges failed");
//install app as non-root user and try to register public path (should fail)
prepare_request(request, SM_APP_ID3, SM_PKG_ID3, SECURITY_MANAGER_PATH_PUBLIC, SM_PRIVATE_PATH_FOR_USER_5000);
result = security_manager_app_install(request.get());
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_ERROR_AUTHENTICATION_FAILED,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_ERROR_AUTHENTICATION_FAILED,
"installing app not failed. Result: " << result);
//install app as non-root user
prepare_request(request, SM_APP_ID3, SM_PKG_ID3, SECURITY_MANAGER_PATH_PRIVATE, SM_PRIVATE_PATH);
result = security_manager_app_install(request.get());
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_ERROR_AUTHENTICATION_FAILED,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_ERROR_AUTHENTICATION_FAILED,
"installing app not failed. Result: " << result);
//install app as non-root user
for (auto &privilege : SM_ALLOWED_PRIVILEGES) {
result = security_manager_app_inst_req_add_privilege(request.get(), privilege.c_str());
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"setting allowed permission failed. Result: " << result);
}
result = security_manager_app_install(request.get());
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"installing app failed. Result: " << result);
check_app_permissions(SM_APP_ID3, SM_PKG_ID3, user.c_str(), SM_ALLOWED_PRIVILEGES, SM_DENIED_PRIVILEGES);
request.reset(do_app_inst_req_new());
result = security_manager_app_inst_req_set_app_id(request.get(), SM_APP_ID3);
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"setting app id failed. Result: " << result);
result = security_manager_app_uninstall(request.get());
- RUNNER_ASSERT_MSG_BT((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"uninstalling app failed. Result: " << result);
check_app_permissions(SM_APP_ID3, SM_PKG_ID3, user.c_str(), SM_NO_PRIVILEGES, SM_ALLOWED_PRIVILEGES);
Cookie getCookieFromSS() {
Cookie cookie(security_server_get_cookie_size());
- RUNNER_ASSERT_MSG_BT(SECURITY_SERVER_API_SUCCESS ==
+ RUNNER_ASSERT_MSG(SECURITY_SERVER_API_SUCCESS ==
security_server_request_cookie(cookie.data(), cookie.size()),
"Error in security_server_request_cookie.");
RUNNER_CHILD_TEST(tc_arguments_01_01_security_server_request_cookie)
{
int ret = security_server_request_cookie(NULL, KNOWN_COOKIE_SIZE);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
"Error in security_server_request_cookie() argument checking: " << ret);
}
Cookie cookie(KNOWN_COOKIE_SIZE);
int ret = security_server_request_cookie(cookie.data(), KNOWN_COOKIE_SIZE - 1);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_BUFFER_TOO_SMALL,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_BUFFER_TOO_SMALL,
"Error in security_server_request_cookie() argument checking: " << ret);
}
RUNNER_CHILD_TEST(tc_arguments_02_01_security_server_check_privilege)
{
int ret = security_server_check_privilege(NULL, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
"Error in security_server_check_privilege() argument checking: " << ret);
}
{
RUNNER_IGNORED_MSG("security_server_check_privilege_by_cookie is temporarily disabled: always returns success");
int ret = security_server_check_privilege_by_cookie(NULL, "wiadro", "rwx");
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
"Error in security_server_check_privilege_by_cookie() argument checking: "
<< ret);
}
Cookie cookie = getCookieFromSS();
int ret = security_server_check_privilege_by_cookie(cookie.data(), NULL, "rwx");
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
"Error in security_server_check_privilege_by_cookie() argument checking: "
<< ret);
}
Cookie cookie = getCookieFromSS();
int ret = security_server_check_privilege_by_cookie(cookie.data(), "wiadro", NULL);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
"Error in security_server_check_privilege_by_cookie() argument checking: "
<< ret);
}
RUNNER_CHILD_TEST(tc_arguments_04_01_security_server_get_cookie_pid)
{
int ret = security_server_get_cookie_pid(NULL);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
"Error in security_server_get_cookie_pid() argument checking: " << ret);
}
RUNNER_TEST(tc_arguments_04_02_security_server_get_cookie_pid)
{
const char wrong_cookie[KNOWN_COOKIE_SIZE] = {'w', 'a', 't', '?'};
- RUNNER_ASSERT_BT(security_server_get_cookie_pid(wrong_cookie) ==
+ RUNNER_ASSERT(security_server_get_cookie_pid(wrong_cookie) ==
SECURITY_SERVER_API_ERROR_NO_SUCH_COOKIE);
}
{
char *label = NULL;
label = security_server_get_smacklabel_cookie(NULL);
- RUNNER_ASSERT_MSG_BT(label == NULL,
+ RUNNER_ASSERT_MSG(label == NULL,
"Error in security_server_get_smacklabel_cookie() argument checking");
}
RUNNER_CHILD_TEST(tc_unit_01_01_security_server_get_cookie_size)
{
int ret = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG_BT(ret == KNOWN_COOKIE_SIZE,
+ RUNNER_ASSERT_MSG(ret == KNOWN_COOKIE_SIZE,
"Error in security_server_get_cookie_size(): " << ret);
}
int ret;
ret = drop_root_privileges();
- RUNNER_ASSERT_MSG_BT(ret == 0,
+ RUNNER_ASSERT_MSG(ret == 0,
"Failed to drop root privileges. Result: " << ret << "uid = " << getuid());
ret = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG_BT(ret == KNOWN_COOKIE_SIZE, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == KNOWN_COOKIE_SIZE, "ret = " << ret);
}
//---------------------------------------------------------------------------
Cookie cookie(cookieSize);
ret = drop_root_privileges();
- RUNNER_ASSERT_MSG_BT(ret == 0,
+ RUNNER_ASSERT_MSG(ret == 0,
"Failed to drop root privileges. Result: " << ret << "uid = " << getuid());
ret = security_server_request_cookie(cookie.data(), KNOWN_COOKIE_SIZE);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
//---------------------------------------------------------------------------
Cookie cookie(cookieSize);
ret = drop_root_privileges();
- RUNNER_ASSERT_MSG_BT(ret == 0,
+ RUNNER_ASSERT_MSG(ret == 0,
"Failed to drop root privileges. Result: " << ret << "uid = " << getuid());
ret = security_server_request_cookie(cookie.data(), KNOWN_COOKIE_SIZE >> 1);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_BUFFER_TOO_SMALL, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_BUFFER_TOO_SMALL, "ret = " << ret);
}
//---------------------------------------------------------------------------
provider.applyAndSwithToUser(APP_UID, APP_GID);
int ret = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG_BT(ret == KNOWN_COOKIE_SIZE,
+ RUNNER_ASSERT_MSG(ret == KNOWN_COOKIE_SIZE,
"Error in security_server_get_cookie_size(): " << ret);
}
RUNNER_CHILD_TEST(tc_unit_02_01_security_server_request_cookie)
{
int cookieSize = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG_BT(cookieSize == KNOWN_COOKIE_SIZE,
+ RUNNER_ASSERT_MSG(cookieSize == KNOWN_COOKIE_SIZE,
"Error in security_server_get_cookie_size(): " << cookieSize);
Cookie cookie(cookieSize);
int ret = security_server_request_cookie(cookie.data(), cookie.size());
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
"Error in security_server_request_cookie(): " << ret);
}
RUNNER_CHILD_TEST_SMACK(tc_unit_02_02_app_user_security_server_request_cookie)
{
int cookieSize = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG_BT(cookieSize == KNOWN_COOKIE_SIZE,
+ RUNNER_ASSERT_MSG(cookieSize == KNOWN_COOKIE_SIZE,
"Error in security_server_get_cookie_size(): " << cookieSize);
SecurityServer::AccessProvider provider("selflabel_02_01");
Cookie cookie(cookieSize);
int ret = security_server_request_cookie(cookie.data(), cookie.size());
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
"Error in security_server_request_cookie(): " << ret);
}
RUNNER_CHILD_TEST_SMACK(tc_unit_02_03_app_user_security_server_request_cookie_too_small_buffer_size)
{
int cookieSize = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG_BT(cookieSize == KNOWN_COOKIE_SIZE,
+ RUNNER_ASSERT_MSG(cookieSize == KNOWN_COOKIE_SIZE,
"Error in security_server_get_cookie_size(): " << cookieSize);
cookieSize >>= 1;
Cookie cookie(cookieSize);
int ret = security_server_request_cookie(cookie.data(), cookie.size());
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_BUFFER_TOO_SMALL,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_BUFFER_TOO_SMALL,
"Error in security_server_request_cookie(): " << ret);
}
Cookie cookie = getCookieFromSS();
int ret = security_server_check_privilege(cookie.data(), 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
"Error in security_server_check_privilege(): " << ret);
}
provider.applyAndSwithToUser(APP_UID, APP_GID);
int ret = security_server_check_privilege(cookie.data(), 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
"security_server_check_privilege() should return access denied: " << ret);
}
provider.applyAndSwithToUser(APP_UID, APP_GID);
int ret = security_server_check_privilege(cookie.data(), 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
"Error in security_server_check_privilege(): " << ret);
}
Cookie cookie = getCookieFromSS();
int audio_gid = security_server_get_gid(PROC_AUDIO_GROUP_NAME);
- RUNNER_ASSERT_MSG_BT(audio_gid > -1,
+ RUNNER_ASSERT_MSG(audio_gid > -1,
"security_server_get_gid() failed. result = " << audio_gid);
int ret = security_server_check_privilege(cookie.data(), audio_gid);
// security_server_check_privilege fails, because the process does not belong to "audio" group
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
}
// add gid
Cookie cookie = getCookieFromSS();
int audio_gid = security_server_get_gid(PROC_AUDIO_GROUP_NAME);
- RUNNER_ASSERT_MSG_BT(audio_gid > -1,
+ RUNNER_ASSERT_MSG(audio_gid > -1,
"security_server_get_gid() failed. result = " << audio_gid);
int ret = security_server_check_privilege(cookie.data(), audio_gid);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
}
// test invalid cookie name
{
// create invalid cookie
int size = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG_BT(size == KNOWN_COOKIE_SIZE, "Wrong cookie size. size = " << size);
+ RUNNER_ASSERT_MSG(size == KNOWN_COOKIE_SIZE, "Wrong cookie size. size = " << size);
Cookie cookie(size);
cookie[0] = 'a';
int ret = security_server_check_privilege(cookie.data(), 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
}
//---------------------------------------------------------------------------
Cookie cookie = getCookieFromSS();
int ret = security_server_get_cookie_pid(cookie.data());
- RUNNER_ASSERT_MSG_BT(ret > -1, "Error in security_server_get_cookie_pid(): " << ret);
+ RUNNER_ASSERT_MSG(ret > -1, "Error in security_server_get_cookie_pid(): " << ret);
int pid = getpid();
- RUNNER_ASSERT_MSG_BT(pid == ret, "No match in PID received from cookie");
+ RUNNER_ASSERT_MSG(pid == ret, "No match in PID received from cookie");
}
//privileges drop and no smack rule
provider.applyAndSwithToUser(APP_UID, APP_GID);
int ret = security_server_get_cookie_pid(cookie.data());
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
"security_server_get_cookie_pid() should return access denied: " << ret);
}
provider.applyAndSwithToUser(APP_UID, APP_GID);
int ret = security_server_get_cookie_pid(cookie.data());
- RUNNER_ASSERT_MSG_BT(ret > -1, "Error in security_server_get_cookie_pid(): " << ret);
+ RUNNER_ASSERT_MSG(ret > -1, "Error in security_server_get_cookie_pid(): " << ret);
int pid = getpid();
- RUNNER_ASSERT_MSG_BT(pid == ret, "No match in PID received from cookie");
+ RUNNER_ASSERT_MSG(pid == ret, "No match in PID received from cookie");
}
//---------------------------------------------------------------------------
Cookie cookie = getCookieFromSS();
CStringPtr label(security_server_get_smacklabel_cookie(cookie.data()));
- RUNNER_ASSERT_MSG_BT(strcmp(label.get(), "selflabel_06_01") == 0,
+ RUNNER_ASSERT_MSG(strcmp(label.get(), "selflabel_06_01") == 0,
"No match in smack label received from cookie, received label: "
<< label.get());
}
Cookie cookie = getCookieFromSS();
char *receivedLabel = security_server_get_smacklabel_cookie(cookie.data());
- RUNNER_ASSERT_MSG_BT(receivedLabel != NULL,
+ RUNNER_ASSERT_MSG(receivedLabel != NULL,
"security_server_get_smacklabel_cookie returned NULL");
std::string label(receivedLabel);
free(receivedLabel);
- RUNNER_ASSERT_MSG_BT(label.empty(),
+ RUNNER_ASSERT_MSG(label.empty(),
"security_server_get_smacklabel_cookie returned: "
<< label);
}
provider.applyAndSwithToUser(APP_UID, APP_GID);
CStringPtr label(security_server_get_smacklabel_cookie(cookie.data()));
- RUNNER_ASSERT_MSG_BT(label.get() == NULL,
+ RUNNER_ASSERT_MSG(label.get() == NULL,
"NULL should be received due to access denied, received label: "
<< label.get());
}
Cookie cookie = getCookieFromSS();
CStringPtr label(security_server_get_smacklabel_cookie(cookie.data()));
- RUNNER_ASSERT_MSG_BT(strcmp(label.get(), "selflabel_06_03") == 0,
+ RUNNER_ASSERT_MSG(strcmp(label.get(), "selflabel_06_03") == 0,
"No match in smack label received from cookie, received label: "
<< label.get());
}
Cookie cookie = getCookieFromSS();
int ret = security_server_get_gid(PROC_AUDIO_GROUP_NAME);
- RUNNER_ASSERT_MSG_BT(ret > -1, "Failed to get \"" << PROC_AUDIO_GROUP_NAME
+ RUNNER_ASSERT_MSG(ret > -1, "Failed to get \"" << PROC_AUDIO_GROUP_NAME
<< "\" gid. Result: " << ret);
ret = security_server_check_privilege(cookie.data(), ret);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
int root_gid = security_server_get_gid(ROOT_USER);
- RUNNER_ASSERT_MSG_BT(root_gid > -1, "root_gid: " << root_gid);
+ RUNNER_ASSERT_MSG(root_gid > -1, "root_gid: " << root_gid);
ret = security_server_get_cookie_pid(cookie.data());
- RUNNER_ASSERT_MSG_BT(ret == getpid(), "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == getpid(), "ret: " << ret);
CStringPtr ss_label(security_server_get_smacklabel_cookie(cookie.data()));
- RUNNER_ASSERT_MSG_BT(ss_label.get() != NULL, "ss_label: " << ss_label.get());
+ RUNNER_ASSERT_MSG(ss_label.get() != NULL, "ss_label: " << ss_label.get());
RUNNER_IGNORED_MSG("security_server_check_privilege_by_cookie is temporarily disabled: always returns success");
ret = security_server_check_privilege_by_pid(getpid(), "_", "rx");
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
}
// disable access and drop privileges
provider.applyAndSwithToUser(APP_UID, APP_GID);
int ret = security_server_check_privilege(cookie.data(), DB_ALARM_GID);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
"security_server_check_privilege should return access denied, "
"ret: " << ret);
ret = security_server_get_gid(ROOT_USER);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
"security_server_get_gid should return access denied, "
"ret: " << ret);
ret = security_server_get_cookie_pid(cookie.data());
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
"security_server_get_cookie_pid should return access denied, "
"ret: " << ret);
CStringPtr ss_label(security_server_get_smacklabel_cookie(cookie.data()));
- RUNNER_ASSERT_MSG_BT(ss_label.get() == NULL,
+ RUNNER_ASSERT_MSG(ss_label.get() == NULL,
"access should be denied so label should be NULL: " << ss_label.get());
RUNNER_IGNORED_MSG("security_server_check_privilege_by_sockfd is temporarily disabled: always returns success");
ret = security_server_check_privilege_by_pid(getpid(), "_", "rx");
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
"security_server_check_privilege_by_pid should return access denied, "
"ret: " << ret);
}
// drop root privileges
int ret = drop_root_privileges();
- RUNNER_ASSERT_MSG_BT(ret == 0,
+ RUNNER_ASSERT_MSG(ret == 0,
"Failed to drop root privileges. Result: " << ret << "uid = " << getuid());
Cookie cookie = getCookieFromSS();
ret = security_server_get_gid(PROC_AUDIO_GROUP_NAME);
- RUNNER_ASSERT_MSG_BT(ret > -1, "Failed to get \"" << PROC_AUDIO_GROUP_NAME
+ RUNNER_ASSERT_MSG(ret > -1, "Failed to get \"" << PROC_AUDIO_GROUP_NAME
<< "\" gid. Result: " << ret);
ret = security_server_check_privilege(cookie.data(), ret);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
"check_privilege failed. Result: " << ret);
ret = security_server_get_gid(ROOT_USER);
- RUNNER_ASSERT_MSG_BT(ret > -1, "Failed to get \"root\" gid. Result: " << ret);
+ RUNNER_ASSERT_MSG(ret > -1, "Failed to get \"root\" gid. Result: " << ret);
ret = security_server_get_cookie_pid(cookie.data());
- RUNNER_ASSERT_MSG_BT(ret == getpid(),
+ RUNNER_ASSERT_MSG(ret == getpid(),
"get_cookie_pid returned different pid than it should. Result: " << ret);
CStringPtr ss_label(security_server_get_smacklabel_cookie(cookie.data()));
- RUNNER_ASSERT_MSG_BT(ss_label.get() != NULL, "get_smacklabel_cookie failed.");
+ RUNNER_ASSERT_MSG(ss_label.get() != NULL, "get_smacklabel_cookie failed.");
RUNNER_IGNORED_MSG("security_server_check_privilege_by_sockfd is temporarily disabled: always returns success");
ret = security_server_check_privilege_by_pid(getpid(), "_", "rx");
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
"check_privilege_by_pid failed. Result: " << ret);
}
ssize_t rest = count;
ssize_t s;
while (rest > 0) {
- RUNNER_ASSERT_MSG_BT(0 < (s = TEMP_FAILURE_RETRY(read(fd, ((char*)buf) + readf, rest))), "Error in read from pipe");
+ RUNNER_ASSERT_ERRNO_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_BT(0 <= (s = TEMP_FAILURE_RETRY(write(fd, ((char*)buf) + writef, rest))), "Error in write to pipe");
+ RUNNER_ASSERT_ERRNO_MSG(0 <= (s = TEMP_FAILURE_RETRY(write(fd, ((char*)buf) + writef, rest))),
+ "Error in write to pipe");
rest -= s;
writef += s;
}
timeval my_gettime() {
timeval t;
int res = gettimeofday(&t, NULL);
- RUNNER_ASSERT_MSG_BT(res == 0, "gettimeofday() returned error value: " << res);
+ RUNNER_ASSERT_ERRNO_MSG(res == 0, "gettimeofday() returned error value: " << res);
return t;
}
for (int i=0; i < NUMBER_OF_CALLS; i++) {
start_stats_update(&stats);
ret = my_nanosecsleep((long) ((i+1)*QUANTUM*1000));
- RUNNER_ASSERT_MSG_BT(ret == 0, "system sleep function returned premature wake-up; ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == 0, "system sleep function returned premature wake-up; ret = " << ret);
end_stats_update(&stats);
}
finish_stats(&stats, "my_nanosecsleep");
- RUNNER_ASSERT_MSG_BT((stats.average_duration>expected_avarage_min) && (stats.average_duration<expected_avarage_max), "Avarage time is suspicious - check the issue; stats.average_duration=" << stats.average_duration);
- RUNNER_ASSERT_MSG_BT((stats.minimal_duration>expected_min_min) && (stats.minimal_duration<expected_min_max), "Minimal time is suspicious - check the issue; stats.minimal_duration=" << stats.minimal_duration);
- RUNNER_ASSERT_MSG_BT((stats.maximal_duration>expected_max_min) && (stats.maximal_duration<expected_max_max), "Maximal time is suspicious - check the issue; stats.maximal_duration=" << stats.maximal_duration);
+ RUNNER_ASSERT_MSG((stats.average_duration>expected_avarage_min) && (stats.average_duration<expected_avarage_max), "Avarage time is suspicious - check the issue; stats.average_duration=" << stats.average_duration);
+ RUNNER_ASSERT_MSG((stats.minimal_duration>expected_min_min) && (stats.minimal_duration<expected_min_max), "Minimal time is suspicious - check the issue; stats.minimal_duration=" << stats.minimal_duration);
+ RUNNER_ASSERT_MSG((stats.maximal_duration>expected_max_min) && (stats.maximal_duration<expected_max_max), "Maximal time is suspicious - check the issue; stats.maximal_duration=" << stats.maximal_duration);
}
/*
for (int i = 1; i <= NUMBER_OF_CALLS; i++) {
start_stats_update(&stats);
ret = security_server_get_gid(EXISTING_GROUP_NAME);
- RUNNER_ASSERT_MSG_BT(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
end_stats_update(&stats);
}
finish_stats(&stats, "security_server_get_gid");
for (int i = 1; i <= NUMBER_OF_CALLS; i++) {
start_stats_update(&stats);
ret = security_server_request_cookie(cookie, cookie_size);
- RUNNER_ASSERT_MSG_BT(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
end_stats_update(&stats);
}
finish_stats(&stats, "security_server_request_cookie");
int number_of_calls;
double duration_of_calls;
/*initialize pipes - one pipe for one child process*/
- RUNNER_ASSERT_MSG_BT(0 == pipe(pipefd), "error in pipe");
+ RUNNER_ASSERT_ERRNO_MSG(0 == pipe(pipefd), "error in pipe");
initialize_stats(&stats);
for (int i = 0; i < NUMBER_OF_CALLS; i++) {
- RUNNER_ASSERT_MSG_BT(-1 != (cpid = fork()), "error in fork #i = " << i);
+ RUNNER_ASSERT_ERRNO_MSG(-1 != (cpid = fork()), "error in fork #i = " << i);
if (cpid == 0) { /* Child*/
close(pipefd[0]); /* Close unused read end */
timeval start_time;
number_of_calls = 0;
duration_of_calls = 0.0;
}
- RUNNER_ASSERT_MSG_BT(my_pipe_write(pipefd[1], &number_of_calls, sizeof(number_of_calls)) == sizeof(number_of_calls), "error in write number of calls to pipe");
- RUNNER_ASSERT_MSG_BT(my_pipe_write(pipefd[1], &duration_of_calls, sizeof(duration_of_calls)) == sizeof(duration_of_calls), "error in write duration of calls to pipe");
+ RUNNER_ASSERT_MSG(my_pipe_write(pipefd[1], &number_of_calls, sizeof(number_of_calls)) == sizeof(number_of_calls), "error in write number of calls to pipe");
+ RUNNER_ASSERT_MSG(my_pipe_write(pipefd[1], &duration_of_calls, sizeof(duration_of_calls)) == sizeof(duration_of_calls), "error in write duration of calls to pipe");
close(pipefd[1]);
exit(EXIT_SUCCESS);
} else
{ /* Parent */
- RUNNER_ASSERT_MSG_BT(my_pipe_read(pipefd[0], &number_of_calls, sizeof(number_of_calls)) == sizeof(number_of_calls), "error in read number of calls to pipe");
- RUNNER_ASSERT_MSG_BT(my_pipe_read(pipefd[0], &duration_of_calls, sizeof(duration_of_calls)) == sizeof(duration_of_calls), "error in read duration of calls to pipe");
+ RUNNER_ASSERT_MSG(my_pipe_read(pipefd[0], &number_of_calls, sizeof(number_of_calls)) == sizeof(number_of_calls), "error in read number of calls to pipe");
+ RUNNER_ASSERT_MSG(my_pipe_read(pipefd[0], &duration_of_calls, sizeof(duration_of_calls)) == sizeof(duration_of_calls), "error in read duration of calls to pipe");
- RUNNER_ASSERT_MSG_BT(number_of_calls > 0, "commmunication error");
+ RUNNER_ASSERT_MSG(number_of_calls > 0, "commmunication error");
stats_update(&stats, number_of_calls, duration_of_calls);
}
/*parent*/
for (int i = 1; i <= NUMBER_OF_CALLS; i++) {
start_stats_update(&stats);
cookie_size = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG_BT(cookie_size > 0, "cookie_size = " << cookie_size);
+ RUNNER_ASSERT_MSG(cookie_size > 0, "cookie_size = " << cookie_size);
end_stats_update(&stats);
}
finish_stats(&stats, "security_server_get_cookie_size");
for (int i = 1; i <= NUMBER_OF_CALLS; i++) {
start_stats_update(&stats);
ret = security_server_check_privilege(recved_cookie, (gid_t)call_gid);
- RUNNER_ASSERT_MSG_BT(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
end_stats_update(&stats);
}
finish_stats(&stats, "security_server_check_privilege");
SmackAccess smackAccess;
smackAccess.add(subject_label, object_label, access_rights);
smackAccess.apply();
- RUNNER_ASSERT_MSG_BT(0 == (ret = smack_set_label_for_self(subject_label)),
+ RUNNER_ASSERT_MSG(0 == (ret = smack_set_label_for_self(subject_label)),
"Error in smack_set_label_for_self(); ret = " << ret);
}
object_label,
access_rights_ext);
- RUNNER_ASSERT_MSG_BT(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
end_stats_update(&stats);
}
finish_stats(&stats, "security_server_check_privilege_by_cookie");
}
int pid = fork();
- RUNNER_ASSERT_BT(-1 != pid);
+ RUNNER_ASSERT_ERRNO(-1 != pid);
if (0 == pid) {
// child
int sockfd = create_new_socket();
- RUNNER_ASSERT_MSG_BT(sockfd >= 0, "create_new_socket() failed");
+ RUNNER_ASSERT_MSG(sockfd >= 0, "create_new_socket() failed");
SockUniquePtr sockfd_ptr(&sockfd);
if (smack)
- RUNNER_ASSERT_MSG_BT(0 == smack_set_label_for_self(subject_label), "child label " << subject_label << " not set");
+ RUNNER_ASSERT_MSG(0 == smack_set_label_for_self(subject_label), "child label " << subject_label << " not set");
- RUNNER_ASSERT_MSG_BT(listen(sockfd, 5) >= 0, "child listen failed");
+ RUNNER_ASSERT_ERRNO_MSG(listen(sockfd, 5) >= 0, "child listen failed");
struct sockaddr_un client_addr;
socklen_t client_len = sizeof(client_addr);
int csockfd;
- RUNNER_ASSERT_MSG_BT((csockfd = accept(sockfd,(struct sockaddr*)&client_addr, &client_len)) > 0, "child accept failed");
+ RUNNER_ASSERT_ERRNO_MSG((csockfd = accept(sockfd,(struct sockaddr*)&client_addr, &client_len)) > 0,
+ "child accept failed");
close(csockfd);
exit(EXIT_SUCCESS);
//parent
sleep(2);
int sockfd = connect_to_testserver();
- RUNNER_ASSERT_MSG_BT(sockfd >= 0, "connect_to_testserver() failed");
+ RUNNER_ASSERT_MSG(sockfd >= 0, "connect_to_testserver() failed");
SockUniquePtr sockfd_ptr(&sockfd);
sockfd,
object_label,
access_rights);
- RUNNER_ASSERT_MSG_BT(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
end_stats_update(&stats);
}
cookie_size = security_server_get_cookie_size();
char cookie[cookie_size];
ret = security_server_request_cookie(cookie, cookie_size);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "security_server_request_cookie failed; ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "security_server_request_cookie failed; ret = " << ret);
readwrite_stats stats;
initialize_stats(&stats);
for (int i = 1; i <= NUMBER_OF_CALLS; i++) {
start_stats_update(&stats);
ret = security_server_get_cookie_pid(cookie);
- RUNNER_ASSERT_MSG_BT(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
end_stats_update(&stats);
}
finish_stats(&stats, "security_server_request_cookie");
for (int i = 1; i <= NUMBER_OF_CALLS; i++) {
start_stats_update(&stats);
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
end_stats_update(&stats);
}
finish_stats(&stats, "security_server_is_pwd_valid");
for (int i = 1; i <= NUMBER_OF_CALLS; i++) {
start_stats_update(&stats);
ret = security_server_set_pwd("this_is_current_pwd", "this_is_new_pwd", 20, 365);
- RUNNER_ASSERT_MSG_BT(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
end_stats_update(&stats);
}
finish_stats(&stats, "security_server_set_pwd");
for (int i = 1; i <= NUMBER_OF_CALLS; i++) {
start_stats_update(&stats);
ret = security_server_set_pwd_validity(2);
- RUNNER_ASSERT_MSG_BT(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
end_stats_update(&stats);
}
finish_stats(&stats, "security_server_set_pwd_validity");
for (int i = 1; i <= NUMBER_OF_CALLS; i++) {
start_stats_update(&stats);
ret = security_server_set_pwd_max_challenge(3);
- RUNNER_ASSERT_MSG_BT(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
end_stats_update(&stats);
}
finish_stats(&stats, "security_server_set_pwd_max_challenge");
for (int i = 1; i <= NUMBER_OF_CALLS; i++) {
start_stats_update(&stats);
ret = security_server_reset_pwd("apud", 1, 2);
- RUNNER_ASSERT_MSG_BT(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
end_stats_update(&stats);
}
finish_stats(&stats, "security_server_reset_pwd");
for (int i = 1; i <= NUMBER_OF_CALLS; i++) {
start_stats_update(&stats);
ret = security_server_chk_pwd("is_this_password", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
end_stats_update(&stats);
}
finish_stats(&stats, "security_server_chk_pwd");
for (int i = 1; i <= NUMBER_OF_CALLS; i++) {
start_stats_update(&stats);
ret = security_server_set_pwd_history(100);
- RUNNER_ASSERT_MSG_BT(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
end_stats_update(&stats);
}
finish_stats(&stats, "security_server_set_pwd_history");
for (int i = 1; i <= NUMBER_OF_CALLS; i++) {
start_stats_update(&stats);
ret = security_server_app_give_access(customer_label, customer_pid);
- RUNNER_ASSERT_MSG_BT(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
end_stats_update(&stats);
}
finish_stats(&stats, "security_server_app_give_access");
for (int i = 1; i <= NUMBER_OF_CALLS; i++) {
start_stats_update(&stats);
ret = security_server_check_privilege_by_pid(pid, object, access_rights);
- RUNNER_ASSERT_MSG_BT(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
end_stats_update(&stats);
}
finish_stats(&stats, "security_server_check_privilege_by_pid");
int ret = security_server_get_gid("abc123xyz_pysiaczek");
LogDebug("ret = " << ret);
- RUNNER_ASSERT_MSG_BT(SECURITY_SERVER_API_ERROR_NO_SUCH_OBJECT == ret, "Ret: " << ret);
+ RUNNER_ASSERT_MSG(SECURITY_SERVER_API_ERROR_NO_SUCH_OBJECT == ret, "Ret: " << ret);
ret = security_server_get_gid("root");
LogDebug("ret = " << ret);
- RUNNER_ASSERT_MSG_BT(0 == ret, "Ret: " << ret);
+ RUNNER_ASSERT_MSG(0 == ret, "Ret: " << ret);
}
/*
provider.addObjectRule(object_label, access_rights);
provider.applyAndSwithToUser(APP_UID, APP_GID);
- RUNNER_ASSERT_BT(SECURITY_SERVER_API_SUCCESS ==
+ RUNNER_ASSERT(SECURITY_SERVER_API_SUCCESS ==
security_server_request_cookie(cookie,20));
- RUNNER_ASSERT_BT(SECURITY_SERVER_API_SUCCESS ==
+ RUNNER_ASSERT(SECURITY_SERVER_API_SUCCESS ==
security_server_check_privilege_by_cookie(
cookie,
object_label,
access_rights));
- RUNNER_ASSERT_BT(SECURITY_SERVER_API_ERROR_ACCESS_DENIED ==
+ RUNNER_ASSERT(SECURITY_SERVER_API_ERROR_ACCESS_DENIED ==
security_server_check_privilege_by_cookie(
cookie,
object_label,
int result2 = -1;
smack_accesses *handle;
- RUNNER_ASSERT_BT(0 == smack_accesses_new(&handle));
- RUNNER_ASSERT_BT(0 == smack_accesses_add(handle,
+ RUNNER_ASSERT(0 == smack_accesses_new(&handle));
+ RUNNER_ASSERT(0 == smack_accesses_add(handle,
subject_label,
object_label,
access_rights));
- RUNNER_ASSERT_BT(0 == smack_accesses_apply(handle));
+ RUNNER_ASSERT(0 == smack_accesses_apply(handle));
smack_accesses_free(handle);
int pid = fork();
char *label;
- RUNNER_ASSERT_BT(-1 != pid);
+ RUNNER_ASSERT_ERRNO(-1 != pid);
if (0 == pid) {
// child
- RUNNER_ASSERT_MSG_BT(0 == smack_set_label_for_self(subject_label), "child label " << subject_label << " not set");
+ RUNNER_ASSERT_MSG(0 == smack_set_label_for_self(subject_label), "child label " << subject_label << " not set");
int sockfd = create_new_socket();
- RUNNER_ASSERT_MSG_BT(sockfd >= 0, "create_new_socket() failed");
+ RUNNER_ASSERT_MSG(sockfd >= 0, "create_new_socket() failed");
SockUniquePtr sockfd_ptr(&sockfd);
label = security_server_get_smacklabel_sockfd(sockfd);
- RUNNER_ASSERT_MSG_BT(label != NULL, "security_server_get_smacklabel_sockfd failed");
- RUNNER_ASSERT_MSG_BT(strcmp(label,"") == 0, "label is \"" << label << "\"");
+ RUNNER_ASSERT_MSG(label != NULL, "security_server_get_smacklabel_sockfd failed");
+ RUNNER_ASSERT_MSG(strcmp(label,"") == 0, "label is \"" << label << "\"");
free(label);
- RUNNER_ASSERT_MSG_BT(drop_root_privileges() == 0, "uid = " << getuid());
+ RUNNER_ASSERT_MSG(drop_root_privileges() == 0, "uid = " << getuid());
- RUNNER_ASSERT_MSG_BT(listen(sockfd, 5) >= 0, "child listen failed");
+ RUNNER_ASSERT_ERRNO_MSG(listen(sockfd, 5) >= 0, "child listen failed");
label = security_server_get_smacklabel_sockfd(sockfd);
- RUNNER_ASSERT_MSG_BT(label != NULL, "security_server_get_smacklabel_sockfd failed");
- RUNNER_ASSERT_MSG_BT(strcmp(label,"") == 0, "label is \"" << label << "\"");
+ RUNNER_ASSERT_MSG(label != NULL, "security_server_get_smacklabel_sockfd failed");
+ RUNNER_ASSERT_MSG(strcmp(label,"") == 0, "label is \"" << label << "\"");
free(label);
struct sockaddr_un client_addr;
socklen_t client_len = sizeof(client_addr);
int csockfd;
- RUNNER_ASSERT_MSG_BT((csockfd = accept(sockfd,(struct sockaddr*)&client_addr, &client_len)) > 0, "child accept failed");
+ RUNNER_ASSERT_ERRNO_MSG((csockfd = accept(sockfd,(struct sockaddr*)&client_addr, &client_len)) > 0,
+ "child accept failed");
usleep(500);
// parent
sleep(1);
int sockfd = connect_to_testserver();
- RUNNER_ASSERT_MSG_BT(sockfd >= 0, "connect_to_testserver() failed");
+ RUNNER_ASSERT_MSG(sockfd >= 0, "connect_to_testserver() failed");
SockUniquePtr sockfd_ptr(&sockfd);
label = security_server_get_smacklabel_sockfd(sockfd);
- RUNNER_ASSERT_MSG_BT(label != NULL, "security_server_get_smacklabel_sockfd failed");
- RUNNER_ASSERT_MSG_BT(strcmp(label,subject_label) == 0, "label is \"" << label << "\"" << ", subject_label is \"" << subject_label << "\"" );
+ RUNNER_ASSERT_MSG(label != NULL, "security_server_get_smacklabel_sockfd failed");
+ RUNNER_ASSERT_MSG(strcmp(label,subject_label) == 0, "label is \"" << label << "\"" << ", subject_label is \"" << subject_label << "\"" );
free(label);
result1 = security_server_check_privilege_by_sockfd(
access_rights_ext);
}
- RUNNER_ASSERT_MSG_BT(SECURITY_SERVER_API_SUCCESS == result1, "result = " << result1);
- RUNNER_ASSERT_MSG_BT(SECURITY_SERVER_API_ERROR_ACCESS_DENIED == result2, "result = " << result2);
+ RUNNER_ASSERT_MSG(SECURITY_SERVER_API_SUCCESS == result1, "result = " << result1);
+ RUNNER_ASSERT_MSG(SECURITY_SERVER_API_ERROR_ACCESS_DENIED == result2, "result = " << result2);
}
/*
access.apply();
int pid = fork();
- RUNNER_ASSERT_BT(-1 != pid);
+ RUNNER_ASSERT_ERRNO(-1 != pid);
if (0 == pid) {
pid = fork();
- RUNNER_ASSERT_BT(-1 != pid);
+ RUNNER_ASSERT_ERRNO(-1 != pid);
if (0 == pid) {
// child
int sockfd = create_new_socket();
- RUNNER_ASSERT_MSG_BT(sockfd >= 0, "create_new_socket() failed");
+ RUNNER_ASSERT_MSG(sockfd >= 0, "create_new_socket() failed");
SockUniquePtr sockfd_ptr(&sockfd);
- RUNNER_ASSERT_MSG_BT(0 == smack_set_label_for_self(subject_label), "child label " << subject_label << " not set");
+ RUNNER_ASSERT_MSG(0 == smack_set_label_for_self(subject_label), "child label " << subject_label << " not set");
- RUNNER_ASSERT_MSG_BT(drop_root_privileges() == 0, "uid = " << getuid());
+ RUNNER_ASSERT_MSG(drop_root_privileges() == 0, "uid = " << getuid());
- RUNNER_ASSERT_MSG_BT(listen(sockfd, 5) >= 0, "child listen failed");
+ RUNNER_ASSERT_ERRNO_MSG(listen(sockfd, 5) >= 0, "child listen failed");
struct sockaddr_un client_addr;
socklen_t client_len = sizeof(client_addr);
// parent
sleep(1);
int sockfd = connect_to_testserver();
- RUNNER_ASSERT_MSG_BT(sockfd >= 0, "connect_to_testserver() failed");
+ RUNNER_ASSERT_MSG(sockfd >= 0, "connect_to_testserver() failed");
result1 = security_server_check_privilege_by_sockfd(
sockfd,
close(sockfd);
- RUNNER_ASSERT_MSG_BT(SECURITY_SERVER_API_SUCCESS == result1, "result1 = " << result1);
- RUNNER_ASSERT_MSG_BT(SECURITY_SERVER_API_ERROR_ACCESS_DENIED == result2, " result2 = " << result2);
+ RUNNER_ASSERT_MSG(SECURITY_SERVER_API_SUCCESS == result1, "result1 = " << result1);
+ RUNNER_ASSERT_MSG(SECURITY_SERVER_API_ERROR_ACCESS_DENIED == result2, " result2 = " << result2);
}
}
}
int ret;
ret = drop_root_privileges();
- RUNNER_ASSERT_MSG_BT(ret == 0,
+ RUNNER_ASSERT_MSG(ret == 0,
"Failed to drop root privileges. Result: " << ret << "uid = " << getuid());
ret = security_server_get_gid("definitely_not_existing_object");
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_SUCH_OBJECT, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_SUCH_OBJECT, "ret = " << ret);
ret = security_server_get_gid("root");
- RUNNER_ASSERT_MSG_BT(ret == 0, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == 0, "ret = " << ret);
}
/*
char cookie[20];
const char* object_label = "tc05objectlabel";
- RUNNER_ASSERT_BT(security_server_request_cookie(cookie,20) == SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT(security_server_request_cookie(cookie,20) == SECURITY_SERVER_API_SUCCESS);
- RUNNER_ASSERT_MSG_BT(drop_root_privileges() == 0, "uid = " << getuid());
+ RUNNER_ASSERT_MSG(drop_root_privileges() == 0, "uid = " << getuid());
- RUNNER_ASSERT_BT(SECURITY_SERVER_API_SUCCESS ==
+ RUNNER_ASSERT(SECURITY_SERVER_API_SUCCESS ==
security_server_check_privilege_by_cookie(cookie, object_label, "r"));
//On NOSMACK env security server should return success on any accesses, even those that are
//incorrect.
- RUNNER_ASSERT_BT(SECURITY_SERVER_API_SUCCESS ==
+ RUNNER_ASSERT(SECURITY_SERVER_API_SUCCESS ==
security_server_check_privilege_by_cookie(cookie, object_label, "rw"));
}
int pid = fork();
char* label;
- RUNNER_ASSERT_BT(pid >= 0);
+ RUNNER_ASSERT_ERRNO(pid >= 0);
int ret;
if (pid == 0) { //child process - server
//create new socket
int sockfd = create_new_socket();
- RUNNER_ASSERT_MSG_BT(sockfd >= 0, "create_new_socket() failed");
+ RUNNER_ASSERT_MSG(sockfd >= 0, "create_new_socket() failed");
SockUniquePtr sockfd_ptr(&sockfd);
//check if get_smacklabel_sockfd works correctly
label = security_server_get_smacklabel_sockfd(sockfd);
- RUNNER_ASSERT_MSG_BT(label != NULL, "security_server_get_smacklabel_sockfd failed");
+ RUNNER_ASSERT_MSG(label != NULL, "security_server_get_smacklabel_sockfd failed");
ret = strcmp(label, "");
free(label);
- RUNNER_ASSERT_MSG_BT(ret == 0, "label is \"" << label << "\"");
+ RUNNER_ASSERT_MSG(ret == 0, "label is \"" << label << "\"");
- RUNNER_ASSERT_MSG_BT(drop_root_privileges() == 0, "uid = " << getuid());
+ RUNNER_ASSERT_MSG(drop_root_privileges() == 0, "uid = " << getuid());
- RUNNER_ASSERT_MSG_BT(listen(sockfd, 5) >= 0, "child listen failed");
+ RUNNER_ASSERT_ERRNO_MSG(listen(sockfd, 5) >= 0, "child listen failed");
struct sockaddr_un client_addr;
socklen_t client_len = sizeof(client_addr);
int csockfd;
- RUNNER_ASSERT_MSG_BT((csockfd = accept(sockfd,(struct sockaddr*)&client_addr, &client_len)) > 0, "child accept failed");
+ RUNNER_ASSERT_ERRNO_MSG((csockfd = accept(sockfd,(struct sockaddr*)&client_addr, &client_len)) > 0,
+ "child accept failed");
//wait a little bit for parent to do it's job
usleep(200);
//parent
sleep(1);
int sockfd = connect_to_testserver();
- RUNNER_ASSERT_MSG_BT(sockfd >= 0, "Failed to connect to server.");
+ RUNNER_ASSERT_MSG(sockfd >= 0, "Failed to connect to server.");
SockUniquePtr sockfd_ptr(&sockfd);
label = security_server_get_smacklabel_sockfd(sockfd);
- RUNNER_ASSERT_MSG_BT(label != NULL, "get_smacklabel_sockfd failed.");
+ RUNNER_ASSERT_MSG(label != NULL, "get_smacklabel_sockfd failed.");
ret = strcmp(label, "");
free(label);
- RUNNER_ASSERT_MSG_BT(ret == 0, "label is \"" << label << "\"");
+ RUNNER_ASSERT_MSG(ret == 0, "label is \"" << label << "\"");
result1 = security_server_check_privilege_by_sockfd(sockfd, object_label, "r");
result2 = security_server_check_privilege_by_sockfd(sockfd, object_label, "rw");
}
- RUNNER_ASSERT_MSG_BT(result1 == SECURITY_SERVER_API_SUCCESS, "result = " << result1);
- RUNNER_ASSERT_MSG_BT(result2 == SECURITY_SERVER_API_SUCCESS, "result = " << result2);
+ RUNNER_ASSERT_MSG(result1 == SECURITY_SERVER_API_SUCCESS, "result = " << result1);
+ RUNNER_ASSERT_MSG(result2 == SECURITY_SERVER_API_SUCCESS, "result = " << result2);
}
/**
int result2 = -1;
int pid = fork();
- RUNNER_ASSERT_BT(-1 != pid);
+ RUNNER_ASSERT_ERRNO(-1 != pid);
if (pid == 0) {
pid = fork();
- RUNNER_ASSERT_BT(-1 != pid);
+ RUNNER_ASSERT_ERRNO(-1 != pid);
if (pid == 0) { //child process
//Create socket
int sockfd = create_new_socket();
- RUNNER_ASSERT_MSG_BT(sockfd >= 0, "create_new_socket() failed");
+ RUNNER_ASSERT_MSG(sockfd >= 0, "create_new_socket() failed");
SockUniquePtr sockfd_ptr(&sockfd);
//Drop privileges
- RUNNER_ASSERT_MSG_BT(drop_root_privileges() == 0, "uid = " << getuid());
+ RUNNER_ASSERT_MSG(drop_root_privileges() == 0, "uid = " << getuid());
//Prepare for accepting
- RUNNER_ASSERT_MSG_BT(listen(sockfd, 5) >= 0, "child listen failed");
+ RUNNER_ASSERT_ERRNO_MSG(listen(sockfd, 5) >= 0, "child listen failed");
struct sockaddr_un client_addr;
socklen_t client_len = sizeof(client_addr);
//Accept connections
int csockfd;
- RUNNER_ASSERT_MSG_BT((csockfd = accept(sockfd,(struct sockaddr*)&client_addr, &client_len)) > 0, "child accept failed");
+ RUNNER_ASSERT_ERRNO_MSG((csockfd = accept(sockfd,(struct sockaddr*)&client_addr, &client_len)) > 0,
+ "child accept failed");
//wait a little bit for parent to do it's job
usleep(200);
exit(0);
} else { //parent process
//Drop root privileges
- RUNNER_ASSERT_MSG_BT(drop_root_privileges() == 0, "uid = " << getuid());
+ RUNNER_ASSERT_MSG(drop_root_privileges() == 0, "uid = " << getuid());
//Wait for server to set up
sleep(1);
//Connect and check privileges
int sockfd = connect_to_testserver();
- RUNNER_ASSERT_MSG_BT(sockfd >= 0, "Failed to create socket fd.");
+ RUNNER_ASSERT_MSG(sockfd >= 0, "Failed to create socket fd.");
result1 = security_server_check_privilege_by_sockfd(sockfd, object_label, "r");
result2 = security_server_check_privilege_by_sockfd(sockfd, object_label, "rw");
close(sockfd);
//Both results (just like in the previous test case) should return success.
- RUNNER_ASSERT_MSG_BT(SECURITY_SERVER_API_SUCCESS == result1, "result1 = " << result1);
- RUNNER_ASSERT_MSG_BT(SECURITY_SERVER_API_SUCCESS == result2, "result2 = " << result2);
+ RUNNER_ASSERT_MSG(SECURITY_SERVER_API_SUCCESS == result1, "result1 = " << result1);
+ RUNNER_ASSERT_MSG(SECURITY_SERVER_API_SUCCESS == result2, "result2 = " << result2);
}
}
}
char *cookie = NULL;
int cookie_size = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG_BT(PROPER_COOKIE_SIZE == cookie_size, "Wrong cookie size from security-server");
+ RUNNER_ASSERT_MSG(PROPER_COOKIE_SIZE == cookie_size, "Wrong cookie size from security-server");
cookie = (char*) calloc(cookie_size, 1);
- RUNNER_ASSERT_MSG_BT(NULL != cookie, "Memory allocation error");
+ RUNNER_ASSERT_MSG(NULL != cookie, "Memory allocation error");
res = security_server_request_cookie(cookie, cookie_size);
if (res != SECURITY_SERVER_API_SUCCESS) {
free(cookie);
- RUNNER_ASSERT_MSG_BT(res == SECURITY_SERVER_API_SUCCESS, "Error in requesting cookie from security-server");
+ RUNNER_ASSERT_MSG(res == SECURITY_SERVER_API_SUCCESS, "Error in requesting cookie from security-server");
}
label_ss = security_server_get_smacklabel_cookie(cookie);
free(cookie);
- RUNNER_ASSERT_MSG_BT(label_ss != NULL, "Error in getting label by cookie");
+ RUNNER_ASSERT_MSG(label_ss != NULL, "Error in getting label by cookie");
std::string label_cookie(label_ss);
res = smack_new_label_from_self(&label_smack);
if (res < 0) {
free(label_smack);
- RUNNER_ASSERT_MSG_BT(res == 0, "Error in getting self SMACK label");
+ RUNNER_ASSERT_MSG(res == 0, "Error in getting self SMACK label");
}
std::string label_self(label_smack ? label_smack : "");
free(label_smack);
- RUNNER_ASSERT_MSG_BT(label_self == label_cookie, "No match in SMACK labels");
+ RUNNER_ASSERT_MSG(label_self == label_cookie, "No match in SMACK labels");
//TODO: here could be label change using SMACK API and checking if it
char* cookie = NULL;
int cookie_size = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG_BT(PROPER_COOKIE_SIZE == cookie_size,
+ RUNNER_ASSERT_MSG(PROPER_COOKIE_SIZE == cookie_size,
"Wrong cookie size from security-server. Size: " << cookie_size);
cookie = (char*) calloc(cookie_size, sizeof(char));
- RUNNER_ASSERT_MSG_BT(NULL != cookie, "Memory allocation error");
+ RUNNER_ASSERT_MSG(NULL != cookie, "Memory allocation error");
//Request cookie from SS
res = security_server_request_cookie(cookie, cookie_size);
CookieUniquePtr cookie_ptr(cookie);
cookie = NULL;
- RUNNER_ASSERT_MSG_BT(res == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG(res == SECURITY_SERVER_API_SUCCESS,
"Error in requesting cookie from security-server. Result: " << res);
label_ss = security_server_get_smacklabel_cookie(cookie_ptr.get());
- RUNNER_ASSERT_MSG_BT(label_ss != NULL, "Error in getting label by cookie");
+ RUNNER_ASSERT_MSG(label_ss != NULL, "Error in getting label by cookie");
std::string label(label_ss);
free(label_ss);
- RUNNER_ASSERT_MSG_BT(label.empty(), "label_ss is not an empty string.");
+ RUNNER_ASSERT_MSG(label.empty(), "label_ss is not an empty string.");
}
char *smack_context = NULL;
pid_t pid = fork();
- RUNNER_ASSERT_MSG_BT(-1 != pid, "fork() failed");
+ RUNNER_ASSERT_ERRNO_MSG(-1 != pid, "fork() failed");
if (pid == 0) {
// child
ret = smack_set_label_for_self(subject_child);
- RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS,
"smack_set__label_for_self() failed, ret: " << ret);
// initialize the errors
ret = dbus_error_is_set(&err);
if (1 == ret) {
dbus_error_free(&err);
- RUNNER_ASSERT_MSG_BT(0 == ret, "dbus_bus_get() failed, ret: " << ret);
+ RUNNER_ASSERT_MSG(0 == ret, "dbus_bus_get() failed, ret: " << ret);
}
// request our name on the bus
ret = dbus_bus_request_name(conn, DBUS_CALLER_NAME, DBUS_NAME_FLAG_REPLACE_EXISTING , &err);
if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) {
dbus_error_free(&err);
- RUNNER_ASSERT_MSG_BT(DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret,
+ RUNNER_ASSERT_MSG(DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret,
"dbus_bus_request_name() failed, ret: " << ret);
}
DBUS_SMACK_INTERFACE,
DBUS_SMACK_METHOD);
- RUNNER_ASSERT_MSG_BT(NULL != msg,
+ RUNNER_ASSERT_MSG(NULL != msg,
"dbus_message_new_method_call() failed, ret: " << ret);
// append arguments, we need SMACK context for our parent process "test.method.server"
dbus_message_iter_init_append(msg, &args);
ret = dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &dbus_server_name);
- RUNNER_ASSERT_MSG_BT(1 == ret, "Out of memory");
+ RUNNER_ASSERT_MSG(1 == ret, "Out of memory");
// wait for parent to connect to DBus
sleep(3);
// send message and get a handle for a reply
// -1 is default timeout
ret = dbus_connection_send_with_reply (conn, msg, &pending, -1);
- RUNNER_ASSERT_MSG_BT(1 == ret, "Out of memory");
- RUNNER_ASSERT_MSG_BT(NULL != pending, "Pending call null");
+ RUNNER_ASSERT_MSG(1 == ret, "Out of memory");
+ RUNNER_ASSERT_MSG(NULL != pending, "Pending call null");
dbus_connection_flush(conn);
// get the reply
msg = dbus_pending_call_steal_reply(pending);
- RUNNER_ASSERT_MSG_BT(NULL != msg, "Reply null");
+ RUNNER_ASSERT_MSG(NULL != msg, "Reply null");
// free message handle
dbus_pending_call_unref(pending);
ret = dbus_message_iter_init(msg, &iter);
- RUNNER_ASSERT_MSG_BT(0 != ret, "Message has no arguments");
+ RUNNER_ASSERT_MSG(0 != ret, "Message has no arguments");
dbus_message_iter_recurse(&iter, &var);
dbus_message_unref(msg);
dbus_connection_unref(conn);
- RUNNER_ASSERT_BT(smack_context != NULL);
+ RUNNER_ASSERT(smack_context != NULL);
ret = strcmp(smack_context, subject_parent);
- RUNNER_ASSERT_MSG_BT(0 == ret,
+ RUNNER_ASSERT_MSG(0 == ret,
"Context mismatch! context from dbus: " << smack_context);
exit(0);
} else {
// parent
ret = smack_set_label_for_self(subject_parent);
- RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS,
"smack_set_label_for_self() failed, ret: " << ret);
// initialise the error
ret = dbus_error_is_set(&err);
if (1 == ret) {
dbus_error_free(&err);
- RUNNER_ASSERT_MSG_BT(0 == ret, "dbus_bus_get() failed, ret: " << ret);
+ RUNNER_ASSERT_MSG(0 == ret, "dbus_bus_get() failed, ret: " << ret);
}
// request our name on the bus and check for errors
ret = dbus_bus_request_name(conn, DBUS_SERVER_NAME, DBUS_NAME_FLAG_REPLACE_EXISTING , &err);
if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) {
dbus_error_free(&err);
- RUNNER_ASSERT_MSG_BT(DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret,
+ RUNNER_ASSERT_MSG(DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret,
"dbus_bus_request_name() failed, ret: " << ret);
}
char *smack_context = NULL;
pid_t pid = fork();
- RUNNER_ASSERT_MSG_BT(-1 != pid, "fork() failed");
+ RUNNER_ASSERT_ERRNO_MSG(-1 != pid, "fork() failed");
if (pid == 0) {
// child
ret = dbus_error_is_set(&err);
if (1 == ret) {
dbus_error_free(&err);
- RUNNER_ASSERT_MSG_BT(false, "Failed to connect to system bus. Ret " << ret);
+ RUNNER_FAIL_MSG("Failed to connect to system bus. Ret " << ret);
}
// request our name on the bus; failure = exit with result 2
ret = dbus_bus_request_name(conn, DBUS_CALLER_NAME, DBUS_NAME_FLAG_REPLACE_EXISTING , &err);
if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) {
dbus_error_free(&err);
- RUNNER_ASSERT_MSG_BT(false, "Failed to request name on the bus. Ret " << ret);
+ RUNNER_FAIL_MSG("Failed to request name on the bus. Ret " << ret);
}
// crate a new method call for checking SMACK context from DBus interface
DBUS_SMACK_INTERFACE,
DBUS_SMACK_METHOD);
- RUNNER_ASSERT_MSG_BT(msg != NULL, "dbus_message_new_method_call() failed.");
+ RUNNER_ASSERT_MSG(msg != NULL, "dbus_message_new_method_call() failed.");
// append arguments, we need SMACK context for our parent process "test.method.server"
dbus_message_iter_init_append(msg, &args);
ret = dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &dbus_server_name);
- RUNNER_ASSERT_MSG_BT(ret == 1, "Out of memory. Ret " << ret);
+ RUNNER_ASSERT_MSG(ret == 1, "Out of memory. Ret " << ret);
// wait for parent to connect to DBus
sleep(3);
// send message and get a handle for a reply
// -1 is default timeout
ret = dbus_connection_send_with_reply (conn, msg, &pending, -1);
- RUNNER_ASSERT_MSG_BT(ret == 1, "Out of memory. Ret " << ret);
- RUNNER_ASSERT_MSG_BT(pending != NULL, "Pending call is NULL.");
+ RUNNER_ASSERT_MSG(ret == 1, "Out of memory. Ret " << ret);
+ RUNNER_ASSERT_MSG(pending != NULL, "Pending call is NULL.");
dbus_connection_flush(conn);
// get the reply
msg = dbus_pending_call_steal_reply(pending);
- RUNNER_ASSERT_MSG_BT(msg != NULL, "Failed to get the reply from bus.");
+ RUNNER_ASSERT_MSG(msg != NULL, "Failed to get the reply from bus.");
// free message handle
dbus_pending_call_unref(pending);
ret = dbus_message_iter_init(msg, &iter);
- RUNNER_ASSERT_MSG_BT(ret != 0, "DBus message has no arguments. Ret " << ret);
+ RUNNER_ASSERT_MSG(ret != 0, "DBus message has no arguments. Ret " << ret);
dbus_message_iter_recurse(&iter, &var);
while (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_INVALID) {
dbus_message_unref(msg);
dbus_connection_unref(conn);
- RUNNER_ASSERT_BT(smack_context != NULL);
+ RUNNER_ASSERT(smack_context != NULL);
ret = strcmp(smack_context, subject_parent);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Context mismatch. Context " << smack_context);
+ RUNNER_ASSERT_MSG(ret == 0, "Context mismatch. Context " << smack_context);
exit(0);
ret = dbus_error_is_set(&err);
if (1 == ret) {
dbus_error_free(&err);
- RUNNER_ASSERT_MSG_BT(0 == ret, "dbus_bus_get() failed, ret: " << ret);
+ RUNNER_ASSERT_MSG(0 == ret, "dbus_bus_get() failed, ret: " << ret);
}
// request our name on the bus and check for errors
ret = dbus_bus_request_name(conn, DBUS_SERVER_NAME, DBUS_NAME_FLAG_REPLACE_EXISTING , &err);
if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret) {
dbus_error_free(&err);
- RUNNER_ASSERT_MSG_BT(DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret,
+ RUNNER_ASSERT_MSG(DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret,
"dbus_bus_request_name() failed, ret: " << ret);
}
void shift(time_t sft) {
m_shift += sft;
time_t shifted = m_original + m_shift;
- RUNNER_ASSERT_BT(0 == stime(&shifted));
+ RUNNER_ASSERT_ERRNO(0 == stime(&shifted));
}
~SystemClock() {
return;
}
- RUNNER_ASSERT_BT(0 == stime(&m_original));
+ RUNNER_ASSERT_ERRNO(0 == stime(&m_original));
}
private:
time_t m_original;
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(expire_sec == 0, "expire_sec = " << expire_sec);
- RUNNER_ASSERT_MSG_BT(max_attempt == 0, "max_attempt = " << max_attempt);
- RUNNER_ASSERT_MSG_BT(attempt == 0, "attempt = " << attempt);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
+ RUNNER_ASSERT_MSG(expire_sec == 0, "expire_sec = " << expire_sec);
+ RUNNER_ASSERT_MSG(max_attempt == 0, "max_attempt = " << max_attempt);
+ RUNNER_ASSERT_MSG(attempt == 0, "attempt = " << attempt);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
}
else
{
// TESTS:
// WITHOUT password
ret = security_server_set_pwd_validity(10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
ret = security_server_set_pwd_validity(11);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
// WITH password
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_validity(10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_validity(11);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
/**
// TESTS:
// WITHOUT password
ret = security_server_set_pwd_max_challenge(5);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
ret = security_server_set_pwd_max_challenge(6);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
// WITH password
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_max_challenge(5);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_max_challenge(6);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
/**
// 33 char password
ret = security_server_chk_pwd("abcdefghijklmnopqrstuvwxyz0123456", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
}
/**
unsigned int attempt, max_attempt, expire_sec;
ret = security_server_chk_pwd(NULL, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
ret = security_server_chk_pwd("password", NULL, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
ret = security_server_chk_pwd("password", &attempt, NULL, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
ret = security_server_chk_pwd("password", &attempt, &max_attempt, NULL);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
}
/**
// TEST
ret = security_server_chk_pwd("isthisempty", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(expire_sec == 0, expire_sec);
- RUNNER_ASSERT_MSG_BT(max_attempt == 0, max_attempt);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
+ RUNNER_ASSERT_MSG(expire_sec == 0, expire_sec);
+ RUNNER_ASSERT_MSG(max_attempt == 0, max_attempt);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
}
/**
// TEST
ret = security_server_set_pwd(NULL, NULL, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
}
/**
// TEST
// 33 char password
ret = security_server_set_pwd("abcdefghijklmnopqrstuvwxyz0123456", "abcdefghijklmnopqrstuvwxyz0123456", 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
}
/**
// TEST
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server();
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
usleep(PASSWORD_RETRY_TIMEOUT_US);
// UINT_MAX will cause api error, it is to big value
ret = security_server_set_pwd(TEST_PASSWORD, SECOND_TEST_PASSWORD, 0, UINT_MAX);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
// calculate max applicable valid days that will not be rejected by ss
// ensure, that after conversion from days to seconds in ss there will be no uint overflow
unsigned int valid_days = ((UINT_MAX - time(NULL)) / 86400) - 1;
ret = security_server_set_pwd(TEST_PASSWORD, SECOND_TEST_PASSWORD, 0, valid_days);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server();
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(TEST_PASSWORD, SECOND_TEST_PASSWORD, UINT_MAX, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server();
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(TEST_PASSWORD, "", 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server();
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
usleep(PASSWORD_RETRY_TIMEOUT_US);
std::string lng_pwd(5000, 'A');
ret = security_server_set_pwd(TEST_PASSWORD,lng_pwd.c_str(), 10, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server();
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_chk_pwd("", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server();
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
ret = security_server_set_pwd_validity(0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_validity(1);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
//When trying to set UINT_MAX we should get error.
ret = security_server_set_pwd_validity(UINT_MAX);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
ret = security_server_set_pwd_validity(2);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server();
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 2);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST:
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
- RUNNER_ASSERT_MSG_BT((expire_sec > 172795) && (expire_sec < 172805), "expire_sec = " << expire_sec);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
+ RUNNER_ASSERT_MSG((expire_sec > 172795) && (expire_sec < 172805), "expire_sec = " << expire_sec);
}
/**
// ensure, that after conversion from days to seconds in ss there will be no uint overflow
unsigned int valid_days = ((UINT_MAX - time(NULL)) / 86400) - 1;
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, valid_days);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TESTS
ret = security_server_set_pwd_max_challenge(0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_max_challenge(UINT_MAX);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_max_challenge(5);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_max_challenge(6);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
// Prepare environment
reset_security_server();
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_max_challenge(6);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
- RUNNER_ASSERT_MSG_BT(max_attempt == 6, "max_attempt = " << max_attempt);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
+ RUNNER_ASSERT_MSG(max_attempt == 6, "max_attempt = " << max_attempt);
}
/**
// Prepare environment
reset_security_server();
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_chk_pwd(TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, ret);
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server();
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
//TEST
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_chk_pwd(SECOND_TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server();
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(SECOND_TEST_PASSWORD, THIRD_TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server();
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(TEST_PASSWORD, SECOND_TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server();
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
printf("5 subtests started...");
for (i = 1; i <= 5; i++) {
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_chk_pwd(SECOND_TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
- RUNNER_ASSERT_MSG_BT(attempt == i, "attempt = " << attempt << ", expected " << i);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
+ RUNNER_ASSERT_MSG(attempt == i, "attempt = " << attempt << ", expected " << i);
}
printf("DONE\n");
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_chk_pwd(TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
- RUNNER_ASSERT_MSG_BT(attempt == 0, "ret = " << ret);
- RUNNER_ASSERT_MSG_BT(max_attempt == 10, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
+ RUNNER_ASSERT_MSG(attempt == 0, "ret = " << ret);
+ RUNNER_ASSERT_MSG(max_attempt == 10, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server();
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 1);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
printf("10 subtests started...");
for (i = 1; i <= 10; i++) {
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_chk_pwd(SECOND_TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
- RUNNER_ASSERT_MSG_BT(attempt == i, "attempt = " << attempt << ", expected " << i);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
+ RUNNER_ASSERT_MSG(attempt == i, "attempt = " << attempt << ", expected " << i);
}
// The check, that exceeds max number
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_chk_pwd(SECOND_TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MAX_ATTEMPTS_EXCEEDED, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MAX_ATTEMPTS_EXCEEDED, "ret = " << ret);
printf("DONE\n");
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_chk_pwd(TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MAX_ATTEMPTS_EXCEEDED, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MAX_ATTEMPTS_EXCEEDED, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server();
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 5, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
ret = security_server_reset_pwd(TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server();
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 5, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
std::string lng_pwd(5000, 'A');
ret = security_server_chk_pwd(lng_pwd.c_str(), &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server();
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 5, 1);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
- RUNNER_ASSERT_MSG_BT((expire_sec < 86402) && (expire_sec > 86396), "expire_sec = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
+ RUNNER_ASSERT_MSG((expire_sec < 86402) && (expire_sec > 86396), "expire_sec = " << ret);
}
/**
// Prepare environment
reset_security_server();
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 5, 1);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TESTS
ret = security_server_set_pwd_history(100);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
ret = security_server_set_pwd_history(51);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
ret = security_server_set_pwd_history(-5);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
ret = security_server_set_pwd_history(50);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_history(0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_history(INT_MAX);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
ret = security_server_set_pwd_history(INT_MIN);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
ret = security_server_set_pwd_history(10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
clean_password_dir();
ret = security_server_set_pwd_history(9);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_reset_pwd("history0", 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
printf("11 subtests started...");
for (i = 0; i < 11; i++) {
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(buf1, buf2, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
printf("DONE\n");
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd("history11", "history1", 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd("history1", "history8", 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd("history1", "history12", 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
printf("48 subtests started...");
for (i = 12; i < 60; i++) {
sprintf(buf2, "history%d", i + 1);
ret = security_server_set_pwd(buf1, buf2, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
printf("DONE\n");
usleep(i);
}
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server();
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 4, 1);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_chk_pwd(TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = gettimeofday(&cur_time, NULL);
- RUNNER_ASSERT_MSG_BT(ret > -1, ret);
+ RUNNER_ASSERT_ERRNO(ret != -1);
cur_time.tv_sec += (expire_sec + 1);
ret = settimeofday(&cur_time, NULL);
- RUNNER_ASSERT_MSG_BT(ret > -1, ret);
+ RUNNER_ASSERT_ERRNO(ret != -1);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_chk_pwd(TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXPIRED, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXPIRED, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_chk_pwd(SECOND_TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
}
/**
// TEST
ret = security_server_reset_pwd(NULL, 10, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
}
/*
int ret = security_server_chk_pwd(challenge, &attempt, &max_attempt, &expire_sec);
// validate returned value
- RUNNER_ASSERT_MSG_BT(ret == expected_result,
+ RUNNER_ASSERT_MSG(ret == expected_result,
info << "security_server_chk_pwd returned "
<< ret << " (expected: " << expected_result << ")");
// validate current attempts value
- RUNNER_ASSERT_MSG_BT(attempt == expected_current_attempt,
+ RUNNER_ASSERT_MSG(attempt == expected_current_attempt,
info << "security_server_chk_pwd returned attempt = " << attempt <<
" (expected: " << expected_current_attempt << ")");
// validate max attempt value
- RUNNER_ASSERT_MSG_BT(max_attempt == expected_max_attempt,
+ RUNNER_ASSERT_MSG(max_attempt == expected_max_attempt,
info << "security_server_chk_pwd returned max_attempt = " << max_attempt <<
" (expected: " << expected_max_attempt << ")");
- RUNNER_ASSERT_MSG_BT(expire_sec == PASSWORD_INFINITE_EXPIRATION_TIME,
+ RUNNER_ASSERT_MSG(expire_sec == PASSWORD_INFINITE_EXPIRATION_TIME,
info << "security_server_chk_pwd returned expire_sec = " << expire_sec <<
" (expected: " << PASSWORD_INFINITE_EXPIRATION_TIME << ")");
}
reset_security_server();
int ret = security_server_set_pwd(NULL, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// change max attempts number few times
std::vector<unsigned int> max_challenge_tab = {1, 4, 2};
unsigned int max_challenges = max_challenge_tab[pass];
ret = security_server_set_pwd_max_challenge(max_challenges);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// max_challenges-1 wrong password attempts
for (unsigned int attempt_nr = 1; attempt_nr < max_challenges; ++attempt_nr)
reset_security_server();
int ret = security_server_set_pwd(NULL, TEST_PASSWORD, max_challenge_more, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// missed attempts
for (unsigned int attempt = 1; attempt <= max_challenge_more; ++attempt)
// lower max_challenge
ret = security_server_set_pwd_max_challenge(max_challenge_less);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// try valid password - should pass (curr attempts is reset)
verify_chk_pwd(TEST_PASSWORD, SECURITY_SERVER_API_SUCCESS, 1, max_challenge_less);
// remove max attempts limit
ret = security_server_set_pwd_max_challenge(0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// try valid password again - should pass
verify_chk_pwd(TEST_PASSWORD, SECURITY_SERVER_API_SUCCESS, 1, 0);
// try to change the password - should pass
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(TEST_PASSWORD, SECOND_TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// validate new password
verify_chk_pwd(SECOND_TEST_PASSWORD, SECURITY_SERVER_API_SUCCESS, 1, 0);
reset_security_server();
int ret = security_server_set_pwd_history(history_depth);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_reset_pwd(TEST_PASSWORD, max_challenge, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
for (int depth = 0; depth < history_depth; ++depth) {
prev_pass = new_pass;
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(prev_pass.c_str(), new_pass.c_str(), max_challenge, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// challenge initial password
verify_chk_pwd(
const unsigned int max_challenge = 2;
int ret = security_server_set_pwd(NULL, TEST_PASSWORD, max_challenge, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// 2x correct pwd - verify that 'cuurrent attempt' isn't increased
for (unsigned int i = 0; i < max_challenge; ++i)
reset_security_server();
ret = security_server_set_pwd_history(initial_history_depth);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_reset_pwd(TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(TEST_PASSWORD, SECOND_TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(SECOND_TEST_PASSWORD, THIRD_TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST_PASSWORD, 2nd and 3rd remembered => 1st should be refused
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(THIRD_TEST_PASSWORD, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
/*
* Lower history depth. At this point SS should treat THIRD_TEST_PASSWORD as current pwd,
* and SECOND_TEST_PASSWORD as a part of history.
*/
ret = security_server_set_pwd_history(decreased_history_depth);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(THIRD_TEST_PASSWORD, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(TEST_PASSWORD, THIRD_TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
/*
* Increase history depth to 3. At this point SS should remember TEST_PASSWORD
* and THIRD_TEST_PASSWORD only.
*/
ret = security_server_set_pwd_history(increased_history_depth);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// 3rd and TEST_PASSWORD remembered => 2nd should be accepted
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(TEST_PASSWORD, SECOND_TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST_PASSWORD, 2nd and 3rd remembered => 3rd should be refused
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(SECOND_TEST_PASSWORD, THIRD_TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
}
/**
reset_security_server();
int ret = security_server_set_pwd(NULL, TEST_PASSWORD, max_challenge, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// missed attempts
for (unsigned int attempt = 1; attempt <= invalid_attempts_num; ++attempt)
attempt = max_attempt = expire_sec = UINT_MAX;
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
- RUNNER_ASSERT_MSG_BT(max_attempt == max_challenge, "max_attempt = " << max_attempt);
- RUNNER_ASSERT_MSG_BT(attempt == invalid_attempts_num, "attempt = " << attempt);
- RUNNER_ASSERT_MSG_BT(expire_sec == PASSWORD_INFINITE_EXPIRATION_TIME, "expire_sec = " <<
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
+ RUNNER_ASSERT_MSG(max_attempt == max_challenge, "max_attempt = " << max_attempt);
+ RUNNER_ASSERT_MSG(attempt == invalid_attempts_num, "attempt = " << attempt);
+ RUNNER_ASSERT_MSG(expire_sec == PASSWORD_INFINITE_EXPIRATION_TIME, "expire_sec = " <<
expire_sec);
// restart server - triggers loading password data from file
reset_security_server();
int ret = security_server_set_pwd_history(history_depth);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_reset_pwd(TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(TEST_PASSWORD, SECOND_TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(SECOND_TEST_PASSWORD, THIRD_TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(THIRD_TEST_PASSWORD, FOURTH_TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// restart server - triggers loading password data from file
restart_security_server();
// try to reuse history passwords
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(FOURTH_TEST_PASSWORD, THIRD_TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(FOURTH_TEST_PASSWORD, SECOND_TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(FOURTH_TEST_PASSWORD, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
/**
//set new history count
int ret = security_server_set_pwd_history(history_depth);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
//set new password and fill history
ret = security_server_reset_pwd(TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(TEST_PASSWORD, SECOND_TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(SECOND_TEST_PASSWORD, THIRD_TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
//make sure, that everything went OK - try setting something that would cause reuse error
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(THIRD_TEST_PASSWORD, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(THIRD_TEST_PASSWORD, SECOND_TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
//reset history limit to no history at all
ret = security_server_set_pwd_history(empty_history_depth);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
//make sure, that current password still exists in memory
//expected attempt 3 because our previous tries increased attempt counter
//make sure that it's possible to reuse old password once history limit is set to 0
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(THIRD_TEST_PASSWORD, THIRD_TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
//once again try setting earlier used passwords - now API should return success
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(THIRD_TEST_PASSWORD, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(TEST_PASSWORD, SECOND_TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
RUNNER_TEST(tc42_security_server_set_new_pwd_with_current_empty)
//set a password
int ret = security_server_set_pwd(NULL, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
//try setting different password and giving NULL as current once again
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(NULL, SECOND_TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
}
RUNNER_TEST(tc43_security_server_no_retry_timeout_is_pwd_valid)
//set a password
int ret = security_server_set_pwd(NULL, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
//do test
unsigned int attempt, max_attempt, expire_sec;
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
}
RUNNER_TEST(tc44_security_server_retry_timeout_chk_pwd)
//set a password
int ret = security_server_set_pwd(NULL, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
//do test
unsigned int attempt, max_attempt, expire_sec;
ret = security_server_chk_pwd(TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_RETRY_TIMER, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_RETRY_TIMER, "ret = " << ret);
ret = security_server_chk_pwd(TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_RETRY_TIMER, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_RETRY_TIMER, "ret = " << ret);
}
RUNNER_TEST(tc45_security_server_retry_timeout_set_pwd)
//set a password
int ret = security_server_set_pwd(NULL, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
//do test
ret = security_server_set_pwd(TEST_PASSWORD, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_RETRY_TIMER, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_RETRY_TIMER, "ret = " << ret);
ret = security_server_set_pwd(TEST_PASSWORD, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_RETRY_TIMER, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_RETRY_TIMER, "ret = " << ret);
}
RUNNER_TEST(tc46_security_server_no_retry_timeout_set_pwd_validity)
//set a password
int ret = security_server_set_pwd(NULL, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
//do test
ret = security_server_set_pwd_validity(11);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_validity(11);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
RUNNER_TEST(tc47_security_server_no_retry_timeout_reset_pwd)
//set a password
int ret = security_server_set_pwd(NULL, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
//do test
ret = security_server_reset_pwd(TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_reset_pwd(TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
RUNNER_TEST(tc48_security_server_no_retry_timeout_pwd_history)
//set a password
int ret = security_server_set_pwd(NULL, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
//do test
ret = security_server_set_pwd_history(5);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_history(5);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
RUNNER_TEST(tc49_security_server_no_retry_timeout_set_pwd_max_challenge)
//set a password
int ret = security_server_set_pwd(NULL, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
//do test
ret = security_server_set_pwd_max_challenge(5);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_max_challenge(5);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
RUNNER_TEST(tc50_security_server_set_pwd_current_pwd_with_infinite_expiration_time)
// Prepare environment
reset_security_server();
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
// Assert security server sets infinite expiration time
ret = security_server_set_pwd(TEST_PASSWORD, SECOND_TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_chk_pwd(SECOND_TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
- RUNNER_ASSERT_MSG_BT(expire_sec == PASSWORD_INFINITE_EXPIRATION_TIME,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(expire_sec == PASSWORD_INFINITE_EXPIRATION_TIME,
"invalid expiration time " << expire_sec);
clean_password_dir();
reset_security_server();
int ret = security_server_set_pwd(NULL, TEST_PASSWORD, 0, 1);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
unsigned int attempt, maxAttempt, validSec;
attempt = maxAttempt = validSec = 0;
ret = security_server_is_pwd_valid(&attempt, &maxAttempt, &validSec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret <<
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret <<
" atempt=" << attempt << " maxAttempt=" << maxAttempt << " validSec=" << validSec);
SystemClock clock(60*60*24*2);
ret = security_server_is_pwd_valid(&attempt, &maxAttempt, &validSec);
- RUNNER_ASSERT_MSG_BT((ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST) && (validSec == 0),
+ RUNNER_ASSERT_MSG((ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST) && (validSec == 0),
"ret = " << ret << " atempt=" << attempt << " maxAttempt=" << maxAttempt
<< " validSec=" << validSec);
}
reset_security_server();
int ret = security_server_set_pwd(NULL, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
unsigned int attempt, maxAttempt, validSec;
attempt = maxAttempt = validSec = 0;
ret = security_server_is_pwd_valid(&attempt, &maxAttempt, &validSec);
- RUNNER_ASSERT_MSG_BT((ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST) && (validSec == 0xffffffff), "ret = " << ret <<
+ RUNNER_ASSERT_MSG((ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST) && (validSec == 0xffffffff), "ret = " << ret <<
" atempt=" << attempt << " maxAttempt=" << maxAttempt << " validSec=" << validSec);
}
reset_security_server();
int ret = security_server_set_pwd(NULL, TEST_PASSWORD, 0, 3);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
unsigned int attempt, maxAttempt, validSec;
attempt = maxAttempt = validSec = 0;
// password shoudl be valid for 3 days == (60*60*24*3) 259200 seconds
ret = security_server_is_pwd_valid(&attempt, &maxAttempt, &validSec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
- RUNNER_ASSERT_MSG_BT((validSec > 259000) && (validSec < 260000), "validSec = " << validSec);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
+ RUNNER_ASSERT_MSG((validSec > 259000) && (validSec < 260000), "validSec = " << validSec);
SystemClock clock;
clock.shift(-60*60*24); // one day back
// password should be valid for 4 days == (60*60*24*4) 345600 seconds
ret = security_server_is_pwd_valid(&attempt, &maxAttempt, &validSec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
- RUNNER_ASSERT_MSG_BT((validSec > 345000) && (validSec < 346000), "validSec = " << validSec);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
+ RUNNER_ASSERT_MSG((validSec > 345000) && (validSec < 346000), "validSec = " << validSec);
clock.shift(-60*60*24*2); // 3 days back
// password shoudl be valid for 6 days == (60*60*24*6) 518400 seconds
ret = security_server_is_pwd_valid(&attempt, &maxAttempt, &validSec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
- RUNNER_ASSERT_MSG_BT((validSec > 518000) && (validSec < 519000), "validSec = " << validSec);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
+ RUNNER_ASSERT_MSG((validSec > 518000) && (validSec < 519000), "validSec = " << validSec);
}
int main(int argc, char *argv[])
int is_enabled;
result = security_server_app_has_privilege(app_label, APP_TYPE_WGT, permission, &is_enabled);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error calling security_server_app_has_privilege. Result: " << result);
- RUNNER_ASSERT_MSG_BT(is_enabled == is_enabled_expected,
+ RUNNER_ASSERT_MSG(is_enabled == is_enabled_expected,
"Result of security_server_app_has_privilege should be: " << is_enabled_expected);
}
DB_BEGIN
result = perm_app_uninstall(SSTP_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error uninstalling app. Result" << result);
result = perm_app_install(SSTP_APP_ID);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error installing app. Result" << result);
result = perm_app_disable_permissions(SSTP_APP_ID, APP_TYPE_WGT, SSTP_PERMS);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling app r and no r permissions. Result: " << result);
DB_END
DB_BEGIN
result = perm_app_enable_permissions(SSTP_APP_ID, APP_TYPE_WGT, SSTP_PERMS1, false);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error registering app r permissions. Result: " << result);
DB_END
DB_BEGIN
result = perm_app_enable_permissions(SSTP_APP_ID, APP_TYPE_WGT, SSTP_PERMS2, false);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error registering app r permissions. Result: " << result);
DB_END
DB_BEGIN
result = perm_app_disable_permissions(SSTP_APP_ID, APP_TYPE_WGT, SSTP_PERMS1);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling app r and no r permissions. Result: " << result);
DB_END
DB_BEGIN
result = perm_app_disable_permissions(SSTP_APP_ID, APP_TYPE_WGT, SSTP_PERMS2);
- RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
"Error disabling app r and no r permissions. Result: " << result);
DB_END
if (isSmack) {
//preapre environment
int ret = smack_set_label_for_self(g_subject.data());
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error in smack_set_label_for_self()");
+ RUNNER_ASSERT_MSG(ret == 0, "Error in smack_set_label_for_self()");
struct smack_accesses *rulesRaw = NULL;
ret = smack_accesses_new(&rulesRaw);
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error in smack_accesses_new()");
+ RUNNER_ASSERT_MSG(ret == 0, "Error in smack_accesses_new()");
SmackAccessesPtr rules(rulesRaw);
ret = smack_accesses_add(rules.get(), g_subject.data(), g_object.data(), g_rule.data());
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error in smack_accesses_add()");
+ RUNNER_ASSERT_MSG(ret == 0, "Error in smack_accesses_add()");
ret = smack_accesses_apply(rules.get());
- RUNNER_ASSERT_MSG_BT(ret == 0, "Error in smack_accesses_apply()");
+ RUNNER_ASSERT_MSG(ret == 0, "Error in smack_accesses_apply()");
}
//spawning threads
{
testFunction(true);
- RUNNER_ASSERT_MSG_BT(g_successes == g_threadsNumber,
+ RUNNER_ASSERT_MSG(g_successes == g_threadsNumber,
"Not all threads exit with success: "
<< g_successes << "/ " << g_threadsNumber
<< std::endl << "Errors:" << std::endl << g_errors);
{
testFunction(false);
- RUNNER_ASSERT_MSG_BT(g_successes == g_threadsNumber,
+ RUNNER_ASSERT_MSG(g_successes == g_threadsNumber,
"Not all threads exit with success: "
<< g_successes << "/ " << g_threadsNumber
<< std::endl << "Errors:" << std::endl << g_errors);
attempt = max_attempt = expire_sec = UINT_MAX;
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret: " << ret);
- RUNNER_ASSERT_BT(expire_sec == 0);
- RUNNER_ASSERT_BT(max_attempt == 0);
- RUNNER_ASSERT_BT(attempt == 0);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret: " << ret);
+ RUNNER_ASSERT(expire_sec == 0);
+ RUNNER_ASSERT(max_attempt == 0);
+ RUNNER_ASSERT(attempt == 0);
sleep(1);
}
SecurityServer::AccessProvider privider(TEST04_SUBJECT);
privider.applyAndSwithToUser(APP_UID, APP_GID);
} else {
- RUNNER_ASSERT_MSG_BT((ret = drop_root_privileges()) == 0,
+ RUNNER_ASSERT_MSG((ret = drop_root_privileges()) == 0,
"Failed to drop root privileges. Result: " << ret << "uid = " << getuid());
}
ret = security_server_set_pwd_validity(APP_UID);
- RUNNER_ASSERT_MSG_BT(ret == err,
+ RUNNER_ASSERT_MSG(ret == err,
"security_server_set_pwd_validity has failed,"
" ret: " << ret);
ret = security_server_set_pwd_max_challenge(5);
- RUNNER_ASSERT_MSG_BT(ret == err,
+ RUNNER_ASSERT_MSG(ret == err,
"security_server_set_pwd_max_challenge has failed,"
" ret: " << ret);
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == err_is_pwd_valid,
+ RUNNER_ASSERT_MSG(ret == err_is_pwd_valid,
"security_server_is_pwd_valid should return password exist,"
" ret: " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd("12345", "12346", 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == err,
+ RUNNER_ASSERT_MSG(ret == err,
"security_server_set_pwd has failed, ret: " << ret);
ret = security_server_reset_pwd("12346",0, 0);
- RUNNER_ASSERT_MSG_BT(ret == err,
+ RUNNER_ASSERT_MSG(ret == err,
"security_server_reset_pwd has failed, ret: " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_chk_pwd("12346", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == err,
+ RUNNER_ASSERT_MSG(ret == err,
"security_server_chk_pwd has failed, ret: " << ret);
ret = security_server_set_pwd_history(10);
- RUNNER_ASSERT_MSG_BT(ret == err,
+ RUNNER_ASSERT_MSG(ret == err,
"security_server_set_pwd_history has failed, ret: " << ret);
}
RUNNER_TEST(tc_security_server_get_gid_normal_case_trying_to_get_gid_of_tel_gprs)
{
- RUNNER_ASSERT_BT(security_server_get_gid("tel_gprs") >= 0);
+ RUNNER_ASSERT(security_server_get_gid("tel_gprs") >= 0);
}
RUNNER_TEST(tc_security_server_get_gid_empty_object_name)
{
- RUNNER_ASSERT_BT(security_server_get_gid("") == SECURITY_SERVER_API_ERROR_INPUT_PARAM);
+ RUNNER_ASSERT(security_server_get_gid("") == SECURITY_SERVER_API_ERROR_INPUT_PARAM);
}
RUNNER_TEST(tc_security_server_get_gid_wrong_object_name_teltel)
{
- RUNNER_ASSERT_BT(security_server_get_gid("teltel") == SECURITY_SERVER_API_ERROR_NO_SUCH_OBJECT);
+ RUNNER_ASSERT(security_server_get_gid("teltel") == SECURITY_SERVER_API_ERROR_NO_SUCH_OBJECT);
}
RUNNER_CHILD_TEST_SMACK(tc01a_security_server_app_give_access)
security_server_app_give_access(subject, getpid());
- RUNNER_ASSERT_BT(1 == smack_have_access(subject, object, "rwxat"));
+ RUNNER_ASSERT(1 == smack_have_access(subject, object, "rwxat"));
}
/*
// time.
sleep(1);
- RUNNER_ASSERT_BT(0 == smack_have_access(subject, object, "r----"));
- RUNNER_ASSERT_BT(0 == smack_have_access(subject, object, "-w---"));
- RUNNER_ASSERT_BT(0 == smack_have_access(subject, object, "--x--"));
- RUNNER_ASSERT_BT(0 == smack_have_access(subject, object, "---a-"));
- RUNNER_ASSERT_BT(0 == smack_have_access(subject, object, "----t"));
+ RUNNER_ASSERT(0 == smack_have_access(subject, object, "r----"));
+ RUNNER_ASSERT(0 == smack_have_access(subject, object, "-w---"));
+ RUNNER_ASSERT(0 == smack_have_access(subject, object, "--x--"));
+ RUNNER_ASSERT(0 == smack_have_access(subject, object, "---a-"));
+ RUNNER_ASSERT(0 == smack_have_access(subject, object, "----t"));
}*/
RUNNER_CHILD_TEST_SMACK(tc01c_security_server_app_give_access_no_access)
smack.add(subject, object, "-----");
smack.apply();
- RUNNER_ASSERT_MSG_BT(0 == smack_set_label_for_self(object), "Error in smack_label_for_self");
+ RUNNER_ASSERT_MSG(0 == smack_set_label_for_self(object), "Error in smack_label_for_self");
- RUNNER_ASSERT_MSG_BT(drop_root_privileges() == 0, "uid = " << getuid());
+ RUNNER_ASSERT_MSG(drop_root_privileges() == 0, "uid = " << getuid());
- RUNNER_ASSERT_BT(SECURITY_SERVER_API_ERROR_ACCESS_DENIED ==
+ RUNNER_ASSERT(SECURITY_SERVER_API_ERROR_ACCESS_DENIED ==
security_server_app_give_access(subject, getpid()));
- RUNNER_ASSERT_BT(0 == smack_have_access(subject, object, "r"));
+ RUNNER_ASSERT(0 == smack_have_access(subject, object, "r"));
}
RUNNER_TEST_SMACK(tc02_check_privilege_by_pid)
//we checking existing rule, it should return positive
ret = security_server_check_privilege_by_pid(pid, "_", "rx");
- RUNNER_ASSERT_BT(ret == SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
//we checking rule with label that not exist
ret = security_server_check_privilege_by_pid(pid, "thislabelisnotreal", "rwxat");
- RUNNER_ASSERT_BT(ret != SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT(ret != SECURITY_SERVER_API_SUCCESS);
}
RUNNER_CHILD_TEST_SMACK(tc03_check_API_passwd_allow)
provider.applyAndSwithToUser(APP_UID, APP_GID);
ret = security_server_set_pwd_validity(10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret: " << ret);
ret = security_server_set_pwd_max_challenge(5);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret: " << ret);
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret: " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(NULL, "12345", 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
ret = security_server_reset_pwd("12345",0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_chk_pwd("12345", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
ret = security_server_set_pwd_history(10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
}
RUNNER_CHILD_TEST_SMACK(tc04_check_API_passwd_denied)
provider.applyAndSwithToUser(APP_UID, APP_GID);
int ret = security_server_app_give_access(TEST07_SUBJECT, getpid());
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
}
RUNNER_CHILD_TEST_SMACK(tc08_check_API_data_share_denied)
provider.applyAndSwithToUser(APP_UID, APP_GID);
int ret = security_server_app_give_access(TEST08_SUBJECT, getpid());
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
"security_server_app_give_access should return access denied,"
" ret: " << ret);
}
int result = 0;
result = drop_root_privileges();
- RUNNER_ASSERT_MSG_BT(result == 0,
+ RUNNER_ASSERT_MSG(result == 0,
"Failed to drop root privileges. Result: " << result << "uid = " << getuid());
result = security_server_app_give_access(subject, getpid());
- RUNNER_ASSERT_MSG_BT(result == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG(result == SECURITY_SERVER_API_SUCCESS,
"Error in security_server_app_give_access. Result: " << result);
result = smack_have_access(subject, object, "rwxat");
- RUNNER_ASSERT_MSG_BT(result == -1,
+ RUNNER_ASSERT_MSG(result == -1,
"smack_have_access should return error when SMACK is off. Result: " << result);
}
//we checking existing rule, it should return positive
ret = security_server_check_privilege_by_pid(pid, "_", "rx");
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
"check_privilege_by_pid for existing label failed. Result: " << ret);
//we checking rule with label that not exist
ret = security_server_check_privilege_by_pid(pid, "thislabelisnotreal", "rwxat");
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
"check_privilege_by_pid for nonexisting label failed. Result: " << ret);
}
attempt = max_attempt = expire_sec = UINT_MAX;
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD,
"is_pwd_faild should return no password error. Result: " << ret);
- RUNNER_ASSERT_MSG_BT(expire_sec == 0, "expire_sec = " << expire_sec << ", should be 0.");
- RUNNER_ASSERT_MSG_BT(max_attempt == 0, "max_attempt = " << max_attempt << ", should be 0.");
- RUNNER_ASSERT_MSG_BT(attempt == 0, "attempt = " << attempt << ", should be 0.");
+ RUNNER_ASSERT_MSG(expire_sec == 0, "expire_sec = " << expire_sec << ", should be 0.");
+ RUNNER_ASSERT_MSG(max_attempt == 0, "max_attempt = " << max_attempt << ", should be 0.");
+ RUNNER_ASSERT_MSG(attempt == 0, "attempt = " << attempt << ", should be 0.");
return 0;
}
// drop root privileges
ret = drop_root_privileges();
- RUNNER_ASSERT_MSG_BT(ret == 0,
+ RUNNER_ASSERT_MSG(ret == 0,
"Failed to drop root privileges. Result: " << ret << "uid = " << getuid());
ret = security_server_set_pwd_validity(10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD,
"set_pwd_validity should return no password error. Result: " << ret);
ret = security_server_set_pwd_max_challenge(5);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD,
"set_pwd_max_challenge should return no password error. Result: " << ret);
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD,
"is_pwd_valid should return no password error. Result: " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd(NULL, "12345", 0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
"set_pwd failed. Result: " << ret);
ret = security_server_reset_pwd("12345",0, 0);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
"reset_pwd failed. Result: " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_chk_pwd("12345", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
"chk_pwd failed. Result: " << ret);
ret = security_server_set_pwd_history(10);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
"set_pwd_history failed. Result: " << ret);
}
// drop root privileges
ret = drop_root_privileges();
- RUNNER_ASSERT_MSG_BT(ret == 0,
+ RUNNER_ASSERT_MSG(ret == 0,
"Failed to drop root privileges. Result: " << ret << "uid = " << getuid());
ret = security_server_app_give_access(TEST07_SUBJECT, getpid());
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
"app_give_access failed. Result: " << ret);
}
/* normal param case */
ret = security_server_get_gid("tel_sim");
- RUNNER_ASSERT_MSG_BT(ret > -1, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret > -1, "ret: " << ret);
/* wrong param case */
ret = security_server_get_gid("elephony_akecall");
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_SUCH_OBJECT, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_SUCH_OBJECT, "ret: " << ret);
/* weird param case */
ret = security_server_get_gid(weird);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_SUCH_OBJECT, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_SUCH_OBJECT, "ret: " << ret);
/* null param case */
ret = security_server_get_gid(NULL);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
/* param too long case */
ret = security_server_get_gid("abcdefghijklmnopqrstuvwxyz01234");
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
/* empty param case */
ret = security_server_get_gid("");
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
}
/* from security_server_tests_server.cpp */
char *cookie = NULL;
ret = security_server_request_cookie(cookie, cookie_size);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
/* buffer size too small case */
cookie_size = 19;
char cookie2[cookie_size];
ret = security_server_request_cookie(cookie2, cookie_size);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_BUFFER_TOO_SMALL, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_BUFFER_TOO_SMALL, "ret: " << ret);
}
RUNNER_TEST(tc04_security_server_check_privilege_weird_input_case)
char *cookie = NULL;
ret = security_server_check_privilege(cookie, gid);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
char cookie2[cookie_size];
ret = security_server_request_cookie(cookie2, cookie_size);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
/* big gid case */
gid = 70666;
ret = security_server_check_privilege(cookie2, gid);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
}
RUNNER_TEST(tc05_security_server_check_privilege_by_cookie_weird_input_case)
{
/* null cookie case */
char *cookie = NULL;
ret = security_server_check_privilege_by_cookie(cookie, object, access_rights);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
/* null object case */
char *object2 = NULL;
char cookie2[cookie_size];
ret = security_server_request_cookie(cookie2, cookie_size);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
ret = security_server_check_privilege_by_cookie(cookie2, object2, access_rights);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
/* null access rights case */
access_rights = NULL;
ret = security_server_check_privilege_by_cookie(cookie2, object, access_rights);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
}
RUNNER_TEST_SMACK(tc06_security_server_check_privilege_by_sockfd_weird_input_case)
/* invalid sockfd case */
ret = security_server_check_privilege_by_sockfd(sockfd, object, access_rights);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
sockfd = 0;
/* null object case */
char *object2 = NULL;
ret = security_server_check_privilege_by_sockfd(sockfd, object2, access_rights);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
/* null access rights case */
access_rights = NULL;
ret = security_server_check_privilege_by_sockfd(sockfd, object, access_rights);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
}
RUNNER_TEST(tc07_security_server_get_cookie_pid_weird_input_case)
char *cookie = NULL;
ret = security_server_get_cookie_pid(cookie);
- RUNNER_ASSERT_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM);
+ RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM);
}
///////////////////////////
//invalid sockfd case
ret = security_server_check_privilege_by_sockfd(sockfd, object, access_rights);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
"check_privilege_by_sockfd failed. Result: " << ret);
sockfd = 0;
//null object case
char *object2 = NULL;
ret = security_server_check_privilege_by_sockfd(sockfd, object2, access_rights);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
"check_privilege_by_sockfd failed. Result: " << ret);
//null access rights case
access_rights = NULL;
ret = security_server_check_privilege_by_sockfd(sockfd, object, access_rights);
- RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
"check_privilege_by_sockfd failed. Result: " << ret);
}