#include <map>
-#include <dpl/test/test_runner.h>
+#include <tests_common.h>
#include <access_provider.h>
};
auto it = translation.find(functionName);
- RUNNER_ASSERT_MSG(it != translation.end(),
+ RUNNER_ASSERT_MSG_BT(it != translation.end(),
tracker.str() << "Error no function " << functionName << " in security server.");
m_smackAccess.add(m_mySubject, it->second, "w", tracker);
}
void AccessProvider::applyAndSwithToUser(int uid, int gid, const Tracker &tracker) {
- RUNNER_ASSERT_MSG(0 == smack_revoke_subject(m_mySubject.c_str()),
+ RUNNER_ASSERT_MSG_BT(0 == smack_revoke_subject(m_mySubject.c_str()),
tracker.str() << "Error in smack_revoke_subject(" << m_mySubject << ")");
apply(tracker);
- RUNNER_ASSERT_MSG(0 == smack_set_label_for_self(m_mySubject.c_str()),
+ RUNNER_ASSERT_MSG_BT(0 == smack_set_label_for_self(m_mySubject.c_str()),
tracker.str() << "Error in smack_set_label_for_self.");
- RUNNER_ASSERT_MSG(0 == setgid(gid),
+ RUNNER_ASSERT_MSG_BT(0 == setgid(gid),
tracker.str() << "Error in setgid.");
- RUNNER_ASSERT_MSG(0 == setuid(uid),
+ RUNNER_ASSERT_MSG_BT(0 == setuid(uid),
tracker.str() << "Error in setuid.");
}
* SystemD DBuS interface.
*/
-#include <dpl/test/test_runner.h>
#include <dpl/log/log.h>
+#include <tests_common.h>
#include <cstring>
void DBusAccess::connect() {
m_conn = dbus_bus_get_private(DBUS_BUS_SYSTEM, &m_err);
- RUNNER_ASSERT_MSG(dbus_error_is_set(&m_err) != 1, m_tracker.str() <<
+ RUNNER_ASSERT_MSG_BT(dbus_error_is_set(&m_err) != 1, m_tracker.str() <<
"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(dbus_error_is_set(&m_err) != 1, m_tracker.str() <<
+ RUNNER_ASSERT_MSG_BT(dbus_error_is_set(&m_err) != 1, m_tracker.str() <<
"Error in dbus_bus_request_name: " << m_err.message);
}
dbus_systemd_object.c_str(),
dbus_systemd_interface.c_str(),
method.c_str());
- RUNNER_ASSERT_MSG(NULL != m_msg, m_tracker.str() <<
+ RUNNER_ASSERT_MSG_BT(NULL != m_msg, m_tracker.str() <<
"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,
&dbus_systemd_srv_unit_mode);
- RUNNER_ASSERT_MSG(ret != 0, m_tracker.str() <<
+ RUNNER_ASSERT_MSG_BT(ret != 0, m_tracker.str() <<
"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(ret == 1, m_tracker.str() <<
+ RUNNER_ASSERT_MSG_BT(ret == 1, m_tracker.str() <<
"Error in dbus_connection_send_with_reply");
- RUNNER_ASSERT_MSG(NULL != m_pending, m_tracker.str() << "Pending call null");
+ RUNNER_ASSERT_MSG_BT(NULL != m_pending, m_tracker.str() << "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(NULL != m_msg, m_tracker.str() <<
+ RUNNER_ASSERT_MSG_BT(NULL != m_msg, m_tracker.str() <<
"Error in dbus_pending_call_steal_reply");
}
char *object_path = NULL;
DBusMessageIter iter;
- RUNNER_ASSERT_MSG(dbus_message_iter_init(m_msg, &iter) != 0,
+ RUNNER_ASSERT_MSG_BT(dbus_message_iter_init(m_msg, &iter) != 0,
m_tracker.str() << "Message has no arguments");
if (DBUS_TYPE_OBJECT_PATH == dbus_message_iter_get_arg_type(&iter)) {
dbus_message_iter_get_basic(&iter, &object_path);
m_jobID = std::strrchr(object_path, '/') + 1;
} else {
- RUNNER_ASSERT_MSG(false, m_tracker.str() << "No job path in msg");
+ RUNNER_ASSERT_MSG_BT(false, m_tracker.str() << "No job path in msg");
}
dbus_message_unref(m_msg);
dbus_pending_call_unref(m_pending);
if (dbus_message_is_signal(message, a->m_signal_interface.c_str(), a->m_signal_member.c_str()))
{
- RUNNER_ASSERT_MSG(dbus_message_iter_init(message, &iter) != 0, a->m_tracker.str() <<
+ RUNNER_ASSERT_MSG_BT(dbus_message_iter_init(message, &iter) != 0, a->m_tracker.str() <<
"No messages in reply");
- RUNNER_ASSERT_MSG(dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_UINT32,
+ RUNNER_ASSERT_MSG_BT(dbus_message_iter_get_arg_type(&iter) == DBUS_TYPE_UINT32,
a->m_tracker.str() << "Argument is not integer");
dbus_message_iter_get_basic(&iter, &id);
void DBusAccess::handleMsgRestartSignal() {
dbus_bus_add_match(m_conn, m_signal_match.c_str(), &m_err);
- RUNNER_ASSERT_MSG(dbus_error_is_set(&m_err) != 1, m_tracker.str() <<
+ RUNNER_ASSERT_MSG_BT(dbus_error_is_set(&m_err) != 1, m_tracker.str() <<
"Error in dbus_bus_add_match: " << m_err.message);
dbus_connection_add_filter(m_conn, signalFilter, reinterpret_cast<void *>(this), NULL);
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))
}
fclose(bt_fd);
+
+ // check if gdbbacktrace() called directly from the test
+ if (line_number == 2)
+ return "";
+
return result.str();
}
} // anonymous backtrace namespace end
#include <sys/smack.h>
-#include <dpl/test/test_runner.h>
+#include <tests_common.h>
#include <smack_access.h>
SmackAccess::SmackAccess()
: m_handle(NULL)
{
- RUNNER_ASSERT_MSG(0 == smack_accesses_new(&m_handle),
+ RUNNER_ASSERT_MSG_BT(0 == smack_accesses_new(&m_handle),
"Error in smack_accesses_new");
}
const std::string &rights,
const Tracker &tracker)
{
- RUNNER_ASSERT_MSG(0 == smack_accesses_add(m_handle,
+ RUNNER_ASSERT_MSG_BT(0 == smack_accesses_add(m_handle,
subject.c_str(),
object.c_str(),
rights.c_str()),
}
void SmackAccess::apply(const Tracker &tracker) {
- RUNNER_ASSERT_MSG(0 == smack_accesses_apply(m_handle),
+ RUNNER_ASSERT_MSG_BT(0 == smack_accesses_apply(m_handle),
tracker.str() << "Error in smack_accessses_apply.");
}
void setLabelForSelf(const int line, const char *label)
{
int ret = smack_set_label_for_self(label);
- RUNNER_ASSERT_MSG(ret == 0, "Error in smack_set_label_for_self(): " << ret << ", line: " << line);
+ RUNNER_ASSERT_MSG_BT(ret == 0, "Error in smack_set_label_for_self(): " << ret << ", line: " << line);
}
void Proc##Multi()
#define RUNNER_ASSERT_MSG_BT(test, msg) RUNNER_ASSERT_MSG(test,\
- msg + std::string("\n") + gdbbacktrace())
+ msg << gdbbacktrace())
#define RUNNER_ASSERT_BT(test) RUNNER_ASSERT_MSG_BT(test, "")
void closeFdPtr(int *fd);
Transaction() {
db_result = perm_begin();
- RUNNER_ASSERT_MSG(PC_OPERATION_SUCCESS == db_result,
+ RUNNER_ASSERT_MSG_BT(PC_OPERATION_SUCCESS == db_result,
"perm_begin returned: " << db_result);
}
DB::Transaction db_transaction;
#define DB_END } \
- RUNNER_ASSERT_MSG(PC_OPERATION_SUCCESS == DB::Transaction::db_result, \
+ RUNNER_ASSERT_MSG_BT(PC_OPERATION_SUCCESS == DB::Transaction::db_result, \
"perm_end returned: " << DB::Transaction::db_result);
// Common macros and labels used in tests
* @brief libprivilege-control tests database record check functions
*/
-#include <dpl/test/test_runner.h>
+#include <tests_common.h>
#include <privilege-control.h>
#include <sstream>
#include <string.h>
continue;
ret = base_name_from_perm(perm_list[i], permission_name);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS,
"DB: Error testing \"" << __FUNCTION__ <<
"\": permission : <" << perm_list[i] <<
"> cannot be converted to basename (iri parse error)");
"WHERE name == '" << app_name << "' ;";
m_base.execute(tracker, sql.str(), result);
- RUNNER_ASSERT_MSG(result.rows.size() == 1 && result.rows[0].size() == 1,
+ RUNNER_ASSERT_MSG_BT(result.rows.size() == 1 && result.rows[0].size() == 1,
"DB: Error testing \"" << tracker.str() << "\": querry : <" << sql.str() <<
"> returned [" << result.rows.size() << "] rows");
}
"WHERE name == '" << app_name << "' ;";
m_base.execute(tracker, sql.str(), result);
- RUNNER_ASSERT_MSG(result.rows.size() == 0,
+ RUNNER_ASSERT_MSG_BT(result.rows.size() == 0,
"DB: Error testing \"" << tracker.str() << "\": querry : <" << sql.str() <<
"> returned [" << result.rows.size() << "] rows");
}
";";
m_base.execute(tracker, sql.str(), result);
- RUNNER_ASSERT_MSG(result.rows.size() == 1,
+ RUNNER_ASSERT_MSG_BT(result.rows.size() == 1,
"DB: Error testing \"" << tracker.str() << "\": querry : <" << sql.str() <<
"> returned [" << result.rows.size() << "] rows");
}
* @brief libprivilege-control tests API for sqlite3 database access
*/
-#include <dpl/test/test_runner.h>
+#include <tests_common.h>
#include "db_sqlite.h"
Sqlite3DBase::Sqlite3DBase(const std::string& db_path, int flags)
return;
int ret = sqlite3_open_v2(m_db_path.c_str(), &m_db_handle, m_flags, VFS_NOT_USED);
- RUNNER_ASSERT_MSG(m_db_handle,
+ RUNNER_ASSERT_MSG_BT(m_db_handle,
"DB: Error testing \"" << tracker.str() <<
"\" Sqlite3DBase: Error opening the database: Unable to allocate memory.");
- RUNNER_ASSERT_MSG(ret == SQLITE_OK,
+ RUNNER_ASSERT_MSG_BT(ret == SQLITE_OK,
"DB: Error testing \"" << tracker.str() <<
"\" Sqlite3DBase: Error opening the database: " <<
sqlite3_errmsg(m_db_handle));
void Sqlite3DBase::close(const Tracker& tracker)
{
int ret = sqlite3_close(m_db_handle);
- RUNNER_ASSERT_MSG(ret == SQLITE_OK,
+ RUNNER_ASSERT_MSG_BT(ret == SQLITE_OK,
"DB: Error testing \"" << tracker.str() <<
"\" Sqlite3DBase: Error closing the database: " <<
sqlite3_errmsg(m_db_handle));
}
sqlite3_free(tmp);
- RUNNER_ASSERT_MSG(ret == SQLITE_OK || ret == SQLITE_ABORT,
+ RUNNER_ASSERT_MSG_BT(ret == SQLITE_OK || ret == SQLITE_ABORT,
"DB: Error testing \"" << tracker.str() <<
"\" Sqlite3DBase: Error executing statement <" << sql_querry << "> : " <<
errmsg);
#include <libprivilege-control_test_common.h>
#include <tests_common.h>
#include <sys/smack.h>
-#include <dpl/test/test_runner.h>
#define CANARY_LABEL "tiny_yellow_canary"
void read_gids(std::set<unsigned> &set, const char *file_path)
{
FILE *f = fopen(file_path, "r");
- RUNNER_ASSERT_MSG(f != NULL, "Unable to open file " << file_path);
+ RUNNER_ASSERT_MSG_BT(f != NULL, "Unable to open file " << file_path);
unsigned gid;
while (fscanf(f, "%u\n", &gid) == 1) {
set.insert(gid);
read_gids(groups_check, dac_file);
int groups_cnt = getgroups(0, NULL);
- RUNNER_ASSERT_MSG(groups_cnt > 0, "Wrong number of supplementary groupsCnt");
+ RUNNER_ASSERT_MSG_BT(groups_cnt > 0, "Wrong number of supplementary groupsCnt");
gid_t *groups_list = (gid_t*) calloc(groups_cnt, sizeof(gid_t));
- RUNNER_ASSERT_MSG(groups_list != NULL, "Memory allocation failed");
- RUNNER_ASSERT(-1 != getgroups(groups_cnt, groups_list));
+ RUNNER_ASSERT_MSG_BT(groups_list != NULL, "Memory allocation failed");
+ RUNNER_ASSERT_BT(-1 != getgroups(groups_cnt, groups_list));
for (int i = 0; i < groups_cnt; ++i) {
//getgroups() can return multiple number of the same group
if (groups_check.erase(groups_list[i]) == 0) {
// getgroups() may also return process' main group
if (groups_list[i] != getgid())
- RUNNER_ASSERT_MSG(false, "Application belongs to unknown group (GID=" << groups_list[i] << ")");
+ RUNNER_ASSERT_MSG_BT(false, "Application belongs to unknown group (GID=" << groups_list[i] << ")");
}
}
free(groups_list);
for (std::set<unsigned>::iterator it = groups_check.begin(); it != groups_check.end(); it++) {
groups_left.append(std::to_string(*it)).append(" ");
}
- RUNNER_ASSERT_MSG(groups_check.empty(), "Application doesn't belong to some required groups: " << groups_left);
+ RUNNER_ASSERT_MSG_BT(groups_check.empty(), "Application doesn't belong to some required groups: " << groups_left);
}
int file_exists(const char *path)
void check_app_installed(int line_no, const char *app_path)
{
- RUNNER_ASSERT_MSG(file_exists(app_path) == 0, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(file_exists(app_path) == 0, "Line: " << line_no <<
" App not installed: " << app_path);
}
/* ACCESS */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_ACCESS);
labelPtr.reset(label);
- RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
- RUNNER_ASSERT_MSG(labelPtr.get() != NULL, "ACCESS label on " << fpath << " is not set");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path");
+ RUNNER_ASSERT_MSG_BT(labelPtr.get() != NULL, "ACCESS label on " << fpath << " is not set");
result = strcmp(APPID_DIR, labelPtr.get());
- RUNNER_ASSERT_MSG(result == 0, "ACCESS label on " << fpath << " is incorrect");
+ RUNNER_ASSERT_MSG_BT(result == 0, "ACCESS label on " << fpath << " is incorrect");
/* EXEC */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_EXEC);
labelPtr.reset(label);
- RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path");
if (S_ISREG(sb->st_mode) && (sb->st_mode & S_IXUSR)) {
- RUNNER_ASSERT_MSG(labelPtr.get() != NULL, "EXEC label on " << fpath << " is not set");
+ RUNNER_ASSERT_MSG_BT(labelPtr.get() != NULL, "EXEC label on " << fpath << " is not set");
result = strcmp(APPID_DIR, labelPtr.get());
- RUNNER_ASSERT_MSG(result == 0, "EXEC label on executable file " << fpath << " is incorrect");
+ RUNNER_ASSERT_MSG_BT(result == 0, "EXEC label on executable file " << fpath << " is incorrect");
} else if (S_ISLNK(sb->st_mode)) {
struct stat buf;
char *target = realpath(fpath, NULL);
- RUNNER_ASSERT_MSG(0 == stat(target, &buf),"Stat failed for " << fpath);
+ RUNNER_ASSERT_MSG_BT(0 == stat(target, &buf),"Stat failed for " << fpath);
free(target);
if (buf.st_mode != (buf.st_mode | S_IXUSR | S_IFREG)) {
- RUNNER_ASSERT_MSG(labelPtr.get() == NULL, "EXEC label on " << fpath << " is set");
+ RUNNER_ASSERT_MSG_BT(labelPtr.get() == NULL, "EXEC label on " << fpath << " is set");
} else {
- RUNNER_ASSERT_MSG(labelPtr.get() != NULL, "EXEC label on " << fpath << " is not set");
+ RUNNER_ASSERT_MSG_BT(labelPtr.get() != NULL, "EXEC label on " << fpath << " is not set");
result = strcmp(APPID_DIR, labelPtr.get());
- RUNNER_ASSERT_MSG(result == 0, "EXEC label on link to executable file " << fpath << " is incorrect");
+ RUNNER_ASSERT_MSG_BT(result == 0, "EXEC label on link to executable file " << fpath << " is incorrect");
}
} else
- RUNNER_ASSERT_MSG(labelPtr.get() == NULL, "EXEC label on " << fpath << " is set");
+ RUNNER_ASSERT_MSG_BT(labelPtr.get() == NULL, "EXEC label on " << fpath << " is set");
/* TRANSMUTE */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_TRANSMUTE);
labelPtr.reset(label);
- RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
- RUNNER_ASSERT_MSG(labelPtr.get() == NULL, "TRANSMUTE label on " << fpath << " is set");
+ 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");
return 0;
}
/* ACCESS */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_ACCESS);
labelPtr.reset(label);
- RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path");
result = strcmp(CANARY_LABEL, labelPtr.get());
- RUNNER_ASSERT_MSG(result == 0, "ACCESS label on " << fpath << " is overwritten");
+ RUNNER_ASSERT_MSG_BT(result == 0, "ACCESS label on " << fpath << " is overwritten");
/* EXEC */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_EXEC);
labelPtr.reset(label);
- RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path");
result = strcmp(CANARY_LABEL, labelPtr.get());
- RUNNER_ASSERT_MSG(result == 0, "EXEC label on " << fpath << " is overwritten");
+ RUNNER_ASSERT_MSG_BT(result == 0, "EXEC label on " << fpath << " is overwritten");
/* TRANSMUTE */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_TRANSMUTE);
labelPtr.reset(label);
- RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
- RUNNER_ASSERT_MSG(labelPtr.get() == NULL, "TRANSMUTE label on " << fpath << " is set");
+ 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");
return 0;
}
for (int i = 0; perm_list[i] != NULL; i++) {
result = perm_app_has_permission(app_id, app_type, perm_list[i], &has_permission);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_has_permission failed with result: " << result);
- RUNNER_ASSERT_MSG(has_permission == expected_result,
+ RUNNER_ASSERT_MSG_BT(has_permission == expected_result,
"Unexpected result, perm_app_has_permission returned: " << has_permission
<< ", expected: " << expected_result);
}
{
int result;
result = smack_have_access(av_id, app_id, "rwx");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
"Error while checking " << av_id << " rwx access to "
<< app_id << " " << comment << " Result: " << result);
result = smack_have_access(av_id, app_id, "a");
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"Error while checking " << av_id << " a access to "
<< app_id << " " << comment << " Result: " << result);
result = smack_have_access(av_id, app_id, "t");
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"Error while checking " << av_id << " t access to "
<< app_id << " " << comment << " Result: " << result);
}
{
int result;
result = smack_have_access(av_id, app_id, "rwx");
- RUNNER_ASSERT_MSG(result == -1,
+ RUNNER_ASSERT_MSG_BT(result == -1,
"smack_have_access should return error (SMACK is off). Result: " << result
<< " when testing " << comment);
result = smack_have_access(av_id, app_id, "a");
- RUNNER_ASSERT_MSG(result == -1,
+ RUNNER_ASSERT_MSG_BT(result == -1,
"smack_have_access should return error (SMACK is off). Result: " << result
<< " when testing " << comment);
result = smack_have_access(av_id, app_id, "t");
- RUNNER_ASSERT_MSG(result == -1,
+ RUNNER_ASSERT_MSG_BT(result == -1,
"smack_have_access should return error (SMACK is off). Result: " << result
<< " when testing " << comment);
}
DB_BEGIN
result = perm_app_uninstall(app_id);
- RUNNER_ASSERT_MSG(result == 0, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(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(result == 0, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "Line: " << line_no <<
"Error revoking app permissions. Result: " << result);
DB_END
// Are all the permissions revoked?
- RUNNER_ASSERT_MSG(check_no_accesses(smack, rules), "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(check_no_accesses(smack, rules), "Line: " << line_no <<
"Not all permisions revoked.");
DB_BEGIN
// Cleanup - uninstall test apps
result = perm_app_uninstall(app_id);
- RUNNER_ASSERT_MSG(result == 0, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(result == 0, "Line: " << line_no <<
"perm_app_uninstall returned " << result);
DB_END
// Prepare
result = perm_app_uninstall(EFL_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_uninstall failed: " << result);
result = perm_app_install(EFL_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_install failed: " << result);
// Register a permission:
result = perm_app_setup_permissions(EFL_APP_ID, APP_TYPE_EFL, PRIVS_EFL);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error registering app permissions. Result: " << result);
DB_END
- RUNNER_ASSERT_MSG(check_all_accesses(smack, {{EFL_APP_ID,"test_book_efl", "r"}}),
+ RUNNER_ASSERT_MSG_BT(check_all_accesses(smack, {{EFL_APP_ID,"test_book_efl", "r"}}),
"SMACK accesses not granted for EFL_APP");
// Check if permission is assigned to app in db
// Cleanup
result = perm_app_uninstall(EFL_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_uninstall failed: " << result);
DB_END
// Prepare
result = perm_app_uninstall(EFL_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_uninstall failed: " << result);
result = perm_app_install(EFL_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_install failed: " << result);
// Register a permission
result = perm_app_setup_permissions(EFL_APP_ID, APP_TYPE_EFL, PRIVS_EFL);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error registering app permissions. Result: " << result);
DB_END
- RUNNER_ASSERT_MSG(check_all_accesses(smack, {{EFL_APP_ID,"test_book_efl", "r"}}),
+ RUNNER_ASSERT_MSG_BT(check_all_accesses(smack, {{EFL_APP_ID,"test_book_efl", "r"}}),
"SMACK accesses not granted for EFL_APP");
// Check if permission is assigned to app in db
// Disable a permission
result = perm_app_disable_permissions(EFL_APP_ID, APP_TYPE_EFL, PRIVS_EFL);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error disabling app permissions. Result: " << result);
DB_END
- RUNNER_ASSERT_MSG(check_no_accesses(smack, {{EFL_APP_ID,"test_book_efl", "r"}}),
+ RUNNER_ASSERT_MSG_BT(check_no_accesses(smack, {{EFL_APP_ID,"test_book_efl", "r"}}),
"SMACK accesses not disabled for EFL_APP");
// Check if permission is disabled in db
// Cleanup
result = perm_app_uninstall(EFL_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_uninstall failed: " << result);
DB_END
// Prepare
result = perm_app_uninstall(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_uninstall failed: " << result);
result = perm_app_install(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_install failed: " << result);
/**
* Test - disable all granted permissions.
// Prepare permissions that we want to disable
result = perm_app_setup_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
" Error registering app permissions. Result: " << result);
DB_END
// Are all the permissions enabled?
- RUNNER_ASSERT_MSG(check_all_accesses(smack, rules2), "Not all permisions enabled.");
+ RUNNER_ASSERT_MSG_BT(check_all_accesses(smack, rules2), "Not all permisions enabled.");
// Check if permissions are enabled in db
check_app_has_permission(WGT_APP_ID, APP_TYPE_WGT, PRIVS2, true);
// Disable permissions
result = perm_app_disable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error disabling app permissions. Result: " << result);
DB_END
// Are all the permissions disabled?
- RUNNER_ASSERT_MSG(check_no_accesses(smack, rules2), "Not all permisions disabled.");
+ RUNNER_ASSERT_MSG_BT(check_no_accesses(smack, rules2), "Not all permisions disabled.");
// Check if permission is disabled in db
check_app_has_permission(WGT_APP_ID, APP_TYPE_WGT, PRIVS2, false);
// Prepare permissions that will not be disabled
result = perm_app_setup_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
" Error adding app first permissions. Result: " << result);
// Prepare permissions that we want to disable
result = perm_app_setup_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error disabling app second permissions. Result: " << result);
DB_END
// Are all second permissions disabled?
- RUNNER_ASSERT_MSG(check_no_accesses(smack, rules2), "Not all first permisions disabled.");
+ RUNNER_ASSERT_MSG_BT(check_no_accesses(smack, rules2), "Not all first permisions disabled.");
// Are all first permissions not disabled?
- RUNNER_ASSERT_MSG(check_all_accesses(smack, rules_wgt2), "Some of second permissions disabled.");
+ RUNNER_ASSERT_MSG_BT(check_all_accesses(smack, rules_wgt2), "Some of second permissions disabled.");
// Check if second permission is disabled in db
check_app_has_permission(WGT_APP_ID, APP_TYPE_WGT, PRIVS2, false);
// Disable first permissions
result = perm_app_disable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error disabling app first permissions. Result: " << result);
DB_END
// Are all second permissions disabled?
- RUNNER_ASSERT_MSG(check_no_accesses(smack, rules_wgt2), "Not all second permisions disabled.");
+ RUNNER_ASSERT_MSG_BT(check_no_accesses(smack, rules_wgt2), "Not all second permisions disabled.");
// Check if permission is disabled in db
check_app_has_permission(WGT_APP_ID, APP_TYPE_WGT, PRIVS, false);
// Prepare permissions
result = perm_app_setup_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_R);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
" Error registering app r permissions. Result: " << result);
result = perm_app_setup_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_NO_R);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error disabling app no r permissions. Result: " << result);
DB_END
// Is any r permissions disabled?
- RUNNER_ASSERT_MSG(check_all_accesses(smack, rules2_r), "Some of r permissions disabled.");
+ RUNNER_ASSERT_MSG_BT(check_all_accesses(smack, rules2_r), "Some of r permissions disabled.");
// Are all no r permissions disabled?
- RUNNER_ASSERT_MSG(check_no_accesses(smack, rules2_no_r), "Not all no r permissions disabled.");
+ RUNNER_ASSERT_MSG_BT(check_no_accesses(smack, rules2_no_r), "Not all no r permissions disabled.");
// Check if second permission is enabled in db
check_app_has_permission(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_R, true);
// Prepare permissions
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_NO_R, 1);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
" Error adding app no r permissions. Result: " << result);
DB_END
- RUNNER_ASSERT_MSG(check_all_accesses(smack, rules2_no_r), "Not all no r permissions enabled.");
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error disabling app permissions. Result: " << result);
DB_END
- RUNNER_ASSERT_MSG(check_no_accesses(smack, rules2_r), "Not all r permissions disabled.");
+ RUNNER_ASSERT_MSG_BT(check_no_accesses(smack, rules2_r), "Not all r permissions disabled.");
// Check if permission is disabled in db
check_app_has_permission(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_R, false);
// Clean up after test:
result = perm_app_uninstall(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
DB_END
}
//install some app 1
ret = perm_app_install(APP_1);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS, "Error in perm_app_install." << ret);
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS, "Error in perm_app_install." << ret);
mkdir(APP_1_DIR, S_IRWXU | S_IRGRP | S_IXGRP);
//register settings folder for app 1
ret = perm_app_setup_path(APP_1, APP_1_DIR, APP_PATH_SETTINGS_RW );
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS, "Error in perm_app_setup_path: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS, "Error in perm_app_setup_path: " << ret);
//install "app_test" and give it appsettings privilege
ret = perm_app_install(APP_TEST);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS, "Error in perm_app_install.");
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS, "Error in perm_app_install.");
ret = perm_app_setup_permissions(APP_TEST, APP_TYPE_OSP, PRIV_APPSETTING);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS,
" Error registering app permissions. Result: " << ret);
DB_END
//check if "app_test" has an RX access to the app "app_1"
- RUNNER_ASSERT_MSG(check_all_accesses(smack, {{APP_TEST, APP_1, "rx"}}), "access denied");
+ RUNNER_ASSERT_MSG_BT(check_all_accesses(smack, {{APP_TEST, APP_1, "rx"}}), "access denied");
//check if "app_test" has an RWX access to a folder registered by "app_1"
ret = smack_getlabel(APP_1_DIR, &label, SMACK_LABEL_ACCESS );
app1DirLabelPtr.reset(label);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS,"smack_getlabel failed");
- RUNNER_ASSERT_MSG(check_all_accesses(smack, {{APP_TEST, app1DirLabelPtr.get(), "rwx"}}), "access denied to smack label: " << app1DirLabelPtr.get());
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS,"smack_getlabel failed");
+ RUNNER_ASSERT_MSG_BT(check_all_accesses(smack, {{APP_TEST, app1DirLabelPtr.get(), "rwx"}}), "access denied to smack label: " << app1DirLabelPtr.get());
DB_BEGIN
//intstall another app: "app_2"
ret = perm_app_install(APP_2);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS, "Error in perm_app_install.");
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS, "Error in perm_app_install.");
mkdir(APP_2_DIR, S_IRWXU | S_IRGRP | S_IXGRP);
//register settings folder for that "app_2"
ret = perm_app_setup_path(APP_2, APP_2_DIR, APP_PATH_SETTINGS_RW );
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS, "Error in perm_app_setup_path: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS, "Error in perm_app_setup_path: " << ret);
DB_END
//check if "app_test" has an RX access to the app "app_2"
- RUNNER_ASSERT_MSG(check_all_accesses(smack, {{APP_TEST, APP_2, "rx"}}), "access denied");
+ RUNNER_ASSERT_MSG_BT(check_all_accesses(smack, {{APP_TEST, APP_2, "rx"}}), "access denied");
//check if "app_test" has an RWX access to a folder registered by "app_2"
ret = smack_getlabel(APP_2_DIR, &label, SMACK_LABEL_ACCESS );
app2DirLabelPtr.reset(label);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS,"smack_getlabel failed");
- RUNNER_ASSERT_MSG(check_all_accesses(smack, {{APP_TEST, app2DirLabelPtr.get(), "rwx"}}), "access denies");
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS,"smack_getlabel failed");
+ RUNNER_ASSERT_MSG_BT(check_all_accesses(smack, {{APP_TEST, app2DirLabelPtr.get(), "rwx"}}), "access denies");
rmdir(APP_1_DIR);
rmdir(APP_2_DIR);
/* ACCESS */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
- RUNNER_ASSERT_MSG(label != NULL, "ACCESS label on " << fpath << " is not set");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path");
+ RUNNER_ASSERT_MSG_BT(label != NULL, "ACCESS label on " << fpath << " is not set");
result = strcmp(APPID_SHARED_DIR, label);
- RUNNER_ASSERT_MSG(result == 0, "ACCESS label on " << fpath << " is incorrect");
+ RUNNER_ASSERT_MSG_BT(result == 0, "ACCESS label on " << fpath << " is incorrect");
result = smack_have_access(APP_ID, APPID_SHARED_DIR, "rwxatl");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
"Error rwxatl access was not given shared dir. Subject: " <<
APP_ID << ". Object: " << APPID_SHARED_DIR << ". Result: " << result);
/* EXEC */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_EXEC);
- RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
- RUNNER_ASSERT_MSG(label == NULL, "EXEC label on " << fpath << " is set");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path");
+ RUNNER_ASSERT_MSG_BT(label == NULL, "EXEC label on " << fpath << " is set");
/* TRANSMUTE */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_TRANSMUTE);
- RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path");
if (S_ISDIR(sb->st_mode)) {
- RUNNER_ASSERT_MSG(label != NULL, "TRANSMUTE label on " << fpath << " is not set");
+ RUNNER_ASSERT_MSG_BT(label != NULL, "TRANSMUTE label on " << fpath << " is not set");
result = strcmp("TRUE", label);
- RUNNER_ASSERT_MSG(result == 0, "TRANSMUTE label on " << fpath << " is not set");
+ RUNNER_ASSERT_MSG_BT(result == 0, "TRANSMUTE label on " << fpath << " is not set");
} else
- RUNNER_ASSERT_MSG(label == NULL, "TRANSMUTE label on " << fpath << " is set");
+ RUNNER_ASSERT_MSG_BT(label == NULL, "TRANSMUTE label on " << fpath << " is set");
return 0;
}
/* ACCESS */
result = smack_lgetlabel(fpath, &label_gen, SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path");
- RUNNER_ASSERT_MSG(label_gen != NULL, "ACCESS label on " << fpath << " is not set");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path");
+ RUNNER_ASSERT_MSG_BT(label_gen != NULL, "ACCESS label on " << fpath << " is not set");
/* EXEC */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_EXEC);
if (result != 0) {
free(label_gen);
- RUNNER_ASSERT_MSG(false, "Could not get label for the path");
+ RUNNER_ASSERT_MSG_BT(false, "Could not get label for the path");
}
if (label != NULL) {
free(label_gen);
free(label);
- RUNNER_ASSERT_MSG(false, "EXEC label on " << fpath << " is set.");
+ RUNNER_ASSERT_MSG_BT(false, "EXEC label on " << fpath << " is set.");
}
/* TRANSMUTE */
if (result != 0) {
free(label_gen);
free(label);
- RUNNER_ASSERT_MSG(false, "Could not get label for the path");
+ RUNNER_ASSERT_MSG_BT(false, "Could not get label for the path");
}
if (S_ISDIR(sb->st_mode)) {
if (label == NULL) {
free(label_gen);
free(label);
- RUNNER_ASSERT_MSG(false, "TRANSMUTE label on " << fpath << " is not set");
+ RUNNER_ASSERT_MSG_BT(false, "TRANSMUTE label on " << fpath << " is not set");
}
result = strcmp("TRUE", label);
if (result != 0) {
free(label_gen);
free(label);
- RUNNER_ASSERT_MSG(false, "TRANSMUTE label on " << fpath << " is not set to TRUE");
+ RUNNER_ASSERT_MSG_BT(false, "TRANSMUTE label on " << fpath << " is not set to TRUE");
}
} else if (label != NULL) {
free(label_gen);
free(label);
- RUNNER_ASSERT_MSG(false, "TRANSMUTE label on " << fpath << " is set");
+ RUNNER_ASSERT_MSG_BT(false, "TRANSMUTE label on " << fpath << " is set");
}
free(label);
if (0 > asprintf(&scanf_label_format, "%%%ds\\n", SMACK_LABEL_LEN)) {
free(label_gen);
- RUNNER_ASSERT_MSG(false, "asprintf failed");
+ RUNNER_ASSERT_MSG_BT(false, "asprintf failed");
}
file_db = fopen(labels_db_path, "r");
if (file_db == NULL) {
free(label_gen);
free(scanf_label_format);
- RUNNER_ASSERT_MSG(false, "Can not open database for apps");
+ RUNNER_ASSERT_MSG_BT(false, "Can not open database for apps");
}
while (fscanf(file_db, scanf_label_format, label_temp) == 1) {
result = smack_have_access(label_temp, label_gen, access);
fclose(file_db);
free(label_gen);
free(scanf_label_format);
- RUNNER_ASSERT_MSG(false,
+ RUNNER_ASSERT_MSG_BT(false,
"Error " << access << " access was not given for subject: "
<< label_temp << ". Result: " << result);
}
if (file_db == NULL) {
free(label_gen);
free(scanf_label_format);
- RUNNER_ASSERT_MSG(false, "Can not open database for dirs");
+ RUNNER_ASSERT_MSG_BT(false, "Can not open database for dirs");
}
free(scanf_label_format);
void osp_blahblah_check(int line_no, const std::vector<std::string> &rules)
{
std::ifstream smack_file(OSP_BLAHBLAH);
- RUNNER_ASSERT_MSG(smack_file, "Line: " << line_no << " Failed to create " << OSP_BLAHBLAH);
+ RUNNER_ASSERT_MSG_BT(smack_file, "Line: " << line_no << " Failed to create " << OSP_BLAHBLAH);
auto it = rules.begin();
std::string line;
while (std::getline(smack_file,line)) {
- RUNNER_ASSERT_MSG(it != rules.end(), "Line: " << line_no << "Additional line in file: " << line);
- RUNNER_ASSERT_MSG(*it == line, "Line: " << line_no << " " << *it << "!=" << line);
+ RUNNER_ASSERT_MSG_BT(it != rules.end(), "Line: " << line_no << "Additional line in file: " << line);
+ RUNNER_ASSERT_MSG_BT(*it == line, "Line: " << line_no << " " << *it << "!=" << line);
it++;
}
- RUNNER_ASSERT_MSG(it == rules.end(), "Line: " << line_no << " Missing line in file: " << *it);
+ RUNNER_ASSERT_MSG_BT(it == rules.end(), "Line: " << line_no << " Missing line in file: " << *it);
smack_file.close();
}
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(dac_file, "Line: " << line_no << " Failed to create " << dac_file_path);
+ RUNNER_ASSERT_MSG_BT(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(it != gids.end(), "Line: " << line_no << "Additional line in file: " << gid);
- RUNNER_ASSERT_MSG(*it == gid, "Line: " << line_no << " " << *it << "!=" << 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);
it++;
}
- RUNNER_ASSERT_MSG(it == gids.end(), "Line: " << line_no << " Missing line in file: " << *it);
+ RUNNER_ASSERT_MSG_BT(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(result == 0, "Unable to clean up Smack labels in " << TEST_APP_DIR);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to clean up 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(result == 0, "Unable to clean up Smack labels in " << TEST_NON_APP_DIR);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to clean up 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(result == 0, "perm_app_setup_path() failed");
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_setup_path() failed");
DB_END
result = nftw(TEST_APP_DIR, &nftw_check_labels_app_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG(result == 0, "Unable to check Smack labels for app dir");
+ RUNNER_ASSERT_MSG_BT(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(result == 0, "Unable to check Smack labels for non-app dir");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to check Smack labels for non-app dir");
}
RUNNER_TEST_SMACK(privilege_control03_app_label_shared_dir)
DB_BEGIN
result = perm_app_install(APP_ID);
- RUNNER_ASSERT_MSG(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
result = perm_app_setup_path(APP_ID, TEST_APP_DIR, APP_PATH_GROUP_RW, APP_ID);
- RUNNER_ASSERT_MSG(result != 0, "perm_app_setup_path(APP_ID, APP_ID) didn't fail");
+ RUNNER_ASSERT_MSG_BT(result != 0, "perm_app_setup_path(APP_ID, APP_ID) didn't fail");
DB_END
result = nftw(TEST_APP_DIR, &nftw_remove_labels, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG(result == 0, "Unable to clean up Smack labels in " << TEST_APP_DIR);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to clean up 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(result == 0, "Unable to clean up Smack labels in " << TEST_NON_APP_DIR);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to clean up Smack labels in " << TEST_NON_APP_DIR);
DB_BEGIN
result = perm_app_setup_path(APP_ID, TEST_APP_DIR, APP_PATH_GROUP_RW, APPID_SHARED_DIR);
- RUNNER_ASSERT_MSG(result == 0, "perm_app_setup_path() failed");
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_setup_path() failed");
DB_END
result = nftw(TEST_APP_DIR, &nftw_check_labels_app_shared_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG(result == 0, "Unable to check Smack labels for shared app dir");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to check Smack labels for shared app dir");
result = nftw(TEST_NON_APP_DIR, &nftw_check_labels_non_app_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG(result == 0, "Unable to check Smack labels for non-app dir");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to check Smack labels for non-app dir");
DB_BEGIN
result = perm_app_uninstall(APP_ID);
- RUNNER_ASSERT_MSG(result == 0, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
DB_END
}
DB_BEGIN
result = perm_app_uninstall(APP_ID);
- RUNNER_ASSERT_MSG(result == 0, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
result = perm_app_install(APP_ID);
- RUNNER_ASSERT_MSG(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
result = perm_app_setup_permissions(APP_ID, APP_TYPE_EFL, PRIVS_EFL);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
" perm_app_setup_permissions failed with result: " << result);
DB_END
// Check if the accesses are realy applied..
result = test_have_all_accesses(rules_efl);
- RUNNER_ASSERT_MSG(result == 1, "Permissions not added.");
+ RUNNER_ASSERT_MSG_BT(result == 1, "Permissions not added.");
DB_BEGIN
result = perm_app_uninstall(APP_ID);
- RUNNER_ASSERT_MSG(result == 0, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
DB_END
}
DB_BEGIN
result = perm_app_uninstall(app_id);
- RUNNER_ASSERT_MSG(result == 0, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(result == 0, "Line: " << line_no <<
" perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
result = perm_app_install(app_id);
- RUNNER_ASSERT_MSG(result == 0, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(result == 0, "Line: " << line_no <<
" perm_app_install returned " << result << ". Errno: " << strerror(errno));
// TEST:
result = perm_app_setup_permissions(app_id, APP_TYPE, privileges);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "Line: " << line_no <<
" Error registering app permissions. Result: " << result);
DB_END
result = test_have_all_accesses(rules);
- RUNNER_ASSERT_MSG(result == 1, "Permissions not added.");
+ RUNNER_ASSERT_MSG_BT(result == 1, "Permissions not added.");
result = perm_app_set_privilege(app_id, type, app_path);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "Line: " << line_no <<
" 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(result >= 0, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(result >= 0, "Line: " << line_no <<
" Error getting current process label");
- RUNNER_ASSERT_MSG(label != NULL, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(label != NULL, "Line: " << line_no <<
" Process label is not set");
result = strcmp(app_id, label);
- RUNNER_ASSERT_MSG(result == 0, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(result == 0, "Line: " << line_no <<
" Process label " << label << " is incorrect");
check_groups(dac_file);
// argument validation
result = perm_add_api_feature(APP_TYPE_OSP, NULL, NULL, NULL, 0);
- RUNNER_ASSERT(result == PC_ERR_INVALID_PARAM);
+ RUNNER_ASSERT_BT(result == PC_ERR_INVALID_PARAM);
result = perm_add_api_feature(APP_TYPE_OSP,"", NULL, NULL, 0);
- RUNNER_ASSERT(result == PC_ERR_INVALID_PARAM);
+ RUNNER_ASSERT_BT(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(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
// empty rules
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[0].c_str(), { NULL }, NULL, 0);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[1].c_str(), (const char*[]) { "", NULL }, NULL, 0);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[2].c_str(), (const char*[]) { " \t\n", "\t \n", "\n\t ", NULL }, NULL, 0);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
// malformed rules
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[3].c_str(), (const char*[]) { "malformed", NULL }, NULL, 0);
- RUNNER_ASSERT_MSG(result == PC_ERR_INVALID_PARAM, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_ERR_INVALID_PARAM, "perm_add_api_feature returned: " << result);
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[4].c_str(), (const char*[]) { "malformed malformed", NULL }, NULL, 0);
- RUNNER_ASSERT_MSG(result == PC_ERR_INVALID_PARAM, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_ERR_INVALID_PARAM, "perm_add_api_feature returned: " << result);
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[5].c_str(), (const char*[]) { "-malformed malformed rwxat", NULL }, NULL, 0);
- RUNNER_ASSERT_MSG(result == PC_ERR_INVALID_PARAM, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_ERR_INVALID_PARAM, "perm_add_api_feature returned: " << result);
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[6].c_str(), (const char*[]) { "~/\"\\ malformed rwxat", NULL }, NULL, 0);
- RUNNER_ASSERT_MSG(result == PC_ERR_INVALID_PARAM, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_ERR_INVALID_PARAM, "perm_add_api_feature returned: " << result);
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[7].c_str(), (const char*[]) { "subject object rwxat something else", NULL }, NULL, 0);
- RUNNER_ASSERT_MSG(result == PC_ERR_INVALID_PARAM, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_ERR_INVALID_PARAM, "perm_add_api_feature returned: " << result);
// correct rules
"",
NULL
}, NULL, 0);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[9].c_str(), (const char*[]) {
"Sub::jE,ct ~APP~ a-rwxl",
NULL
}, NULL, 0);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[10].c_str(), (const char*[]) {
"Sub::sjE,ct ~APP~ a-RwXL", // TODO This fails.
NULL
}, NULL, 0);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
// TODO For now identical/complementary rules are not merged.
"",
NULL
}, NULL, 0);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
// empty group ids
result = perm_add_api_feature(APP_TYPE_OSP, BLAHBLAH_FEATURE[12].c_str(), (const char*[]) {"~APP~ b a",NULL},(const gid_t[]) {0,1,2},0);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
result = file_exists(OSP_BLAHBLAH_DAC[12].c_str());
- RUNNER_ASSERT(result == -1);
+ RUNNER_ASSERT_BT(result == -1);
remove_smack_files();
// valid group ids
result = perm_add_api_feature(APP_TYPE_OSP,BLAHBLAH_FEATURE[13].c_str(), (const char*[]) {"~APP~ b a",NULL},(const gid_t[]) {0,1,2},3);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG_BT(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(), (const char*[]) {"~APP~ b a",NULL},(const gid_t[]) {0,1,2},1);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG_BT(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(), (const char*[]) {"~APP~ b a",NULL},(const gid_t[]) {1,1,1},3);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_add_api_feature returned: " << result);
+ RUNNER_ASSERT_MSG_BT(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();
perm_app_uninstall(APP_ID);
result = perm_app_install(APP_ID);
- RUNNER_ASSERT_MSG(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
// try install second time app with the same ID - it should pass.
result = perm_app_install(APP_ID);
- RUNNER_ASSERT_MSG(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
DB_END
}
DB_BEGIN
result = perm_app_uninstall(APP_ID);
- RUNNER_ASSERT_MSG(result == 0, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
DB_END
// Adding two apps before antivir
result = perm_app_install(APP_TEST_APP_1);
- RUNNER_ASSERT_MSG(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
result = perm_app_install(APP_TEST_APP_2);
- RUNNER_ASSERT_MSG(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
// Adding antivir
result = app_register_av(APP_TEST_AV_1);
- RUNNER_ASSERT_MSG(result == 0, "app_register_av returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "app_register_av returned " << result << ". Errno: " << strerror(errno));
DB_END
// Adding third app
result = perm_app_install(APP_TEST_APP_3);
- RUNNER_ASSERT_MSG(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
DB_END
// Adding second antivir
result = app_register_av(APP_TEST_AV_2);
- RUNNER_ASSERT_MSG(result == 0, "app_register_av returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "app_register_av returned " << result << ". Errno: " << strerror(errno));
// Checking app accesses
checkOnlyAvAccess(APP_TEST_AV_1, APP_TEST_APP_1, "app_register_av(APP_TEST_AV_2)");
DB_BEGIN
result = perm_app_uninstall(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
result = perm_app_install(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
result = perm_app_setup_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == 1, "Permissions not added.");
+ RUNNER_ASSERT_MSG_BT(result == 1, "Permissions not added.");
// Check if permission is assigned to app in db
check_app_has_permission(WGT_APP_ID, APP_TYPE_WGT, PRIVS2, true);
// Clean up
result = perm_app_revoke_permissions(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
DB_END
DB_BEGIN
result = perm_app_setup_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
" Error registering app permissions. Result: " << result);
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2, 0);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == 1, "Permissions not added.");
+ RUNNER_ASSERT_MSG_BT(result == 1, "Permissions not added.");
// Check if permission is assigned to app in db
check_app_has_permission(WGT_APP_ID, APP_TYPE_WGT, PRIVS2, true);
// Clean up
result = perm_app_revoke_permissions(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
DB_END
DB_BEGIN
result = perm_app_setup_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_R_AND_NO_R);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == 1, "Permissions not added.");
+ RUNNER_ASSERT_MSG_BT(result == 1, "Permissions not added.");
// Check if permissions are assigned to app in db
check_app_has_permission(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_R_AND_NO_R, true);
// Clean up
result = perm_app_revoke_permissions(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
DB_END
// Register permission for rules 2 no r
result = perm_app_setup_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_NO_R);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == 1, "Permissions without r not added.");
+ RUNNER_ASSERT_MSG_BT(result == 1, "Permissions without r not added.");
DB_BEGIN
// Register permission for rules 2
result = perm_app_setup_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == 1, "Permissions all not added.");
+ RUNNER_ASSERT_MSG_BT(result == 1, "Permissions all not added.");
DB_BEGIN
// Clean up
result = perm_app_revoke_permissions(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
/**
// Enable permission for rules 2 no r
result = perm_app_setup_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_NO_R);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == 1, "Permissions without r not added.");
+ RUNNER_ASSERT_MSG_BT(result == 1, "Permissions without r not added.");
DB_BEGIN
// Enable permission for rules 2
result = perm_app_setup_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2_R);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == 1, "Permissions with only r not added.");
+ RUNNER_ASSERT_MSG_BT(result == 1, "Permissions with only r not added.");
DB_BEGIN
// Clean up
result = perm_app_revoke_permissions(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
// Clean up after test:
result = perm_app_uninstall(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(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(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
// Prepare permissions to reset
result = perm_app_setup_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
" Error registering app permissions. Result: " << result);
// Reset permissions
result = perm_app_reset_permissions(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == 1, "Not all permissions added.");
+ RUNNER_ASSERT_MSG_BT(result == 1, "Not all permissions added.");
DB_BEGIN
// Disable permissions
result = perm_app_revoke_permissions(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error disabling app permissions. Result: " << result);
result = perm_app_uninstall(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == 0, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
DB_END
}
DB_BEGIN
result = perm_app_revoke_permissions(APP_FRIEND_1);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
result = perm_app_revoke_permissions(APP_FRIEND_2);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
perm_app_uninstall(APP_FRIEND_1);
// Installing friends to be
result = perm_app_install(APP_FRIEND_1);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
" Error installing first app. Result: " << result);
result = perm_app_install(APP_FRIEND_2);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
" Error installing second app. Result: " << result);
// Making friends
result = perm_app_add_friend(APP_FRIEND_1, APP_FRIEND_2);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
" Error making friends. Errno: " << result);
DB_END
// Checking if friends were made
result = smack_have_access(APP_FRIEND_1, APP_FRIEND_2, "wrxat");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
" Error first one sided friednship failed. Result: " << result);
result = smack_have_access(APP_FRIEND_2, APP_FRIEND_1, "wrxat");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
" Error second one sided friednship failed. Result: " << result);
DB_BEGIN
// Clean up
result = perm_app_revoke_permissions(APP_FRIEND_1);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
result = perm_app_revoke_permissions(APP_FRIEND_2);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
perm_app_uninstall(APP_FRIEND_1);
// Installing one friend
result = perm_app_install(APP_FRIEND_1);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
" Error installing first app. Errno: " << result);
// Adding imaginary friend as second
result = perm_app_add_friend(APP_FRIEND_1, APP_FRIEND_2);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
" Error making friends (first) with imaginairy friend failed. Result: "
<< result);
// Adding imaginary friend as first
result = perm_app_add_friend(APP_FRIEND_2, APP_FRIEND_1);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
" Error making friends (second) with imaginairy friend failed. Result: "
<< result);
// Clean up
result = perm_app_revoke_permissions(APP_FRIEND_1);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
result = perm_app_revoke_permissions(APP_FRIEND_2);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
perm_app_uninstall(APP_FRIEND_1);
// Installing friends to be
result = perm_app_install(APP_FRIEND_1);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
" Error installing first app. Result: " << result);
result = perm_app_install(APP_FRIEND_2);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
" Error installing second app. Result: " << result);
DB_END
{
// Adding rules before making friends
result = smack_accesses_new(&rulesFriend);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in smack_accesses_new. Result: " << result);
result = smack_accesses_add(rulesFriend,
APP_FRIEND_1, APP_FRIEND_2, accessesFriend[i].c_str());
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"Unable to add modify rulesFirend (first). Result: " << result);
result = smack_accesses_add(rulesFriend, APP_FRIEND_2,
APP_FRIEND_1, accessesFriend[j].c_str());
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"Unable to add modify rulesFirend (second). Result: " << result);
result = smack_accesses_apply(rulesFriend);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in smack_accesses_apply. Result: " << result);
DB_BEGIN
// Adding friends
result = perm_app_add_friend(APP_FRIEND_1, APP_FRIEND_2);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
" Error making friends. Result: " << result);
DB_END
// Checking if friends were made
result = smack_have_access(APP_FRIEND_1, APP_FRIEND_2, "wrxat");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
" Error first one sided friednship failed. Result: " << result);
result = smack_have_access(APP_FRIEND_2, APP_FRIEND_1, "wrxat");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
" Error second one sided friednship failed. Result: " << result);
// Deleting all rules between friends
// Clean up
result = perm_app_revoke_permissions(APP_FRIEND_1);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
result = perm_app_revoke_permissions(APP_FRIEND_2);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
perm_app_uninstall(APP_FRIEND_1);
ss << "s-" << getpid() << "-" << getppid();
result = smack_set_label_for_self(ss.str().c_str());
- RUNNER_ASSERT_MSG(result == 0, "smack_set_label_for_self("
+ RUNNER_ASSERT_MSG_BT(result == 0, "smack_set_label_for_self("
<< ss.str().c_str() << ") failed");
}
close(fd);
close(sock);
free(smack_label);
- RUNNER_ASSERT_MSG(0, "smack_new_label_from_self() failed");
+ 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(0, "write() failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(0, "write() failed: " << strerror(errno));
}
close(fd);
free(smack_label);
unlink(SOCK_PATH);
pid = fork();
- RUNNER_ASSERT_MSG(pid >= 0, "Fork failed");
+ RUNNER_ASSERT_MSG_BT(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(sock >= 0, "socket failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(sock >= 0, "socket failed: " << strerror(errno));
result = bind(sock,
(struct sockaddr*) &sockaddr, sizeof(struct sockaddr_un));
if (result != 0) {
close(sock);
- RUNNER_ASSERT_MSG(0, "bind failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(0, "bind failed: " << strerror(errno));
}
result = listen(sock, 1);
if (result != 0) {
close(sock);
- RUNNER_ASSERT_MSG(0, "listen failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(0, "listen failed: " << strerror(errno));
}
smack_unix_sock_server(sock);
smack_unix_sock_server(sock);
pid = fork();
- RUNNER_ASSERT_MSG(pid >= 0, "Fork failed");
+ RUNNER_ASSERT_MSG_BT(pid >= 0, "Fork failed");
/* Now running two concurrent servers.
Test if socket label was unaffected by fork() */
smack_unix_sock_server(sock);
char *smack_label2;
sock = socket(AF_UNIX, SOCK_STREAM, 0);
- RUNNER_ASSERT_MSG(sock >= 0,
+ RUNNER_ASSERT_MSG_BT(sock >= 0,
"socket failed: " << strerror(errno));
result = connect(sock,
(struct sockaddr*) &sockaddr, sizeof(struct sockaddr_un));
if (result != 0) {
close(sock);
- RUNNER_ASSERT_MSG(0, "connect failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(0, "connect failed: " << strerror(errno));
}
alarm(2);
alarm(0);
if (result < 0) {
close(sock);
- RUNNER_ASSERT_MSG(0, "read failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(0, "read failed: " << strerror(errno));
}
smack_label1[result] = '\0';
smack_label2 = perm_app_id_from_socket(sock);
if (smack_label2 == NULL) {
close(sock);
- RUNNER_ASSERT_MSG(0, "perm_app_id_from_socket failed");
+ RUNNER_ASSERT_MSG_BT(0, "perm_app_id_from_socket failed");
}
result = strcmp(smack_label1, smack_label2);
if (result != 0) {
close(sock);
- RUNNER_ASSERT_MSG(0, "smack labels differ: '" << smack_label1
+ RUNNER_ASSERT_MSG_BT(0, "smack labels differ: '" << smack_label1
<< "' != '" << smack_label2 << "-" << random() << "'");
}
close(sock);
DB_BEGIN
- RUNNER_ASSERT(PC_OPERATION_SUCCESS == perm_app_setup_path("somepackageid", path1, APP_PATH_ANY_LABEL, label1));
+ RUNNER_ASSERT_BT(PC_OPERATION_SUCCESS == perm_app_setup_path("somepackageid", path1, APP_PATH_ANY_LABEL, label1));
DB_END
- RUNNER_ASSERT(0 == smack_lgetlabel(path3, &label, SMACK_LABEL_ACCESS));
+ RUNNER_ASSERT_BT(0 == smack_lgetlabel(path3, &label, SMACK_LABEL_ACCESS));
labelPtr.reset(label);
label = NULL;
- RUNNER_ASSERT(0 == strcmp(labelPtr.get(), label1));
+ RUNNER_ASSERT_BT(0 == strcmp(labelPtr.get(), label1));
DB_BEGIN
- RUNNER_ASSERT(PC_OPERATION_SUCCESS == perm_app_setup_path("somepackageid", path1, APP_PATH_ANY_LABEL, label2));
+ RUNNER_ASSERT_BT(PC_OPERATION_SUCCESS == perm_app_setup_path("somepackageid", path1, APP_PATH_ANY_LABEL, label2));
DB_END
- RUNNER_ASSERT(0 == smack_lgetlabel(path4, &label, SMACK_LABEL_EXEC));
+ RUNNER_ASSERT_BT(0 == smack_lgetlabel(path4, &label, SMACK_LABEL_EXEC));
labelPtr.reset(label);
label = NULL;
- RUNNER_ASSERT(0 == strcmp(labelPtr.get(), label2));
+ RUNNER_ASSERT_BT(0 == strcmp(labelPtr.get(), label2));
- RUNNER_ASSERT(0 == smack_lgetlabel(path1, &label, SMACK_LABEL_EXEC));
+ RUNNER_ASSERT_BT(0 == smack_lgetlabel(path1, &label, SMACK_LABEL_EXEC));
labelPtr.reset(label);
label = NULL;
- RUNNER_ASSERT(labelPtr.get() == NULL);
+ RUNNER_ASSERT_BT(labelPtr.get() == NULL);
}
RUNNER_TEST_SMACK(privilege_control17_appsettings_privilege)
DB_BEGIN
result = perm_app_uninstall(APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "Line: " << line_no <<
" Error in perm_app_uninstall." << result);
result = perm_app_install(APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "Line: " << line_no <<
" Error in perm_app_install." << result);
DB_END
result = nftw(TEST_APP_DIR, &nftw_remove_labels, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG(result == 0, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(result == 0, "Line: " << line_no <<
" Unable to clean up 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(result == 0, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(result == 0, "Line: " << line_no <<
" Unable to clean up Smack labels in " << TEST_NON_APP_DIR);
DB_BEGIN
result = perm_app_setup_path(APP_ID, TEST_APP_DIR, PATH_TYPE);
- RUNNER_ASSERT_MSG(result == 0, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(result == 0, "Line: " << line_no <<
" perm_app_setup_path() failed");
DB_END
result = nftw(TEST_NON_APP_DIR, &nftw_check_labels_non_app_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG(result == 0, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(result == 0, "Line: " << line_no <<
" Unable to check Smack labels for non-app dir");
DB_BEGIN
result = perm_app_uninstall(APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "Line: " << line_no <<
" Error in perm_app_uninstall." << result);
DB_END
DB_BEGIN
result = perm_app_uninstall(APP_NPRUNTIME);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "Error in perm_app_uninstall. " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "Error in perm_app_uninstall. " << result);
result = perm_app_install(APP_NPRUNTIME);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "Error in perm_app_install. " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "Error in perm_app_install. " << result);
result = perm_app_setup_path(APP_NPRUNTIME, APP_NPRUNTIME_FILE, PERM_APP_PATH_NPRUNTIME);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "Error in perm_app_setup_path. " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "Error in perm_app_setup_path. " << result);
DB_END
- RUNNER_ASSERT(0 == smack_lgetlabel(APP_NPRUNTIME_FILE, &label, SMACK_LABEL_EXEC));
+ RUNNER_ASSERT_BT(0 == smack_lgetlabel(APP_NPRUNTIME_FILE, &label, SMACK_LABEL_EXEC));
labelPtr.reset(label);
label = NULL;
- RUNNER_ASSERT(0 == strcmp(labelPtr.get(), nptargetlabel.c_str()));
+ RUNNER_ASSERT_BT(0 == strcmp(labelPtr.get(), nptargetlabel.c_str()));
// Rules to test
const std::vector< std::vector<std::string> > np_rules = {
// Test smack accesses
result = test_have_all_accesses(np_rules);
- RUNNER_ASSERT_MSG(result == 1, "Not all permissions added.");
+ RUNNER_ASSERT_MSG_BT(result == 1, "Not all permissions added.");
DB_BEGIN
result = perm_app_uninstall(APP_NPRUNTIME);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "Error in perm_app_uninstall. " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "Error in perm_app_uninstall. " << result);
DB_END
}
perm_app_uninstall(APP_ID);
result = perm_app_install(APP_ID);
- RUNNER_ASSERT_MSG(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
result = perm_app_install(APP_TEST_APP_1);
- RUNNER_ASSERT_MSG(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_install returned " << result << ". Errno: " << strerror(errno));
DB_END
DB_BEGIN
result = perm_app_setup_permissions(APP_ID, APP_TYPE_WGT, (const char**) &perm);
- RUNNER_ASSERT_MSG(result == 0, "app_register_permissions failed: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "app_register_permissions failed: " << result);
result = perm_app_setup_permissions(APP_TEST_APP_1, APP_TYPE_WGT, (const char**) &perm);
- RUNNER_ASSERT_MSG(result == 0, "app_register_permissions failed: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "app_register_permissions failed: " << result);
DB_END
file = fopen(SMACK_STARTUP_RULES_FILE, "r");
- RUNNER_ASSERT_MSG(file != NULL, "File open failed: " << SMACK_STARTUP_RULES_FILE << " : " << file << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(file != NULL, "File open failed: " << SMACK_STARTUP_RULES_FILE << " : " << file << ". Errno: " << strerror(errno));
result = asprintf(&single_line_format, "%%%ds %%%ds %%%ds %%%ds\\n", SMACK_LABEL_LEN, SMACK_LABEL_LEN, SMACK_ACC_LEN, SMACK_ACC_LEN);
fclose(file);
file = NULL;
- RUNNER_ASSERT_MSG(pass_1 == 1, "Rule " << EARLY_RULE_SUBJECT << " " << APP_ID << " " << EARLY_RULE_RIGHTS << " not found");
- RUNNER_ASSERT_MSG(pass_2 == 1, "Rule " << EARLY_RULE_SUBJECT << " " << APP_TEST_APP_1 << " " << EARLY_RULE_RIGHTS << " not found");
+ RUNNER_ASSERT_MSG_BT(pass_1 == 1, "Rule " << EARLY_RULE_SUBJECT << " " << APP_ID << " " << EARLY_RULE_RIGHTS << " not found");
+ RUNNER_ASSERT_MSG_BT(pass_2 == 1, "Rule " << EARLY_RULE_SUBJECT << " " << APP_TEST_APP_1 << " " << EARLY_RULE_RIGHTS << " not found");
// Checking if "early rule" for APP_ID was really removed
// We also should make sure that "early rules" for other apps wasn't removed
DB_BEGIN
result = perm_app_uninstall(APP_ID);
- RUNNER_ASSERT_MSG(result == 0, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
DB_END
pass_1 = 1;
pass_2 = 0;
file = fopen(SMACK_STARTUP_RULES_FILE, "r");
- RUNNER_ASSERT_MSG(file != NULL, "File open failed: " << SMACK_STARTUP_RULES_FILE << " : " << file << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(file != NULL, "File open failed: " << SMACK_STARTUP_RULES_FILE << " : " << file << ". Errno: " << strerror(errno));
while(fscanf(file, single_line_format, subject, object, rule_add, rule_remove) == 4) {
if(strncmp(subject, EARLY_RULE_SUBJECT, SMACK_LABEL_LEN) == 0 && strncmp(object, APP_ID, SMACK_LABEL_LEN) == 0) {
fclose(file);
file = NULL;
- RUNNER_ASSERT_MSG(pass_1 == 1, "Rule " << EARLY_RULE_SUBJECT << " " << APP_ID << " " << EARLY_RULE_RIGHTS << " found");
- RUNNER_ASSERT_MSG(pass_2 == 1, "Rule " << EARLY_RULE_SUBJECT << " " << APP_TEST_APP_1 << " " << EARLY_RULE_RIGHTS << " not found");
+ RUNNER_ASSERT_MSG_BT(pass_1 == 1, "Rule " << EARLY_RULE_SUBJECT << " " << APP_ID << " " << EARLY_RULE_RIGHTS << " found");
+ RUNNER_ASSERT_MSG_BT(pass_2 == 1, "Rule " << EARLY_RULE_SUBJECT << " " << APP_TEST_APP_1 << " " << EARLY_RULE_RIGHTS << " not found");
// Removing and checking "early rule" for APP_TEST_APP_1
DB_BEGIN
result = perm_app_uninstall(APP_TEST_APP_1);
- RUNNER_ASSERT_MSG(result == 0, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
DB_END
pass_1 = 1;
pass_2 = 1;
file = fopen(SMACK_STARTUP_RULES_FILE, "r");
- RUNNER_ASSERT_MSG(file != NULL, "File open failed: " << SMACK_STARTUP_RULES_FILE << " : " << file << ". Errno: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(file != NULL, "File open failed: " << SMACK_STARTUP_RULES_FILE << " : " << file << ". Errno: " << strerror(errno));
while(fscanf(file, single_line_format, subject, object, rule_add, rule_remove) == 4) {
if(strncmp(subject, EARLY_RULE_SUBJECT, SMACK_LABEL_LEN) == 0 && strncmp(object, APP_ID, SMACK_LABEL_LEN) == 0) {
free(single_line_format);
fclose(file);
- RUNNER_ASSERT_MSG(pass_1 == 1, "Rule " << EARLY_RULE_SUBJECT << " " << APP_ID << " " << EARLY_RULE_RIGHTS << " found");
- RUNNER_ASSERT_MSG(pass_2 == 1, "Rule " << EARLY_RULE_SUBJECT << " " << APP_TEST_APP_1 << " " << EARLY_RULE_RIGHTS << " found");
+ RUNNER_ASSERT_MSG_BT(pass_1 == 1, "Rule " << EARLY_RULE_SUBJECT << " " << APP_ID << " " << EARLY_RULE_RIGHTS << " found");
+ RUNNER_ASSERT_MSG_BT(pass_2 == 1, "Rule " << EARLY_RULE_SUBJECT << " " << APP_TEST_APP_1 << " " << EARLY_RULE_RIGHTS << " found");
}
/**
struct stat filestat;
result = stat(filename, &filestat);
- RUNNER_ASSERT_MSG(result == 0, "NFTW error: Failed to get file statistics. Result: "
+ RUNNER_ASSERT_MSG_BT(result == 0, "NFTW error: Failed to get file statistics. Result: "
<< result << ", error: " << strerror(errno) << ", file: " << filename);
if(S_ISREG(filestat.st_mode)) {
result = unlink(filename);
- RUNNER_ASSERT_MSG(result == 0, "NFTW error: Failed to unlink file. Result: "
+ RUNNER_ASSERT_MSG_BT(result == 0, "NFTW error: Failed to unlink file. Result: "
<< result << ", error: " << strerror(errno) << ", file: " << filename);
} else if(S_ISDIR(filestat.st_mode)) {
result = rmdir(filename);
- RUNNER_ASSERT_MSG(result == 0, "NFTW error: Failed to remove dir. Result: "
+ RUNNER_ASSERT_MSG_BT(result == 0, "NFTW error: Failed to remove dir. Result: "
<< result << ", error: " << strerror(errno) << ", file: " << filename);
}
int result = -1;
result = mkdir(path, S_IRWXU | S_IRGRP | S_IXGRP);
- RUNNER_ASSERT_MSG(result == 0, "Can't create dir for tests. Result: " << result <<
+ RUNNER_ASSERT_MSG_BT(result == 0, "Can't create dir for tests. Result: " << result <<
", error: " << strerror(errno) << ", app_path_type: " << app_path_type);
DB_BEGIN
result = perm_app_revoke_permissions(pkg_id);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "revoke_permissions failed. Result: "
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "revoke_permissions failed. Result: "
<< result << ", app_path_type: " << app_path_type);
result = perm_app_uninstall(pkg_id);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_app_uninstall failed. Result: "
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_app_uninstall failed. Result: "
<< result << ", app_path_type: " << app_path_type);
result = perm_app_install(pkg_id);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_app_install failed. Result: "
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_app_install failed. Result: "
<< result << ", app_path_type: " << app_path_type);
result = perm_app_setup_path(pkg_id, path, app_path_type, shared_label);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_app_setup_path failed. Result: "
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_app_setup_path failed. Result: "
<< result << ", app_path_type: " << app_path_type);
DB_END
DB_BEGIN
result = perm_app_revoke_permissions(av_id);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "revoke_permissions failed. Result: "
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "revoke_permissions failed. Result: "
<< result << ", av_type: " << av_type);
result = perm_app_uninstall(av_id);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_app_uninstall failed. Result: "
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_app_uninstall failed. Result: "
<< result << ", av_type: " << av_type);
result = perm_app_install(av_id);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_app_install failed. Result: "
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_app_install failed. Result: "
<< result << ", av_type: " << av_type);
result = perm_app_setup_permissions(av_id, av_type, PRIVS_AV);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "register_permissions failed. Result: "
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "register_permissions failed. Result: "
<< result << ", av_type: " << av_type);
DB_END
//clean before test
result = nftw(APP_TEST_APP_1_DIR, nftw_remove_dir, FTW_MAX_FDS, FTW_DEPTH | FTW_PHYS);
- RUNNER_ASSERT_MSG(result == 0 || errno == ENOENT, "Failed to nftw. Result: " << result <<
+ RUNNER_ASSERT_MSG_BT(result == 0 || errno == ENOENT, "Failed to nftw. Result: " << result <<
", error " << strerror(errno));
result = nftw(APP_TEST_APP_2_DIR, nftw_remove_dir, FTW_MAX_FDS, FTW_DEPTH | FTW_PHYS);
- RUNNER_ASSERT_MSG(result == 0 || errno == ENOENT, "Failed to nftw. Result: " << result <<
+ RUNNER_ASSERT_MSG_BT(result == 0 || errno == ENOENT, "Failed to nftw. Result: " << result <<
", error " << strerror(errno));
result = nftw(APP_TEST_APP_3_DIR, nftw_remove_dir, FTW_MAX_FDS, FTW_DEPTH | FTW_PHYS);
- RUNNER_ASSERT_MSG(result == 0 || errno == ENOENT, "Failed to nftw. Result: " << result <<
+ RUNNER_ASSERT_MSG_BT(result == 0 || errno == ENOENT, "Failed to nftw. Result: " << result <<
", error " << strerror(errno));
InstallApp(APP_TEST_APP_1, APP_TEST_APP_1_DIR, app_path_type, APP_TEST_APP_1_SHARED_LABEL);
//get labels
result = smack_lgetlabel(APP_TEST_APP_1_DIR, &tmp, SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "smack_lgetlabel failed. Result: " << result
+ RUNNER_ASSERT_MSG_BT(result == 0, "smack_lgetlabel failed. Result: " << result
<< ", av_type: " << av_type << ", app_path_type: " << app_path_type);
std::string label1(tmp);
free(tmp);
result = smack_lgetlabel(APP_TEST_APP_2_DIR, &tmp, SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "smack_lgetlabel failed. Result: " << result
+ RUNNER_ASSERT_MSG_BT(result == 0, "smack_lgetlabel failed. Result: " << result
<< ", av_type: " << av_type << ", app_path_type: " << app_path_type);
std::string label2(tmp);
free(tmp);
result = smack_lgetlabel(APP_TEST_APP_3_DIR, &tmp, SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "smack_lgetlabel failed. Result: " << result
+ RUNNER_ASSERT_MSG_BT(result == 0, "smack_lgetlabel failed. Result: " << result
<< ", av_type: " << av_type << ", app_path_type: " << app_path_type);
std::string label3(tmp);
free(tmp);
if(app_path_type == APP_PATH_GROUP_RW)
{
result = label1.compare(APP_TEST_APP_1_SHARED_LABEL);
- RUNNER_ASSERT_MSG(result == 0, "Labels do not equal. Acquired " << label1 <<
+ RUNNER_ASSERT_MSG_BT(result == 0, "Labels do not equal. Acquired " << label1 <<
", should be " << APP_TEST_APP_1_SHARED_LABEL << ". Result: " << result <<
", av_type: " << av_type << ", app_path_type: " << app_path_type);
result = label2.compare(APP_TEST_APP_2_SHARED_LABEL);
- RUNNER_ASSERT_MSG(result == 0, "Labels do not equal. Acquired " << label1 <<
+ RUNNER_ASSERT_MSG_BT(result == 0, "Labels do not equal. Acquired " << label1 <<
", should be " << APP_TEST_APP_1_SHARED_LABEL << ". Result: " << result <<
", av_type: " << av_type << ", app_path_type: " << app_path_type);
result = label3.compare(APP_TEST_APP_3_SHARED_LABEL);
- RUNNER_ASSERT_MSG(result == 0, "Labels do not equal. Acquired " << label1 <<
+ RUNNER_ASSERT_MSG_BT(result == 0, "Labels do not equal. Acquired " << label1 <<
", should be " << APP_TEST_APP_1_SHARED_LABEL << ". Result: " << result <<
", av_type: " << av_type << ", app_path_type: " << app_path_type);
}
const char *result;
for (auto itr = error_codes.begin(); itr != error_codes.end(); ++itr) {
- RUNNER_ASSERT_MSG(strcmp(perm_strerror(*itr), "Unknown error") != 0,
+ RUNNER_ASSERT_MSG_BT(strcmp(perm_strerror(*itr), "Unknown error") != 0,
"Returned invalid error code description.");
}
result = perm_strerror(POSITIVE_ERROR_CODE);
- RUNNER_ASSERT_MSG(strcmp(result, "Unknown error") == 0,
+ RUNNER_ASSERT_MSG_BT(strcmp(result, "Unknown error") == 0,
"Bad message returned for invalid error code: \"" << result << "\"");
result = perm_strerror(NONEXISTING_ERROR_CODE);
- RUNNER_ASSERT_MSG(strcmp(result, "Unknown error") == 0,
+ RUNNER_ASSERT_MSG_BT(strcmp(result, "Unknown error") == 0,
"Bad message returned for invalid error code: \"" << result << "\"");
}
DB_BEGIN
result = perm_app_uninstall(APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_uninstall failed: " << perm_strerror(result));
result = perm_app_install(APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_install failed: " << perm_strerror(result));
DB_END
result = perm_app_get_permissions(APP_ID, PERM_APP_TYPE_WGT, &pp_privileges);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_get_permissions failed: " << perm_strerror(result));
privileges.reset(pp_privileges);
- RUNNER_ASSERT_MSG(pp_privileges != NULL,
+ RUNNER_ASSERT_MSG_BT(pp_privileges != NULL,
"perm_app_get_permissions failed to set pointer to cstring array");
- RUNNER_ASSERT_MSG(*pp_privileges == NULL,
+ RUNNER_ASSERT_MSG_BT(*pp_privileges == NULL,
"perm_app_get_permissions found permissions when not supposed to");
}
result = perm_app_uninstall(APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_uninstall failed: " << perm_strerror(result));
result = perm_app_install(APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_install failed: " << perm_strerror(result));
result = perm_app_setup_permissions(APP_ID, PERM_APP_TYPE_WGT, PRIVS);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_register_permissions failed: " << perm_strerror(result));
result = perm_app_setup_permissions(APP_ID, PERM_APP_TYPE_WGT, PRIVS2);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_register_permissions failed: " << perm_strerror(result));
result = perm_app_disable_permissions(APP_ID, PERM_APP_TYPE_WGT, PRIVS2);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_disable_permissions failed: " << perm_strerror(result));
DB_END
result = perm_app_get_permissions(APP_ID, PERM_APP_TYPE_WGT, &pp_privileges);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_get_permissions returned " << result << ": " << perm_strerror(result));
privileges.reset(pp_privileges);
for(i = 0; pp_privileges[i] != NULL; ++i) {
- RUNNER_ASSERT_MSG(PRIVS[i] != NULL,
+ RUNNER_ASSERT_MSG_BT(PRIVS[i] != NULL,
"perm_app_get_permissions returned too many permissions");
- RUNNER_ASSERT_MSG(strcmp(pp_privileges[i], PRIVS[i]) == 0,
+ RUNNER_ASSERT_MSG_BT(strcmp(pp_privileges[i], PRIVS[i]) == 0,
"perm_app_get_permissions returned wrong permission, " << pp_privileges[i] <<
" != " << PRIVS[i]);
}
- RUNNER_ASSERT_MSG(PRIVS[i] == NULL,
+ RUNNER_ASSERT_MSG_BT(PRIVS[i] == NULL,
"perm_app_get_permissions returned too few enabled permissions");
}
DB_BEGIN
result = perm_app_uninstall(APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_uninstall failed: " << perm_strerror(result));
result = perm_app_install(APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_app_install failed: " <<
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_app_install failed: " <<
perm_strerror(result));
DB_END
result = perm_app_get_paths(APP_ID, PERM_APP_PATH_PUBLIC, &pp_paths);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_app_get_paths failed: " <<
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_app_get_paths failed: " <<
perm_strerror(result));
paths.reset(pp_paths);
- RUNNER_ASSERT_MSG(pp_paths != NULL,
+ RUNNER_ASSERT_MSG_BT(pp_paths != NULL,
"perm_app_get_paths failed to set pointer to cstring array");
- RUNNER_ASSERT_MSG(*pp_paths == NULL, "perm_app_get_paths found paths when not supposed to");
+ RUNNER_ASSERT_MSG_BT(*pp_paths == NULL, "perm_app_get_paths found paths when not supposed to");
}
RUNNER_TEST(privilege_control28_perm_app_get_paths)
for (i = 0; i < DIR_NUM; ++i) {
test_paths.push_back(Directory("/tmp/dir" + std::to_string(i), 0));
- RUNNER_ASSERT_MSG(test_paths[i].isCreated(), "failed to create a directory " <<
+ RUNNER_ASSERT_MSG_BT(test_paths[i].isCreated(), "failed to create a directory " <<
test_paths[i].path() << ": " << strerror(test_paths[i].errorCode()));
}
DB_BEGIN
result = perm_app_uninstall(APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_app_uninstall failed: " <<
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_app_uninstall failed: " <<
perm_strerror(result));
result = perm_app_install(APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_app_install failed: " <<
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_app_install failed: " <<
perm_strerror(result));
for (auto itr = test_paths.begin(); itr != test_paths.end(); ++itr) {
result = perm_app_setup_path(APP_ID, itr->path().c_str(), PERM_APP_PATH_PUBLIC);
- RUNNER_ASSERT_MSG(result == 0, "perm_app_setup_path failed: " << perm_strerror(result));
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_setup_path failed: " << perm_strerror(result));
}
DB_END
result = perm_app_get_paths(APP_ID, PERM_APP_PATH_PUBLIC, &pp_paths);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_app_get_paths failed: " <<
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_app_get_paths failed: " <<
perm_strerror(result));
paths.reset(pp_paths);
for(i = 0; pp_paths[i] != NULL; ++i) {
- RUNNER_ASSERT_MSG(i < test_paths.size(), "perm_app_get_paths returned too many paths");
- RUNNER_ASSERT_MSG(test_paths[i].path() == pp_paths[i],
+ RUNNER_ASSERT_MSG_BT(i < test_paths.size(), "perm_app_get_paths returned too many paths");
+ RUNNER_ASSERT_MSG_BT(test_paths[i].path() == pp_paths[i],
"perm_app_get_paths returned unexpected path, " << pp_paths[i] << " != " <<
test_paths[i].path());
}
- RUNNER_ASSERT_MSG(i == test_paths.size(), "perm_app_get_paths returned too few paths");
+ RUNNER_ASSERT_MSG_BT(i == test_paths.size(), "perm_app_get_paths returned too few paths");
DB_BEGIN
result = perm_app_uninstall(APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "perm_app_uninstall failed: " <<
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "perm_app_uninstall failed: " <<
perm_strerror(result));
DB_END
*/
#include <dpl/test/test_runner.h>
+#include <tests_common.h>
#include <sys/smack.h>
#include <privilege-control.h>
#include <tests_common.h>
RUNNER_TEST(privilege_control21a_incorrect_params_get_smack_label_from_process)
{
- RUNNER_ASSERT_MSG(get_smack_label_from_process(PID_CORRECT, NULL) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(get_smack_label_from_process(PID_CORRECT, NULL) == PC_ERR_INVALID_PARAM,
"get_smack_label_from_process didn't check if smack_label isn't NULL.");
char aquired_smack_label[SMACK_LABEL_LEN+1];
- RUNNER_ASSERT_MSG(get_smack_label_from_process(PID_INCORRECT, aquired_smack_label) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(get_smack_label_from_process(PID_INCORRECT, aquired_smack_label) == PC_ERR_INVALID_PARAM,
"get_smack_label_from_process didn't check for correct pid.");
}
RUNNER_TEST_SMACK(privilege_control21b_incorrect_params_smack_pid_have_access)
{
- RUNNER_ASSERT_MSG(smack_pid_have_access(PID_CORRECT, "some_object", NULL) == -1,
+ RUNNER_ASSERT_MSG_BT(smack_pid_have_access(PID_CORRECT, "some_object", NULL) == -1,
"smack_pid_have_access didn't check if access_type isn't NULL.");
- RUNNER_ASSERT_MSG(smack_pid_have_access(PID_CORRECT, NULL, "rw") == -1,
+ RUNNER_ASSERT_MSG_BT(smack_pid_have_access(PID_CORRECT, NULL, "rw") == -1,
"smack_pid_have_access didn't check if object isn't NULL.");
- RUNNER_ASSERT_MSG(smack_pid_have_access(PID_CORRECT, "", "rw") == -1,
+ RUNNER_ASSERT_MSG_BT(smack_pid_have_access(PID_CORRECT, "", "rw") == -1,
"smack_pid_have_access didn't check if object isn't empty.");
- RUNNER_ASSERT_MSG(smack_pid_have_access(PID_INCORRECT, "some_object", "rw") == -1,
+ RUNNER_ASSERT_MSG_BT(smack_pid_have_access(PID_INCORRECT, "some_object", "rw") == -1,
"smack_pid_have_access didn't check for correct pid.");
}
RUNNER_TEST(privilege_control21c_incorrect_params_perm_app_set_privilege)
{
- RUNNER_ASSERT_MSG(perm_app_set_privilege(NULL, NULL, APP_SET_PRIV_PATH) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(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(perm_app_install(NULL) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(perm_app_install(NULL) == PC_ERR_INVALID_PARAM,
"perm_app_install didn't check if pkg_id isn't NULL.");
- RUNNER_ASSERT_MSG(perm_app_install("") == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(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(perm_app_uninstall(NULL) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(perm_app_uninstall(NULL) == PC_ERR_INVALID_PARAM,
"perm_app_uninstall didn't check if pkg_id isn't NULL.");
- RUNNER_ASSERT_MSG(perm_app_uninstall("") == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(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(perm_app_enable_permissions(APP_ID, APP_TYPE_OTHER, NULL, 1) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(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(perm_app_enable_permissions(NULL, APP_TYPE_OTHER, PRIVS2, 1) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(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(perm_app_enable_permissions("", APP_TYPE_OTHER, PRIVS2, 1) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(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(perm_app_enable_permissions("~APP~", APP_TYPE_OTHER, PRIVS2, 1) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(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(perm_app_revoke_permissions(NULL) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(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(perm_app_revoke_permissions("") == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(perm_app_revoke_permissions("") == PC_ERR_INVALID_PARAM,
"perm_app_revoke_permissions didn't check if pkg_id isn't empty.");
- RUNNER_ASSERT_MSG(perm_app_revoke_permissions("~APP~") == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(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(perm_app_reset_permissions(NULL) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(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(perm_app_reset_permissions("") == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(perm_app_reset_permissions("") == PC_ERR_INVALID_PARAM,
"perm_app_reset_permissions didn't check if pkg_id isn't empty.");
- RUNNER_ASSERT_MSG(perm_app_reset_permissions("~APP~") == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(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(perm_app_setup_path(APPID_DIR, NULL, APP_PATH_PRIVATE) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(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(perm_app_setup_path(NULL, TEST_APP_DIR, APP_PATH_PRIVATE) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(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(perm_app_setup_path("", TEST_APP_DIR, APP_PATH_PRIVATE) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(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(perm_app_setup_path("~APP~", TEST_APP_DIR, APP_PATH_PRIVATE) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(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_IGNORED_MSG("perm_app_add_friend is not implemented");
- RUNNER_ASSERT_MSG(perm_app_add_friend(NULL, APP_FRIEND_2) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(perm_app_add_friend(NULL, APP_FRIEND_2) == PC_ERR_INVALID_PARAM,
"perm_app_add_friend didin't check if pkg_id1 isn't NULL.");
- RUNNER_ASSERT_MSG(perm_app_add_friend("", APP_FRIEND_2) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(perm_app_add_friend("", APP_FRIEND_2) == PC_ERR_INVALID_PARAM,
"perm_app_add_friend didin't check if pkg_id1 isn't empty.");
- RUNNER_ASSERT_MSG(perm_app_add_friend(APP_FRIEND_1, NULL) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(perm_app_add_friend(APP_FRIEND_1, NULL) == PC_ERR_INVALID_PARAM,
"perm_app_add_friend didin't check if pkg_id2 isn't NULL.");
- RUNNER_ASSERT_MSG(perm_app_add_friend(APP_FRIEND_1, "") == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(perm_app_add_friend(APP_FRIEND_1, "") == PC_ERR_INVALID_PARAM,
"perm_app_add_friend didin't check if pkg_id2 isn't empty.");
- RUNNER_ASSERT_MSG(perm_app_add_friend("~APP~", APP_FRIEND_2) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(perm_app_add_friend("~APP~", APP_FRIEND_2) == PC_ERR_INVALID_PARAM,
"perm_app_add_friend didin't check if pkg_id1 is valid.");
- RUNNER_ASSERT_MSG(perm_app_add_friend(APP_FRIEND_1, "~APP~") == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(perm_app_add_friend(APP_FRIEND_1, "~APP~") == PC_ERR_INVALID_PARAM,
"perm_app_add_friend didin't check if pkg_id2 is valid.");
}
RUNNER_TEST(privilege_control21k_incorrect_params_add_api_feature)
{
- RUNNER_ASSERT_MSG(perm_add_api_feature(APP_TYPE_OSP, NULL, NULL, NULL, 0) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(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(perm_add_api_feature(APP_TYPE_OSP, "", NULL, NULL, 0) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(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(perm_app_disable_permissions(APP_ID, APP_TYPE_OTHER, NULL) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(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(perm_app_disable_permissions(NULL, APP_TYPE_OTHER, PRIVS2) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(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(perm_app_disable_permissions("", APP_TYPE_OTHER, PRIVS2) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(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(perm_app_disable_permissions("~APP~", APP_TYPE_OTHER, PRIVS2) == PC_ERR_INVALID_PARAM,
+ RUNNER_ASSERT_MSG_BT(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;
- RUNNER_ASSERT_MSG(perm_app_has_permission(NULL, APP_TYPE_WGT,
+ RUNNER_ASSERT_MSG_BT(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(perm_app_has_permission(APP_ID, APP_TYPE_OTHER,
+ RUNNER_ASSERT_MSG_BT(perm_app_has_permission(APP_ID, APP_TYPE_OTHER,
PRIVS2[0], &has_permission) == PC_ERR_INVALID_PARAM,
"perm_app_has_permission should not accept app_type = OTHER.");
- RUNNER_ASSERT_MSG(perm_app_has_permission(APP_ID, APP_TYPE_WGT,
+ RUNNER_ASSERT_MSG_BT(perm_app_has_permission(APP_ID, 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(perm_app_has_permission(APP_ID, APP_TYPE_WGT,
+ RUNNER_ASSERT_MSG_BT(perm_app_has_permission(APP_ID, APP_TYPE_WGT,
PRIVS2[0], NULL) == PC_ERR_INVALID_PARAM,
"perm_app_has_permission didn't check if has_permission isn't NULL.");
}
RUNNER_TEST(privilege_control21n_incorrect_params_perm_app_setup_permissions)
{
- RUNNER_ASSERT_MSG(perm_app_setup_permissions(APP_ID, APP_TYPE_OTHER,
+ RUNNER_ASSERT_MSG_BT(perm_app_setup_permissions(APP_ID, APP_TYPE_OTHER,
NULL) == PC_ERR_INVALID_PARAM,
"perm_app_setup_permissions didn't check if perm_list isn't NULL");
- RUNNER_ASSERT_MSG(perm_app_setup_permissions(NULL, APP_TYPE_OTHER,
+ RUNNER_ASSERT_MSG_BT(perm_app_setup_permissions(NULL, APP_TYPE_OTHER,
PRIVS2) == PC_ERR_INVALID_PARAM,
"perm_app_setup_permissions didn't check if pkg_id isn't NULL.");
- RUNNER_ASSERT_MSG(perm_app_setup_permissions("", APP_TYPE_OTHER,
+ RUNNER_ASSERT_MSG_BT(perm_app_setup_permissions("", APP_TYPE_OTHER,
PRIVS2) == PC_ERR_INVALID_PARAM,
"perm_app_setup_permissions didn't check if pkg_id isn't empty.");
- RUNNER_ASSERT_MSG(perm_app_setup_permissions(APP_ID, (app_type_t)-1,
+ RUNNER_ASSERT_MSG_BT(perm_app_setup_permissions(APP_ID, (app_type_t)-1,
PRIVS2) == PC_ERR_INVALID_PARAM,
"perm_app_setup_permissions didn't check if app type is valid.");
- RUNNER_ASSERT_MSG(perm_app_setup_permissions("~APP~", APP_TYPE_OTHER,
+ RUNNER_ASSERT_MSG_BT(perm_app_setup_permissions("~APP~", APP_TYPE_OTHER,
PRIVS2) == PC_ERR_INVALID_PARAM,
"perm_app_setup_permissions didn't check if pkg_id is valid");
}
{
char **pp_paths;
- RUNNER_ASSERT_MSG(perm_app_get_paths(NULL, PERM_APP_PATH_PUBLIC,
+ RUNNER_ASSERT_MSG_BT(perm_app_get_paths(NULL, PERM_APP_PATH_PUBLIC,
&pp_paths) == PC_ERR_INVALID_PARAM,
"perm_app_get_paths didn't check if pkg_id isn't NULL.");
- RUNNER_ASSERT_MSG(perm_app_get_paths(APP_ID, PERM_APP_PATH_PUBLIC,
+ RUNNER_ASSERT_MSG_BT(perm_app_get_paths(APP_ID, PERM_APP_PATH_PUBLIC,
NULL) == PC_ERR_INVALID_PARAM,
"perm_app_get_paths didn't check if ppp_paths isn't NULL.");
- RUNNER_ASSERT_MSG(perm_app_get_paths(APP_ID, PERM_APP_PATH_PRIVATE,
+ RUNNER_ASSERT_MSG_BT(perm_app_get_paths(APP_ID, PERM_APP_PATH_PRIVATE,
&pp_paths) == PC_ERR_INVALID_PARAM,
"perm_app_get_paths shouldn't accept paths of type PERM_APP_PATH_PRIVATE");
- RUNNER_ASSERT_MSG(perm_app_get_paths(APP_ID, PERM_APP_PATH_ANY_LABEL,
+ RUNNER_ASSERT_MSG_BT(perm_app_get_paths(APP_ID, PERM_APP_PATH_ANY_LABEL,
&pp_paths) == PC_ERR_INVALID_PARAM,
"perm_app_get_paths should not accept paths of type PERM_APP_PATH_ANY_LABEL");
}
char* label;
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path. Result: " << result);
- RUNNER_ASSERT_MSG(label != NULL, "ACCESS label on " << fpath << " is not set");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(label != NULL, "ACCESS label on " << fpath << " is not set");
result = strcmp(APPID_SHARED_DIR, label);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"ACCESS label on " << fpath << " is incorrect. Result: " << result);
//The only exception in nftw_check_labels_app_shared_dir
//smack_have_access returns -1 because of no SMACK.
result = smack_have_access(APP_ID, APPID_SHARED_DIR, "rwxat");
- RUNNER_ASSERT_MSG(result == -1,
+ RUNNER_ASSERT_MSG_BT(result == -1,
"smack_have_access should return error (SMACK is off). Result: " << result);
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_EXEC);
- RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path. Result: " << result);
- RUNNER_ASSERT_MSG(label == NULL, "EXEC label on " << fpath << " is set");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(label == NULL, "EXEC label on " << fpath << " is set");
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_TRANSMUTE);
- RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path. Result: " << result);
if (S_ISDIR(sb->st_mode)) {
- RUNNER_ASSERT_MSG(label != NULL, "TRANSMUTE label on " << fpath << " is not set");
+ RUNNER_ASSERT_MSG_BT(label != NULL, "TRANSMUTE label on " << fpath << " is not set");
result = strcmp("TRUE", label);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"TRANSMUTE label on " << fpath << " is not set. Result: " << result);
} else
- RUNNER_ASSERT_MSG(label == NULL, "TRANSMUTE label on " << fpath << " is set");
+ RUNNER_ASSERT_MSG_BT(label == NULL, "TRANSMUTE label on " << fpath << " is set");
return 0;
}
DB_BEGIN
result = perm_app_setup_path(APP_ID, TEST_APP_DIR, APP_PATH_GROUP_RW, APP_ID);
- RUNNER_ASSERT_MSG(result != PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result != PC_OPERATION_SUCCESS,
"perm_app_setup_path should fail here. Result: " << result);
DB_END
result = nftw(TEST_APP_DIR, &nftw_remove_labels, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Unable to clean up 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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Unable to clean up Smack labels in " << TEST_NON_APP_DIR);
DB_BEGIN
result = perm_app_setup_path(APP_ID, TEST_APP_DIR, APP_PATH_GROUP_RW, APPID_SHARED_DIR);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_setup_path() failed. Result: " << result);
DB_END
result = nftw(TEST_APP_DIR, &nftw_check_labels_app_shared_dir_nosmack, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Unable to check Smack labels for shared app dir");
result = nftw(TEST_NON_APP_DIR, &nftw_check_labels_non_app_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Unable to check Smack labels for non-app dir");
}
DB_BEGIN
result = perm_app_uninstall(APP_ID);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
result = perm_app_install(APP_ID);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == -1,
+ RUNNER_ASSERT_MSG_BT(result == -1,
"Despite SMACK being off some accesses were added. Result: " << result);
// Check if permission is assigned to app in db
DB_BEGIN
result = perm_app_uninstall(app_id);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
result = perm_app_install(app_id);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"perm_app_install returned " << result << ". Errno: " << strerror(errno));
result = perm_app_enable_permissions(app_id, app_type, privileges, 1);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "Line: " << line_no <<
" Error enabling app permissions. Result: " << result);
DB_END
result = test_have_nosmack_accesses(rules);
- RUNNER_ASSERT_MSG(result == -1, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(result == -1, "Line: " << line_no <<
" Permissions shouldn't be added. Result: " << result);
result = perm_app_set_privilege(app_id, type, app_path);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "Line: " << line_no <<
" 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(result == -1, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(result == -1, "Line: " << line_no <<
" new_label_from_self should return error (SMACK is off). Result: " << result);
- RUNNER_ASSERT_MSG(label == NULL, "Line: " << line_no <<
+ RUNNER_ASSERT_MSG_BT(label == NULL, "Line: " << line_no <<
" new_label_from_self shouldn't allocate memory for label.");
check_groups(dac_file);
//Set app privileges
result = perm_app_set_privilege(APP_ID, NULL, APP_SET_PRIV_PATH);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == -1,
+ RUNNER_ASSERT_MSG_BT(result == -1,
"new_label_from_self should return error (SMACK is off). Result: " << result);
- RUNNER_ASSERT_MSG(label == NULL, "new_label_from_self shouldn't allocate memory for label.");
+ RUNNER_ASSERT_MSG_BT(label == NULL, "new_label_from_self shouldn't allocate memory for label.");
//Check if DAC privileges really set
- RUNNER_ASSERT_MSG(getuid() == APP_UID, "Wrong UID");
- RUNNER_ASSERT_MSG(getgid() == APP_GID, "Wrong GID");
+ RUNNER_ASSERT_MSG_BT(getuid() == APP_UID, "Wrong UID");
+ RUNNER_ASSERT_MSG_BT(getgid() == APP_GID, "Wrong GID");
result = strcmp(getenv("HOME"), APP_HOME_DIR);
- RUNNER_ASSERT_MSG(result == 0, "Wrong HOME DIR. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Wrong HOME DIR. Result: " << result);
result = strcmp(getenv("USER"), APP_USER_NAME);
- RUNNER_ASSERT_MSG(result == 0, "Wrong user USER NAME. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Wrong user USER NAME. Result: " << result);
check_groups(LIBPRIVILEGE_TEST_DAC_FILE);
}
// Adding two apps before antivir
result = perm_app_install(APP_TEST_APP_1);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"perm_app_install returned " << result << ". Errno: " << strerror(errno));
result = perm_app_install(APP_TEST_APP_2);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"perm_app_install returned " << result << ". Errno: " << strerror(errno));
DB_END
// Adding antivir
result = app_register_av(APP_TEST_AV_1);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"app_register_av returned " << result << ". Errno: " << strerror(errno));
// Checking added apps accesses
// Adding third app
result = perm_app_install(APP_TEST_APP_3);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"perm_app_install returned " << result << ". Errno: " << strerror(errno));
DB_END
// Adding second antivir
result = app_register_av(APP_TEST_AV_2);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"app_register_av returned " << result << ". Errno: " << strerror(errno));
// Checking app accesses
DB_BEGIN
result = perm_app_uninstall(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
result = perm_app_install(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_install returned " << result << ". Errno: " << strerror(errno));
result = perm_app_revoke_permissions(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == -1, "Permissions shouldn't be added. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == -1, "Permissions shouldn't be added. Result: " << result);
TestLibPrivilegeControlDatabase db_test;
db_test.test_db_after__perm_app_install(TRACE_FROM_HERE, WGT_APP_ID);
//Clean up
result = perm_app_revoke_permissions(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error revoking app permissions. Result: " << result);
DB_END
DB_BEGIN
result = perm_app_uninstall(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_uninstall returned " << result << ". Errno: " << strerror(errno));
result = perm_app_install(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"perm_app_install returned " << result << ". Errno: " << strerror(errno));
// Prepare permissions to reset
result = perm_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, PRIVS2, 1);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
" Error adding app permissions. Result: " << result);
// Reset permissions
result = perm_app_reset_permissions(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error reseting app permissions. Result: " << result);
DB_END
result = test_have_nosmack_accesses(rules2);
- RUNNER_ASSERT_MSG(result == -1, "Permissions shouldn't be changed. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == -1, "Permissions shouldn't be changed. Result: " << result);
DB_BEGIN
// Disable permissions
result = perm_app_revoke_permissions(WGT_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error disabling app permissions. Result: " << result);
DB_END
//Create our server and client with fork
pid = fork();
- RUNNER_ASSERT_MSG(pid >= 0, "Fork failed");
+ RUNNER_ASSERT_MSG_BT(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(sock >= 0, "socket failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(sock >= 0, "socket failed: " << strerror(errno));
//Bind socket to address
result = bind(sock, (struct sockaddr*) &sockaddr, sizeof(struct sockaddr_un));
if (result != 0) {
close(sock);
- RUNNER_ASSERT_MSG(false, "bind failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(false, "bind failed: " << strerror(errno));
}
//Prepare for listening
result = listen(sock, 1);
if (result != 0) {
close(sock);
- RUNNER_ASSERT_MSG(false, "listen failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(false, "listen failed: " << strerror(errno));
}
//Accept connection
alarm(2);
fd = accept(sock, NULL, NULL);
alarm(0);
- RUNNER_ASSERT_MSG(fd >= 0, "accept failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(fd >= 0, "accept failed: " << strerror(errno));
//Wait a little bit for client to use perm_app_id_from_socket
usleep(200);
//Create socket
sock = socket(AF_UNIX, SOCK_STREAM, 0);
- RUNNER_ASSERT_MSG(sock >= 0, "socket failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(sock >= 0, "socket failed: " << strerror(errno));
//Try connecting to address
result = connect(sock, (struct sockaddr*) &sockaddr, sizeof(struct sockaddr_un));
if (result != 0) {
close(sock);
- RUNNER_ASSERT_MSG(0, "connect failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(0, "connect failed: " << strerror(errno));
}
//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(0, "perm_app_id_from_socket should fail.");
+ RUNNER_ASSERT_MSG_BT(0, "perm_app_id_from_socket should fail.");
}
//cleanup
close(sock);
- RUNNER_ASSERT_MSG(smack_label == NULL, "perm_app_id_from_socket should fail.");
+ RUNNER_ASSERT_MSG_BT(smack_label == NULL, "perm_app_id_from_socket should fail.");
}
}
/* ACCESS */
result = smack_lgetlabel(fpath, &label_gen, SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "Could not get label for the path. Result: " << result);
- RUNNER_ASSERT_MSG(label_gen != NULL, "ACCESS label on " << fpath << " is not set");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Could not get label for the path. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(label_gen != NULL, "ACCESS label on " << fpath << " is not set");
/* EXEC */
result = smack_lgetlabel(fpath, &label, SMACK_LABEL_EXEC);
if (result != 0) {
free(label_gen);
- RUNNER_ASSERT_MSG(false, "Could not get label for the path. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(false, "Could not get label for the path. Result: " << result);
}
if (label != NULL) {
free(label_gen);
free(label);
- RUNNER_ASSERT_MSG(false, "EXEC label on " << fpath << " is set.");
+ RUNNER_ASSERT_MSG_BT(false, "EXEC label on " << fpath << " is set.");
}
/* TRANSMUTE */
if (result != 0) {
free(label_gen);
free(label);
- RUNNER_ASSERT_MSG(false, "Could not get label for the path. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(false, "Could not get label for the path. Result: " << result);
}
if (S_ISDIR(sb->st_mode)) {
if (label == NULL) {
free(label_gen);
free(label);
- RUNNER_ASSERT_MSG(false, "TRANSMUTE label on " << fpath << " is not set");
+ RUNNER_ASSERT_MSG_BT(false, "TRANSMUTE label on " << fpath << " is not set");
}
result = strcmp("TRUE", label);
if (result != 0) {
free(label_gen);
free(label);
- RUNNER_ASSERT_MSG(false,
+ RUNNER_ASSERT_MSG_BT(false,
"TRANSMUTE label on " << fpath << " is not set to TRUE Result: " << result);
}
} else if (label != NULL) {
free(label_gen);
free(label);
- RUNNER_ASSERT_MSG(false, "TRANSMUTE label on " << fpath << " is set");
+ RUNNER_ASSERT_MSG_BT(false, "TRANSMUTE label on " << fpath << " is set");
}
free(label);
fs_db.open(labels_db_path, std::ios_base::in);
if (!(fs_db.good())) {
free(label_gen);
- RUNNER_ASSERT_MSG(false, "Can not open database for apps");
+ RUNNER_ASSERT_MSG_BT(false, "Can not open database for apps");
}
while(!fs_db.eof()) {
result = smack_have_access(label_temp, label_gen, access);
if (result != -1) { //expect error, not access granted
free(label_gen);
- RUNNER_ASSERT_MSG(false, "smack_have_access should fail. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(false, "smack_have_access should fail. Result: " << result);
}
}
fs_db.open(dir_db_path, std::ios_base::in);
if (!fs_db.good()) {
free(label_gen);
- RUNNER_ASSERT_MSG(false, "Can not open database for dirs");
+ RUNNER_ASSERT_MSG_BT(false, "Can not open database for dirs");
}
bool is_dir = false;
free(label_gen);
- RUNNER_ASSERT_MSG(is_dir, "Error autogenerated label is not in dirs db.");
+ RUNNER_ASSERT_MSG_BT(is_dir, "Error autogenerated label is not in dirs db.");
return 0;
}
int result;
result = nftw(TEST_APP_DIR, &nftw_remove_labels, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"Unable to clean up Smack labels in " << TEST_APP_DIR << ". Result: " << result);
result = nftw(TEST_NON_APP_DIR, &nftw_set_labels_non_app_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"Unable to clean up Smack labels in " << TEST_NON_APP_DIR << ". Result: " << result);
DB_BEGIN
result = perm_app_setup_path(APP_ID, TEST_APP_DIR, APP_PATH_PUBLIC_RO);
- RUNNER_ASSERT_MSG(result == 0, "perm_app_setup_path() failed. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_setup_path() failed. Result: " << result);
DB_END
result = nftw(TEST_NON_APP_DIR, &nftw_check_labels_non_app_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"Unable to check Smack labels for non-app dir. Result: " << result);
}
int result;
result = nftw(TEST_APP_DIR, &nftw_remove_labels, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"Unable to clean up Smack labels in " << TEST_APP_DIR << ". Result: " << result);
result = nftw(TEST_NON_APP_DIR, &nftw_set_labels_non_app_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"Unable to clean up Smack labels in " << TEST_NON_APP_DIR << ". Result: " << result);
DB_BEGIN
result = perm_app_setup_path(APP_ID, TEST_APP_DIR, APP_PATH_SETTINGS_RW);
- RUNNER_ASSERT_MSG(result == 0, "perm_app_setup_path() failed. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "perm_app_setup_path() failed. Result: " << result);
DB_END
result = nftw(TEST_NON_APP_DIR, &nftw_check_labels_non_app_dir, FTW_MAX_FDS, FTW_PHYS);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"Unable to check Smack labels for non-app dir. Result: " << result);
}
DB_BEGIN
result = perm_app_uninstall(APP_NPRUNTIME);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "Error in perm_app_uninstall. " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "Error in perm_app_uninstall. " << result);
result = perm_app_install(APP_NPRUNTIME);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "Error in perm_app_install. " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "Error in perm_app_install. " << result);
result = perm_app_setup_path(APP_NPRUNTIME, APP_NPRUNTIME_FILE, PERM_APP_PATH_NPRUNTIME);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "Error in perm_app_setup_path. " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "Error in perm_app_setup_path. " << result);
DB_END
- RUNNER_ASSERT(0 == smack_lgetlabel(APP_NPRUNTIME_FILE, &label, SMACK_LABEL_EXEC));
+ RUNNER_ASSERT_BT(0 == smack_lgetlabel(APP_NPRUNTIME_FILE, &label, SMACK_LABEL_EXEC));
labelPtr.reset(label);
label = NULL;
- RUNNER_ASSERT(0 == strcmp(labelPtr.get(), nptargetlabel.c_str()));
+ RUNNER_ASSERT_BT(0 == strcmp(labelPtr.get(), nptargetlabel.c_str()));
// Rules to test
const std::vector< std::vector<std::string> > np_rules = {
// Check if accesses aren't added
result = test_have_nosmack_accesses(np_rules);
- RUNNER_ASSERT_MSG(result == -1, "Accesses shouldn't be added. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == -1, "Accesses shouldn't be added. Result: " << result);
DB_BEGIN
// Uninstall app runtime
result = perm_app_uninstall(APP_NPRUNTIME);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS, "Error in perm_app_uninstall. " << result);
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS, "Error in perm_app_uninstall. " << result);
DB_END
}
RUNNER_TEST_NOSMACK(privilege_control21b_incorrect_params_smack_pid_have_access_nosmack)
{
int result = smack_pid_have_access(PID_CORRECT, "some_object", NULL);
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
"smack_pid_have_access should return access granted. Result: " << result);
result = smack_pid_have_access(PID_CORRECT, NULL, "rw");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
"smack_pid_have_access should return access granted. Result: " << result);
result = smack_pid_have_access(PID_CORRECT, NULL, "rw");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
"smack_pid_have_access should return access granted. Result: " << result);
result = smack_pid_have_access(PID_INCORRECT, "some_object", "rw");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
"smack_pid_have_access should return access granted. Result: " << result);
}
// 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(result == 0,
+ RUNNER_ASSERT_MSG_BT(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(result == 0,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in perm_app_revoke_permissions. Result: " << result);
result = perm_app_uninstall(APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in perm_app_uninstall. Result: " << result);
// remove api features by deleting files
// Install setting app and give it app-setting permissions
result = perm_app_revoke_permissions(APP_TEST_SETTINGS_ASP1);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in perm_app_revoke_permissions. Result: " << result);
result = perm_app_uninstall(APP_TEST_SETTINGS_ASP1);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in perm_app_uninstall. Result: " << result);
result = perm_app_install(APP_TEST_SETTINGS_ASP1);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in perm_app_install. Result: " << result);
result = perm_app_setup_permissions(APP_TEST_SETTINGS_ASP1,
APP_TYPE_OSP, PRIV_APPSETTING);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in perm_app_revoke_permissions. Result: " << result);
result = perm_app_uninstall(TEST_OSP_FEATURE_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in perm_app_uninstall. Result: " << result);
result = perm_app_install(TEST_OSP_FEATURE_APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in perm_app_install. Result: " << result);
result = perm_app_setup_permissions(TEST_OSP_FEATURE_APP_ID,
APP_TYPE_OSP,(const char*[]) {NULL});
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in perm_app_install. Loop index: " << i
<< ". Result: " << result);
// Add persistent permissions
result = perm_app_setup_permissions(APP_ID, APP_TYPE_OSP,
TEST_OSP_FEATURE_PRIVS);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in perm_app_setup_permissions from OSP Feature. Loop index: "
<< i << ". Result: " << result);
result = perm_app_setup_permissions(APP_ID, APP_TYPE_WGT,
TEST_WGT_FEATURE_PRIVS);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in perm_app_setup_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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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 = test_have_any_accesses(rules_to_test_any_access1);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"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(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"Cannot get access label from Public RO shared dir. Loop index: "
<< i << ". Result: " << result);
shared_dir_auto_label = label;
// Verify that all permissions to public dir have been added
// correctly, also to other app
result = smack_have_access(APP_ID, shared_dir_auto_label.c_str(), "rwxatl");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
"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(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
"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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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, APPID_SHARED_DIR);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == 0,
+ RUNNER_ASSERT_MSG_BT(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(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
"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(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
"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(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
"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, APPID_SHARED_DIR, "rwxatl");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
"Not all accesses to Group RW dir are granted. Loop index: "
<< i);
(const std::vector< std::vector<std::string> >) {
{ APP_ID, TEST_OSP_FEATURE_APP_ID, "rxl" },
{ APP_ID, TEST_WGT_FEATURE_APP_ID, "rwxl" } } );
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
"Not all permisions from api features added. Loop index: "
<< i);
// revoke permissions
result = perm_app_revoke_permissions(APP_ID);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in perm_app_revoke_permissions. Loop index: " << i
<< ". Result: " << result);
// check if api-features permissions are removed properly
result = test_have_any_accesses(rules_to_test_any_access2);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"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(result == 0,
+ RUNNER_ASSERT_MSG_BT(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(result == 0,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in perm_app_uninstall. Result: " << result);
result = perm_app_uninstall(APP_TEST_SETTINGS_ASP1);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result > 0, "Cannot generate name for app nr: " << i);
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in perm_app_revoke_permissions."
<< " Result: " << result);
result = perm_app_uninstall(APP_TEST_SETTINGS_ASP1);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in perm_app_uninstall."
<< " Result: " << result);
result = perm_app_install(APP_TEST_SETTINGS_ASP1);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in perm_app_install."
<< " Result: " << result);
result = perm_app_setup_permissions(APP_TEST_SETTINGS_ASP1,
APP_TYPE_OSP, PRIV_APPSETTING);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result > 0,
+ RUNNER_ASSERT_MSG_BT(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(result == 0 || errno == EEXIST,
+ RUNNER_ASSERT_MSG_BT(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(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"Unable to clean up Smack labels in: " << app_dirs[j]
<< ". Result: " << result);
}
// add persistent api feature permissions
result = perm_app_setup_permissions(app_ids[j], APP_TYPE_OSP,
TEST_OSP_FEATURE_PRIVS);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in perm_app_setup_permissions from OSP Feature. App id: "
<< app_ids[j] << " Loop index: " << i << ". Result: " << result);
result = perm_app_setup_permissions(app_ids[j+5], APP_TYPE_WGT,
TEST_WGT_FEATURE_PRIVS);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in perm_app_setup_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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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, APPID_SHARED_DIR);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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, APPID_SHARED_DIR);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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, APPID_SHARED_DIR);
- RUNNER_ASSERT_MSG(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in perm_app_setup_path. App id: " << app_ids[9]
<< " Loop index: " << i << ". Result: " << result);
result = test_have_any_accesses(
FMT_VECTOR_TO_TEST_ANY_ACCESS(app_ids[j], app_ids[0])
);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"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 = test_have_any_accesses(
FMT_VECTOR_TO_TEST_ANY_ACCESS(app_ids[j], app_ids[5])
);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"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], APPID_SHARED_DIR, "rwxatl" },
{ app_ids[2], APPID_SHARED_DIR, "rwxatl" },
{ app_ids[6], APPID_SHARED_DIR, "rwxatl" } } );
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(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(result == 0,
+ RUNNER_ASSERT_MSG_BT(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(result == 0,
+ RUNNER_ASSERT_MSG_BT(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(result == 0,
+ RUNNER_ASSERT_MSG_BT(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 = test_have_all_accesses(
(const std::vector< std::vector<std::string> >) {
{ app_ids[j], shared_dir3_auto_label.c_str(), "rwxatl" } } );
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(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(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"Unexpected extra permissions added for app:" << app_ids[j]
<< ". Loop index: " << i);
}
result = test_have_all_accesses(
(const std::vector< std::vector<std::string> >) {
{ app_ids[j], shared_dir7_auto_label.c_str(), "rwxatl" } } );
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(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(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"Unexpected extra permissions added for app:" << app_ids[j]
<< ". Loop index: " << i);
}
result = test_have_all_accesses(
(const std::vector< std::vector<std::string> >) {
{ app_ids[j], shared_dir8_auto_label.c_str(), "rwxatl" } } );
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(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(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"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(result == 1,
+ RUNNER_ASSERT_MSG_BT(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(result == 0,
+ RUNNER_ASSERT_MSG_BT(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(result == 0,
+ RUNNER_ASSERT_MSG_BT(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(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
"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(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
"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(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
"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(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
"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(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
"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(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
"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(result == 1,
+ RUNNER_ASSERT_MSG_BT(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(result == 1,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in perm_app_revoke_permissions. App id: "
<< app_ids[j] << " Loop index: " << i
<< ". Result: " << result);
result = test_have_any_accesses(
FMT_VECTOR_TO_TEST_ANY_ACCESS(app_ids[j], app_ids[k])
);
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"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(result == 0,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(result == 0,
+ RUNNER_ASSERT_MSG_BT(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(result == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == PC_OPERATION_SUCCESS,
"Error in perm_app_uninstall. Result: " << result);
}
{
struct smack_accesses *rules = NULL;
int result = smack_accesses_new(&rules);
- RUNNER_ASSERT_MSG(result == 0, "Unable to create smack_accesses instance");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to create smack_accesses instance");
// CLEAN UP
smack_accesses_add_modify(rules,TEST_SUBJECT, TEST_OBJECT,"","rwxat");
smack_accesses_free(rules);
// PREINIT CHECK.
- RUNNER_ASSERT_MSG(smack_have_access(TEST_SUBJECT, TEST_OBJECT,"r") != 1, "Rule has previous privileges after cleaning up!");
- RUNNER_ASSERT_MSG(smack_have_access(TEST_SUBJECT, TEST_OBJECT,"w") != 1, "Rule has previous privileges after cleaning up!");
- RUNNER_ASSERT_MSG(smack_have_access(TEST_SUBJECT, TEST_OBJECT,"x") != 1, "Rule has previous privileges after cleaning up!");
- RUNNER_ASSERT_MSG(smack_have_access(TEST_SUBJECT, TEST_OBJECT,"a") != 1, "Rule has previous privileges after cleaning up!");
- RUNNER_ASSERT_MSG(smack_have_access(TEST_SUBJECT, TEST_OBJECT,"t") != 1, "Rule has previous privileges after cleaning up!");
+ RUNNER_ASSERT_MSG_BT(smack_have_access(TEST_SUBJECT, TEST_OBJECT,"r") != 1, "Rule has previous privileges after cleaning up!");
+ RUNNER_ASSERT_MSG_BT(smack_have_access(TEST_SUBJECT, TEST_OBJECT,"w") != 1, "Rule has previous privileges after cleaning up!");
+ RUNNER_ASSERT_MSG_BT(smack_have_access(TEST_SUBJECT, TEST_OBJECT,"x") != 1, "Rule has previous privileges after cleaning up!");
+ RUNNER_ASSERT_MSG_BT(smack_have_access(TEST_SUBJECT, TEST_OBJECT,"a") != 1, "Rule has previous privileges after cleaning up!");
+ RUNNER_ASSERT_MSG_BT(smack_have_access(TEST_SUBJECT, TEST_OBJECT,"t") != 1, "Rule has previous privileges after cleaning up!");
}
/**
{
struct smack_accesses *rules = NULL;
int result = smack_accesses_new(&rules);
- RUNNER_ASSERT_MSG(result == 0, "Unable to create smack_accesses instance");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to create smack_accesses instance");
result = smack_accesses_add_modify(rules, "test_subject_01", "test_object_01", "", "rxwat");
result = smack_accesses_add_modify(rules, "test_subject_01", "test_object_02", "", "rxwat");
result = smack_accesses_add_modify(rules, "test_subject_03", "test_object_03", "", "rxwat");
smack_accesses_apply(rules);
- RUNNER_ASSERT_MSG(result == 0, "Error while applying accesses. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error while applying accesses. Result: " << result);
smack_accesses_free(rules);
}
// THE TEST
result = smack_accesses_add_modify(rules,TEST_SUBJECT, TEST_OBJECT,"xr","");
- RUNNER_ASSERT_MSG(result == 0, "Unable to add modify by empty rules");
- RUNNER_ASSERT_MSG(smack_accesses_apply(rules) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add modify by empty rules");
+ RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules) == 0, "Unable to apply rules");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,"xr");
- RUNNER_ASSERT_MSG(result == 1, "Rule modified (added 'xr'), but no change made.");
+ RUNNER_ASSERT_MSG_BT(result == 1, "Rule modified (added 'xr'), but no change made.");
// CLEAN UP
clean_up();
int result;
struct smack_accesses *rules = NULL;
result = smack_accesses_new(&rules);
- RUNNER_ASSERT_MSG(result == 0, "Unable to create smack_accesses instance");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to create smack_accesses instance");
clean_up();
// THE TEST
result = smack_accesses_add_modify(rules,TEST_SUBJECT, TEST_OBJECT,"r","");
- RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule.");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule.");
result = smack_accesses_add_modify(rules,TEST_SUBJECT, TEST_OBJECT,"","r");
- RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule.");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule.");
- RUNNER_ASSERT_MSG(smack_accesses_apply(rules) == 0, "Unable to apply rules");
- RUNNER_ASSERT_MSG(smack_have_access(TEST_SUBJECT, TEST_OBJECT,"r") == 0, "Modification didn't work");
+ RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG_BT(smack_have_access(TEST_SUBJECT, TEST_OBJECT,"r") == 0, "Modification didn't work");
// CLEAN UP
clean_up();
int result;
struct smack_accesses *rules = NULL;
result = smack_accesses_new(&rules);
- RUNNER_ASSERT_MSG(result == 0, "Unable to create smack_accesses instance");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to create smack_accesses instance");
clean_up();
// THE TEST
// Add r privilage
result = smack_accesses_add_modify(rules,TEST_SUBJECT, TEST_OBJECT,"r","");
- RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule.");
- RUNNER_ASSERT_MSG(smack_accesses_apply(rules) == 0, "Unable to apply rules");
- RUNNER_ASSERT_MSG(smack_have_access(TEST_SUBJECT, TEST_OBJECT,"r") == 1, "Adding privileges didn't work");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule.");
+ RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG_BT(smack_have_access(TEST_SUBJECT, TEST_OBJECT,"r") == 1, "Adding privileges didn't work");
smack_accesses_free(rules);
// Revoke r privilege
result = smack_accesses_new(&rules);
- RUNNER_ASSERT_MSG(result == 0, "Unable to create smack_accesses instance");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to create smack_accesses instance");
result = smack_accesses_add_modify(rules,TEST_SUBJECT, TEST_OBJECT,"","r");
- RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule.");
- RUNNER_ASSERT_MSG(smack_accesses_apply(rules) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule.");
+ RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules) == 0, "Unable to apply rules");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,"r");
- RUNNER_ASSERT_MSG(result == 0, "Modification didn't work, rule has still 'r' privileges.");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Modification didn't work, rule has still 'r' privileges.");
// CLEAN UP
clean_up();
int result;
struct smack_accesses *rules = NULL;
result = smack_accesses_new(&rules);
- RUNNER_ASSERT_MSG(result == 0, "Unable to create smack_accesses instance");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to create smack_accesses instance");
clean_up();
// THE TEST
result = smack_accesses_add_modify(rules,TEST_SUBJECT, TEST_OBJECT,"rwxat","");
- RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule.");
- RUNNER_ASSERT_MSG(smack_accesses_apply(rules) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule.");
+ RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules) == 0, "Unable to apply rules");
result = smack_accesses_add_modify(rules,TEST_SUBJECT, TEST_OBJECT,"","r");
- RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule.");
- RUNNER_ASSERT_MSG(smack_accesses_apply(rules) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule.");
+ RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules) == 0, "Unable to apply rules");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,"awxt");
- RUNNER_ASSERT_MSG(result == 1, "Modification didn't work. Rule should have 'awxt' privileges.");
+ RUNNER_ASSERT_MSG_BT(result == 1, "Modification didn't work. Rule should have 'awxt' privileges.");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,"r");
- RUNNER_ASSERT_MSG(result != 1, "Modification didn't work. Rule should NOT have 'r' privilege.");
+ RUNNER_ASSERT_MSG_BT(result != 1, "Modification didn't work. Rule should NOT have 'r' privilege.");
// CLEAN UP
clean_up();
int result;
struct smack_accesses *rules = NULL;
result = smack_accesses_new(&rules);
- RUNNER_ASSERT_MSG(result == 0, "Unable to create smack_accesses instance");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to create smack_accesses instance");
clean_up();
// THE TEST
result = smack_accesses_add_modify(rules,TEST_SUBJECT, TEST_OBJECT,"rwxat","");
- RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule.");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule.");
result = smack_accesses_add_modify(rules,TEST_SUBJECT, TEST_OBJECT,"","r");
- RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule.");
- RUNNER_ASSERT_MSG(smack_accesses_apply(rules) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule.");
+ RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules) == 0, "Unable to apply rules");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,"awxt");
- RUNNER_ASSERT_MSG(result == 1, "Modification didn't work. Rule should have 'awxt' privileges.");
+ RUNNER_ASSERT_MSG_BT(result == 1, "Modification didn't work. Rule should have 'awxt' privileges.");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,"r");
- RUNNER_ASSERT_MSG(result != 1, "Modification didn't work. Rule should NOT have 'r' privilege.");
+ RUNNER_ASSERT_MSG_BT(result != 1, "Modification didn't work. Rule should NOT have 'r' privilege.");
// CLEAN UP
clean_up();
int result;
struct smack_accesses *rules = NULL;
result = smack_accesses_new(&rules);
- RUNNER_ASSERT_MSG(result == 0, "Unable to create smack_accesses instance");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to create smack_accesses instance");
clean_up();
// THE TEST
result = smack_accesses_add_modify(rules,TEST_SUBJECT, TEST_OBJECT,"rwt","");
- RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule.");
- RUNNER_ASSERT_MSG(smack_accesses_apply(rules) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule.");
+ RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules) == 0, "Unable to apply rules");
result = smack_accesses_add_modify(rules,TEST_SUBJECT, TEST_OBJECT,"ax","rt");
- RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule.");
- RUNNER_ASSERT_MSG(smack_accesses_apply(rules) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule.");
+ RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules) == 0, "Unable to apply rules");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,"wax");
- RUNNER_ASSERT_MSG(result == 1, "Modification didn't work. Rule should have 'wax' privileges.");
+ RUNNER_ASSERT_MSG_BT(result == 1, "Modification didn't work. Rule should have 'wax' privileges.");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,"r");
- RUNNER_ASSERT_MSG(result != 1, "Modification didn't work. Rule should NOT have 'r' privilege.");
+ RUNNER_ASSERT_MSG_BT(result != 1, "Modification didn't work. Rule should NOT have 'r' privilege.");
// CLEAN UP
clean_up();
for (i = 0; i < accessesBasic.size(); ++i) {
result = smack_accesses_new(&rules);
- RUNNER_ASSERT_MSG(result == 0, "Unable to create smack_accesses instance");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to create smack_accesses instance");
result = smack_accesses_add_modify(rules,TEST_SUBJECT, TEST_OBJECT,accessesBasic[i].c_str(),accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG(result == 0, "Unable to modify accesses instance");
- RUNNER_ASSERT_MSG(smack_accesses_apply(rules) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify accesses instance");
+ RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules) == 0, "Unable to apply rules");
- RUNNER_ASSERT_MSG(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT),
+ RUNNER_ASSERT_MSG_BT(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
result = smack_accesses_new(&rules);
- RUNNER_ASSERT_MSG(result == 0, "Unable to create smack_accesses instance");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to create smack_accesses instance");
result = smack_accesses_add_modify(rules,TEST_SUBJECT, TEST_OBJECT,accessesBasic[i].c_str(),"");
result = smack_accesses_add_modify(rules,TEST_SUBJECT, TEST_OBJECT_2,accessesBasic[i].c_str(),"");
- RUNNER_ASSERT_MSG(result == 0, "Unable to modify accesses instance");
- RUNNER_ASSERT_MSG(smack_accesses_apply(rules) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify accesses instance");
+ RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules) == 0, "Unable to apply rules");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG(result == 1, "Modification didn't work. Rule " << accessesBasic[i].c_str() << " does not exist.");
+ RUNNER_ASSERT_MSG_BT(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(result == 1, "Modification didn't work. Rule " << accessesBasic[i].c_str() << " does not exist.");
+ RUNNER_ASSERT_MSG_BT(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(result == 0, "Revoking subject didn't work.");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Revoking subject didn't work.");
- RUNNER_ASSERT_MSG(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT),
+ RUNNER_ASSERT_MSG_BT(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT),
" Revoke didn't work. Accesses exist.");
- RUNNER_ASSERT_MSG(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT_2),
+ RUNNER_ASSERT_MSG_BT(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT_2),
" Revoke didn't work. Accesses exist.");
// Revoking subject again
result = smack_revoke_subject(TEST_SUBJECT);
- RUNNER_ASSERT_MSG(result == 0, "Revoking subject didn't work.");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Revoking subject didn't work.");
- RUNNER_ASSERT_MSG(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT),
+ RUNNER_ASSERT_MSG_BT(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT),
" Revoke didn't work. Accesses exist.");
- RUNNER_ASSERT_MSG(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT_2),
+ RUNNER_ASSERT_MSG_BT(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT_2),
" Revoke didn't work. Accesses exist.");
smack_accesses_free(rules);
for (i = 0; i < accessesBasic.size(); ++i) {
// Creating and adding rules with TEST_OBJECT and TEST_OBJECT_2
result = smack_accesses_new(&rules);
- RUNNER_ASSERT_MSG(result == 0, "Unable to create smack_accesses instance");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to create smack_accesses instance");
result = smack_accesses_add(rules,TEST_SUBJECT, TEST_OBJECT,accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG(result == 0, "Unable to modify accesses instance");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify accesses instance");
result = smack_accesses_add(rules,TEST_SUBJECT, TEST_OBJECT_2,accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG(result == 0, "Unable to modify accesses instance");
- RUNNER_ASSERT_MSG(smack_accesses_apply(rules) == 0, "Unable to apply rules");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify accesses instance");
+ RUNNER_ASSERT_MSG_BT(smack_accesses_apply(rules) == 0, "Unable to apply rules");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG(result == 1, "Modification didn't work. Rule " << accessesBasic[i].c_str() << " does not exist.");
+ RUNNER_ASSERT_MSG_BT(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(result == 1, "Modification didn't work. Rule " << accessesBasic[i].c_str() << " does not exist.");
+ RUNNER_ASSERT_MSG_BT(result == 1, "Modification didn't work. Rule " << accessesBasic[i].c_str() << " does not exist.");
smack_accesses_free(rules);
// Creating and clearing rules with TEST_OBJECT
result = smack_accesses_new(&rules);
- RUNNER_ASSERT_MSG(result == 0, "Unable to create smack_accesses instance");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to create smack_accesses instance");
result = smack_accesses_add(rules,TEST_SUBJECT, TEST_OBJECT,accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG(result == 0, "Unable to modify accesses instance");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify accesses instance");
result = smack_accesses_clear(rules);
- RUNNER_ASSERT_MSG(result == 0, "Clearing rules didn't work.");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Clearing rules didn't work.");
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT,accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG(result == 0, "Clearing rules didn't work. Rule " << accessesBasic[i].c_str() << " does exist.");
+ RUNNER_ASSERT_MSG_BT(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(result == 1, "Clearing rules didn't work. Rule " << accessesBasic[i].c_str() << " does not exist.");
+ RUNNER_ASSERT_MSG_BT(result == 1, "Clearing rules didn't work. Rule " << accessesBasic[i].c_str() << " does not exist.");
smack_accesses_free(rules);
// Creating and clearing rules with TEST_OBJECT_2
result = smack_accesses_new(&rules);
- RUNNER_ASSERT_MSG(result == 0, "Unable to create smack_accesses instance");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to create smack_accesses instance");
result = smack_accesses_add(rules,TEST_SUBJECT, TEST_OBJECT_2,accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG(result == 0, "Unable to modify accesses instance");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify accesses instance");
result = smack_accesses_clear(rules);
- RUNNER_ASSERT_MSG(result == 0, "Clearing rules didn't work.");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Clearing rules didn't work.");
smack_accesses_free(rules);
- RUNNER_ASSERT_MSG(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT),
+ RUNNER_ASSERT_MSG_BT(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT),
" Clear didn't work. Accesses exist.");
- RUNNER_ASSERT_MSG(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT_2),
+ RUNNER_ASSERT_MSG_BT(checkNoAccesses(TEST_SUBJECT, TEST_OBJECT_2),
" Clear didn't work. Accesses exist.");
}
}
//int smack_accesses_new(struct smack_accesses **accesses);
result = smack_accesses_new(&rules); //rules struct init
- RUNNER_ASSERT_MSG(result == 0, "Unable to create smack_accesses instance");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to create smack_accesses instance");
result = smack_accesses_new(&import_test); //rules struct init
- RUNNER_ASSERT_MSG(result == 0, "Unable to create smack_accesses instance");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to create smack_accesses instance");
//opening files
fd = open("/tmp/smack01_rules", O_RDWR | O_CREAT | O_TRUNC, 0644); //for export prepared rules
- RUNNER_ASSERT_MSG(fd >= 0, "Unable to create /tmp/smack01_rules");
+ RUNNER_ASSERT_MSG_BT(fd >= 0, "Unable to create /tmp/smack01_rules");
tmp = open("/tmp/smack01_tmp", O_RDWR | O_CREAT | O_TRUNC, 0644); //for import rules exported before
- RUNNER_ASSERT_MSG(fd >= 0, "Unable to create /tmp/smack01_tmp");
+ RUNNER_ASSERT_MSG_BT(fd >= 0, "Unable to create /tmp/smack01_tmp");
sample = open("/etc/smack/test_smack_rules", O_RDONLY, 0644); //reference preinstalled rules
- RUNNER_ASSERT_MSG(sample >= 0, "Unable to open /etc/smack/test_smack_rules");
+ RUNNER_ASSERT_MSG_BT(sample >= 0, "Unable to open /etc/smack/test_smack_rules");
//int smack_accesses_add(struct smack_accesses *handle, const char *subject,
// const char *object, const char *access_type);
result = smack_accesses_add(rules, "writer", "book", "rw");
- RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add smack rules");
result = smack_accesses_add(rules, "reader", "book", "wx");
- RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add smack rules");
//int smack_accesses_add_modify(struct smack_accesses *handle, const char *subject,
// const char *object, const char *access_add, const char *access_del);
result = smack_accesses_add_modify(rules, "reader", "book", "r", "wx");
- RUNNER_ASSERT_MSG(0 == result, "Unable to modify smack rules");
+ RUNNER_ASSERT_MSG_BT(0 == result, "Unable to modify smack rules");
//int smack_accesses_save(struct smack_accesses *handle, int fd);
result = smack_accesses_save(rules, fd);
- RUNNER_ASSERT_MSG(0 == result, "Unable to save smack_accesses instance in file");
+ RUNNER_ASSERT_MSG_BT(0 == result, "Unable to save smack_accesses instance in file");
//int smack_accesses_add_from_file(struct smack_accesses *accesses, int fd);
result = lseek(fd, 0, SEEK_SET);
- RUNNER_ASSERT_MSG(result == 0, "lseek() error");
+ RUNNER_ASSERT_MSG_BT(result == 0, "lseek() error");
result = smack_accesses_add_from_file(import_test, fd);
- RUNNER_ASSERT_MSG(result == 0, "Unable to import rules from file");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to import rules from file");
result = smack_accesses_save(import_test, tmp);
- RUNNER_ASSERT_MSG(result == 0, "Unable to save smack_accesses instance in file");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to save smack_accesses instance in file");
result = files_compare(fd, tmp); //comparing rules saved in file, restored from it and stored one more time
- RUNNER_ASSERT_MSG(result == 0, "No match in stored and restored rules");
+ RUNNER_ASSERT_MSG_BT(result == 0, "No match in stored and restored rules");
result = files_compare(tmp, sample); //comparing rules stored in file with reference preinstalled rules
- RUNNER_ASSERT_MSG(result == 0, "No match in stored rules and pattern file");
+ RUNNER_ASSERT_MSG_BT(result == 0, "No match in stored rules and pattern file");
//void smack_accesses_free(struct smack_accesses *handle);
smack_accesses_free(rules);
int result; //for storing functions results
result = smack_accesses_new(&rules); //rules struct init
- RUNNER_ASSERT_MSG(result == 0, "Unable to create smack_accesses instance");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to create smack_accesses instance");
//adding test rules to struct
result = smack_accesses_add(rules, "writer", "book", "rwx");
- RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add smack rules");
result = smack_accesses_add(rules, "reader", "book", "r");
- RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add smack rules");
result = smack_accesses_add(rules, "spy", "book", "rwx");
- RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add smack rules");
//int smack_accesses_apply(struct smack_accesses *handle);
result = smack_accesses_apply(rules); //applying rules to kernel
- RUNNER_ASSERT_MSG(result == 0, "Unable to apply rules into kernel");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to apply rules into kernel");
//int smack_have_access(const char *subject, const char *object,
// const char *access_type);
result = smack_have_access("spy", "book", "rwx"); //should have access - rule exist
- RUNNER_ASSERT_MSG(result == 1, "Error while checking Smack access");
+ RUNNER_ASSERT_MSG_BT(result == 1, "Error while checking Smack access");
result = smack_have_access("reader", "book", "rwx"); //should have no access - wrong rule, should be "r" only
- RUNNER_ASSERT_MSG(result == 0, "Error while checking Smack access");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error while checking Smack access");
result = smack_have_access("mars", "book", "rwx"); //should fail - rule not exist
- RUNNER_ASSERT_MSG(result == -1, "Error while checking Smack access");
+ RUNNER_ASSERT_MSG_BT(result == -1, "Error while checking Smack access");
//int smack_revoke_subject(const char *subject);
result = smack_revoke_subject("snickers"); //this subject do not exist in kernel rules
- RUNNER_ASSERT_MSG(result == 0, "Error in removing not existing subject from kernel");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error in removing not existing subject from kernel");
result = smack_revoke_subject("spy"); //this subject exist in kernel rules
- RUNNER_ASSERT_MSG(result == 0, "Error in removing existing subject from kernel");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error in removing existing subject from kernel");
result = smack_have_access("spy", "book", "rwx"); //testing access after revoke_subject() from kernel
- RUNNER_ASSERT_MSG(result == 0, "Error in acces aplied to kernel"); //now spy should have no access
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error in acces aplied to kernel"); //now spy should have no access
result = smack_accesses_add(rules, "twix", "book", "rwx"); //for create new rule as a consequence of use accesses_clear() below
- RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add smack rules");
//int smack_accesses_clear(struct smack_accesses *handle);
result = smack_accesses_clear(rules); //"spy" removed before by using smack_revoke_subject()
- RUNNER_ASSERT_MSG(result == 0, "Error in clearing rules in kernel");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error in clearing rules in kernel");
result = smack_have_access("writer", "book", "rwx"); //testing acces after acces_clear()
- RUNNER_ASSERT_MSG(result == 0, "Error in acces aplied to kernel"); //now writer also should have no access
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error in acces aplied to kernel"); //now writer also should have no access
//free resources
smack_accesses_free(rules);
int expected;
result = smack_accesses_new(&rules); //rules struct init
- RUNNER_ASSERT_MSG(result == 0, "Unable to create smack_accesses instance");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to create smack_accesses instance");
//adding test rules with mixed string
for (i = 0; i < (3 * 8); i += 3) {
result = smack_accesses_add(rules, rules_tab[i], "book", rules_tab[i + 1]); //using mixed rules from table
- RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG_BT(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(result == 0, "Error in clearing rules in kernel");
+ //RUNNER_ASSERT_MSG_BT(result == 0, "Error in clearing rules in kernel");
//applying rules to kernel
result = smack_accesses_apply(rules);
- RUNNER_ASSERT_MSG(result == 0, "Unable to apply rules into kernel");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to apply rules into kernel");
//checking accesses using normal rules
for (i = 0; i < (3 * 8); i += 3) {
else
expected = 1;
result = smack_have_access(rules_tab[i], "book", rules_tab[i + 2]); //using normal rules from table
- RUNNER_ASSERT_MSG(result == expected, "Error while checking Smack access");
+ RUNNER_ASSERT_MSG_BT(result == expected, "Error while checking Smack access");
}
//free resources
else
expected = 1;
result = smack_have_access(rules_tab[i], "book", rules_tab[i + 1]); //using mixed rules from table
- RUNNER_ASSERT_MSG(result == expected, "Error while checking Smack access");
+ RUNNER_ASSERT_MSG_BT(result == expected, "Error while checking Smack access");
}
}
//int smack_new_label_from_self(char **label);
result = smack_new_label_from_self(&label);
- RUNNER_ASSERT_MSG(result >= 0, "Error in getting self label");
+ RUNNER_ASSERT_MSG_BT(result >= 0, "Error in getting self label");
//comparing this label with default one "_"
result = strcmp(label, def_rule);
- RUNNER_ASSERT_MSG(result == 0, "Wrong default process label");
+ RUNNER_ASSERT_MSG_BT(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(fd >= 0, "Unable to open /proc/self/attr/current");
+ RUNNER_ASSERT_MSG_BT(fd >= 0, "Unable to open /proc/self/attr/current");
result = read(fd, buff, B_SIZE);
- RUNNER_ASSERT_MSG(result >= 0, "Error in reading from file /proc/self/attr/current");
+ RUNNER_ASSERT_MSG_BT(result >= 0, "Error in reading from file /proc/self/attr/current");
result = strncmp(buff, def_rule, result);
- RUNNER_ASSERT_MSG(result == 0, "Wrong default process rule");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Wrong default process rule");
free(label);
//int smack_set_label_for_self(const char *label);
result = smack_set_label_for_self("cola");
- RUNNER_ASSERT_MSG(result == 0, "Error in setting self label");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error in setting self label");
//checking new label using smack function
result = smack_new_label_from_self(&label);
- RUNNER_ASSERT_MSG(result >= 0, "Error in getting self label");
+ RUNNER_ASSERT_MSG_BT(result >= 0, "Error in getting self label");
result = strcmp(label, "cola");
- RUNNER_ASSERT_MSG(result == 0, "Wrong process label");
+ RUNNER_ASSERT_MSG_BT(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(result == 0, "lseek() error");
+ RUNNER_ASSERT_MSG_BT(result == 0, "lseek() error");
result = read(fd, buff, B_SIZE);
- RUNNER_ASSERT_MSG(result >= 0, "Error in reading from file /proc/self/attr/current");
+ RUNNER_ASSERT_MSG_BT(result >= 0, "Error in reading from file /proc/self/attr/current");
result = strncmp(buff, "cola", result);
- RUNNER_ASSERT_MSG(result == 0, "Proces rule in /proc/self/attr/current other than set");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Proces rule in /proc/self/attr/current other than set");
free(label);
close(fd);
//preparing environment by restoring default "_" label
result = smack_setlabel(file_path, "_", SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "Error in setting ACCESS label for file");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error in setting ACCESS label for file");
//int smack_getlabel(const char *path, char** label,
// enum smack_label_type type);
result = smack_getlabel(file_path, &label, SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "Error in getting smack ACCESS label from file");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error in getting smack ACCESS label from file");
//get label, should be default "_"
result = strcmp(label, "_");
- RUNNER_ASSERT_MSG(result == 0, "Wrong file default label");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Wrong file default label");
free(label);
//get label using xattr function
result = getxattr(file_path, xattr(SMACK_LABEL_ACCESS), buff, B_SIZE);
- RUNNER_ASSERT_MSG(result > 0, "Error in getting xattr from file");
+ RUNNER_ASSERT_MSG_BT(result > 0, "Error in getting xattr from file");
//check label, should match the one readed by smack function
result = strncmp(buff, "_", result);
- RUNNER_ASSERT_MSG(result == 0, "Wrong file default label");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Wrong file default label");
//int smack_setlabel(const char *path, const char* label,
// enum smack_label_type type);
result = smack_setlabel(file_path, "fanta", SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "Error in setting ACCESS label for file");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error in setting ACCESS label for file");
//get label using smack function
result = smack_getlabel(file_path, &label, SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "Error in getting smack ACCESS label from file");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error in getting smack ACCESS label from file");
//get label, should be default "fanta"
result = strcmp(label, "fanta");
- RUNNER_ASSERT_MSG(result == 0, "Wrong file label");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Wrong file label");
free(label);
//get label using xattr function
result = getxattr(file_path, xattr(SMACK_LABEL_ACCESS), buff, B_SIZE);
- RUNNER_ASSERT_MSG(result > 0, "Error in getting xattr from file");
+ RUNNER_ASSERT_MSG_BT(result > 0, "Error in getting xattr from file");
//check label, should match the one readed by smack function
result = strncmp(buff, "fanta", result);
- RUNNER_ASSERT_MSG(result == 0, "Wrong file label");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Wrong file label");
}
//RUNNER_TEST(smackXX_get_label_exec)
//preparing environment by restoring default "_" label
result = smack_lsetlabel(file_path, "_", SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "Error in setting ACCESS label for file");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error in setting ACCESS label for file");
result = smack_setlabel(file_path, "_", SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "Error in setting ACCESS label for file");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error in setting ACCESS label for file");
//int smack_lgetlabel(const char *path, char** label,
// enum smack_label_type type);
result = smack_lgetlabel(file_path, &label, SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "Error in getting smack ACCESS label from file");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error in getting smack ACCESS label from file");
//get label of symbolic link, should be default "_"
result = strcmp(label, "_");
- RUNNER_ASSERT_MSG(result == 0, "Wrong file default label");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Wrong file default label");
free(label);
//get label using xattr function
result = lgetxattr(file_path, xattr(SMACK_LABEL_ACCESS), buff, B_SIZE);
- RUNNER_ASSERT_MSG(result > 0, "Error in getting xattr from file");
+ RUNNER_ASSERT_MSG_BT(result > 0, "Error in getting xattr from file");
//check label, should match the one readed by smack function
result = strncmp(buff, "_", result);
- RUNNER_ASSERT_MSG(result == 0, "Wrong file default label");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Wrong file default label");
//int smack_lsetlabel(const char *path, const char* label,
// enum smack_label_type type);
result = smack_lsetlabel(file_path, "7up", SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "Error in setting ACCESS label for file");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error in setting ACCESS label for file");
//and set label for file pointed by link
result = smack_setlabel(file_path, "mirinda", SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "Error in setting ACCESS label for file");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error in setting ACCESS label for file");
//get label using smack function
result = smack_lgetlabel(file_path, &label, SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "Error in getting smack ACCESS label from file");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error in getting smack ACCESS label from file");
//check label, should be "7up"
result = strcmp(label, "7up");
- RUNNER_ASSERT_MSG(result == 0, "Wrong file label");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Wrong file label");
free(label);
//get label using xattr function
result = lgetxattr(file_path, xattr(SMACK_LABEL_ACCESS), buff, B_SIZE);
- RUNNER_ASSERT_MSG(result > 0, "Error in getting xattr from file");
+ RUNNER_ASSERT_MSG_BT(result > 0, "Error in getting xattr from file");
//check label, should match the one readed by smack function
result = strncmp(buff, "7up", result);
- RUNNER_ASSERT_MSG(result == 0, "Wrong file label");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Wrong file label");
//now similar to above, but folowing symbolic link set before to "mirinda"
result = smack_getlabel(file_path, &label, SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "Error gettin label of file pointed by symbolic link");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error gettin label of file pointed by symbolic link");
//now label should be "mirinda" for file instead of "7up" set for link
result = strcmp(label, "mirinda");
- RUNNER_ASSERT_MSG(result == 0, "Wrong label of file pointed by symbolic link");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Wrong label of file pointed by symbolic link");
free(label);
//get label using xattr function
result = getxattr(file_path, xattr(SMACK_LABEL_ACCESS), buff, B_SIZE);
- RUNNER_ASSERT_MSG(result > 0, "Error in getting xattr from file");
+ RUNNER_ASSERT_MSG_BT(result > 0, "Error in getting xattr from file");
//check label, should match the one readed by smack function
result = strncmp(buff, "mirinda", result);
- RUNNER_ASSERT_MSG(result == 0, "Wrong file label");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Wrong file label");
}
RUNNER_TEST(smack08_f_get_set_label)
const char *file_path = "/etc/smack/test_smack_rules";
fd = open(file_path, O_RDWR, 0644); //reference preinstalled rules
- RUNNER_ASSERT_MSG(fd >= 0, "Unable to open /etc/smack/test_smack_rules");
+ RUNNER_ASSERT_MSG_BT(fd >= 0, "Unable to open /etc/smack/test_smack_rules");
//preparing environment by restoring default "_" label
result = smack_fsetlabel(fd, "_", SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "Error in setting ACCESS label for file");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error in setting ACCESS label for file");
//int smack_fgetlabel(int fd, char** label,
// enum smack_label_type type);
result = smack_fgetlabel(fd, &label, SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "Error in getting smack ACCESS label from file");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error in getting smack ACCESS label from file");
//check label, should be "_"
result = strcmp(label, "_");
- RUNNER_ASSERT_MSG(result == 0, "Wrong file default label");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Wrong file default label");
free(label);
//get label using xattr function
result = fgetxattr(fd, xattr(SMACK_LABEL_ACCESS), buff, B_SIZE);
- RUNNER_ASSERT_MSG(result > 0, "Error in getting xattr from file");
+ RUNNER_ASSERT_MSG_BT(result > 0, "Error in getting xattr from file");
//check label, should match the one readed by smack function
result = strncmp(buff, "_", result);
- RUNNER_ASSERT_MSG(result == 0, "Wrong file default label");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Wrong file default label");
//int smack_fsetlabel(int fd, const char* label,
// enum smack_label_type type);
result = smack_fsetlabel(fd, "sprite", SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "Error in setting ACCESS label for file");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error in setting ACCESS label for file");
//get label using smack function
result = smack_fgetlabel(fd, &label, SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(result == 0, "Error in getting smack ACCESS label from file");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error in getting smack ACCESS label from file");
//check label, should be "sprite"
result = strcmp(label, "sprite");
- RUNNER_ASSERT_MSG(result == 0, "Wrong file label");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Wrong file label");
free(label);
//get label using xattr function
result = fgetxattr(fd, xattr(SMACK_LABEL_ACCESS), buff, B_SIZE);
- RUNNER_ASSERT_MSG(result > 0, "Error in getting xattr from file");
+ RUNNER_ASSERT_MSG_BT(result > 0, "Error in getting xattr from file");
//check label, should match the one readed by smack function
result = strncmp(buff, "sprite", result);
- RUNNER_ASSERT_MSG(result == 0, "Wrong file label");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Wrong file label");
close(fd);
{
// Creating rules
result = smack_accesses_new(&rulesBasic);
- RUNNER_ASSERT_MSG(result == 0, "Error while creating new accesses. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error while creating new accesses. Result: " << result);
// Adding accesses
result = smack_accesses_add(rulesBasic, TEST_SUBJECT, TEST_OBJECT, accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG(result == 0, "Unable to add modify rulesBasic. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add modify rulesBasic. Result: " << result);
// Applying rules
result = smack_accesses_apply(rulesBasic);
- RUNNER_ASSERT_MSG(result == 0, "Error while applying accesses. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(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(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
" Error while checking smack access. Result: " << result);
smack_accesses_free(rulesBasic);
{
// --- Creating rules (r or w or x)
result = smack_accesses_new(&rulesBasic);
- RUNNER_ASSERT_MSG(result == 0, "Error while creating new accesses. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error while creating new accesses. Result: " << result);
// Adding accesses
result = smack_accesses_add(rulesBasic, TEST_SUBJECT, TEST_OBJECT, accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG(result == 0, "Unable to add rulesBasic. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add rulesBasic. Result: " << result);
// Applying rules
result = smack_accesses_apply(rulesBasic);
- RUNNER_ASSERT_MSG(result == 0, "Error while applying accesses. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(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(result == 1,
+ RUNNER_ASSERT_MSG_BT(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(result == 0,
+ RUNNER_ASSERT_MSG_BT(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(rulesBasic,TEST_SUBJECT, TEST_OBJECT,accessesBasic[i + 3].c_str(),accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG(result == 0, "Unable to add modify rulesBasic. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add modify rulesBasic. Result: " << result);
// Applying rules
result = smack_accesses_apply(rulesBasic);
- RUNNER_ASSERT_MSG(result == 0, "Error while applying accesses. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(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(result == 1,
+ RUNNER_ASSERT_MSG_BT(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(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
" Error while checking smack access. Result: " << result);
smack_accesses_free(rulesBasic);
// --- Creating complementary rules (r or w or x)
result = smack_accesses_new(&rulesBasic);
- RUNNER_ASSERT_MSG(result == 0, "Error while creating new accesses. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error while creating new accesses. Result: " << result);
// Adding accesses
result = smack_accesses_add(rulesBasic, TEST_SUBJECT, TEST_OBJECT, accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG(result == 0, "Unable to add rulesBasic. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(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(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
" Error while checking smack access. Result: " << result);
// Applying rules
result = smack_accesses_apply(rulesBasic);
- RUNNER_ASSERT_MSG(result == 0, "Error while applying accesses. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(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(result == 1,
+ RUNNER_ASSERT_MSG_BT(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(rulesBasic,TEST_SUBJECT, TEST_OBJECT,"rwx",accessesBasic[i].c_str());
- RUNNER_ASSERT_MSG(result == 0, "Unable to add modify rulesBasic. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add modify rulesBasic. Result: " << result);
// Applying rules
result = smack_accesses_apply(rulesBasic);
- RUNNER_ASSERT_MSG(result == 0, "Error while applying accesses. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(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(result == 1,
+ RUNNER_ASSERT_MSG_BT(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(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
" Error while checking smack access. Result: " << result);
// --- Adding crossing accesses (rx or rw or wx)
result = smack_accesses_add_modify(rulesBasic,TEST_SUBJECT, TEST_OBJECT,accessesBasic[3 + ((i + 1) % 3)].c_str(),"");
- RUNNER_ASSERT_MSG(result == 0, "Unable to add modify rulesBasic. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add modify rulesBasic. Result: " << result);
// Applying rules
result = smack_accesses_apply(rulesBasic);
- RUNNER_ASSERT_MSG(result == 0, "Error while applying accesses. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(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(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
" Error while checking smack access. Result: " << result);
result = smack_have_access(TEST_SUBJECT, TEST_OBJECT, "rwx");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
" Error while checking smack access. Result: " << result);
// Deleting all rules
result = smack_accesses_add_modify(rulesBasic,TEST_SUBJECT, TEST_OBJECT,"","rwx");
- RUNNER_ASSERT_MSG(result == 0, "Unable to add modify rulesBasic. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add modify rulesBasic. Result: " << result);
result = smack_accesses_apply(rulesBasic);
- RUNNER_ASSERT_MSG(result == 0, "Error while checking smack access. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error while checking smack access. Result: " << result);
smack_accesses_free(rulesBasic);
rulesBasic = NULL;
// Creating rules
result = smack_accesses_new(&rulesBasic);
- RUNNER_ASSERT_MSG(result == 0, "Error while creating new accesses. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error while creating new accesses. Result: " << result);
// Loading file with rwxat rules - test_smack_rules_full
fd = open("/etc/smack/test_smack_rules_full", O_RDONLY, 0644);
- RUNNER_ASSERT_MSG(fd >= 0, "Unable to open /etc/smack/test_smack_rules_full");
+ RUNNER_ASSERT_MSG_BT(fd >= 0, "Unable to open /etc/smack/test_smack_rules_full");
// Adding rules from file
result = smack_accesses_add_from_file(rulesBasic, fd);
close(fd);
- RUNNER_ASSERT_MSG(result == 0, "Error importing accesses from file");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error importing accesses from file");
// Applying rules
result = smack_accesses_apply(rulesBasic);
- RUNNER_ASSERT_MSG(result == 0, "Error while applying accesses. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error while applying accesses. Result: " << result);
// Checking rules
result = smack_have_access("test_subject_01", "test_object_01", "rwxat");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
" Error while checking smack accesses.");
result = smack_have_access("test_subject_01", "test_object_02", "rwxat");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
" Error while checking smack accesses.");
result = smack_have_access("test_subject_01", "test_object_03", "rwxat");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
" Error while checking smack accesses.");
result = smack_have_access("test_subject_02", "test_object_01", "rwxat");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
" Error while checking smack accesses.");
result = smack_have_access("test_subject_02", "test_object_02", "rwxat");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
" Error while checking smack accesses.");
result = smack_have_access("test_subject_02", "test_object_03", "rwxat");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
" Error while checking smack accesses.");
result = smack_have_access("test_subject_03", "test_object_01", "rwxat");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
" Error while checking smack accesses.");
result = smack_have_access("test_subject_03", "test_object_02", "rwxat");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
" Error while checking smack accesses.");
result = smack_have_access("test_subject_03", "test_object_03", "rwxat");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
" Error while checking smack accesses.");
// Removing rules
// Creating rules
result = smack_accesses_new(&rulesBasic);
- RUNNER_ASSERT_MSG(result == 0, "Error while creating new accesses. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error while creating new accesses. Result: " << result);
// Loading file with partial wrong rules - test_smack_rules2
fd = open("/etc/smack/test_smack_rules2", O_RDONLY, 0644);
- RUNNER_ASSERT_MSG(fd >= 0, "Unable to open /etc/smack/test_smack_rules2");
+ RUNNER_ASSERT_MSG_BT(fd >= 0, "Unable to open /etc/smack/test_smack_rules2");
// Adding rules from file
result = smack_accesses_add_from_file(rulesBasic, fd);
close(fd);
- RUNNER_ASSERT_MSG(result == 0, "Accesses were loaded from file");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Accesses were loaded from file");
// Applying rules
result = smack_accesses_apply(rulesBasic);
- RUNNER_ASSERT_MSG(result == 0, "Error while applying accesses. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error while applying accesses. Result: " << result);
// Checking rules
- RUNNER_ASSERT_MSG(checkNoAccesses("test_subject_01", "test_object_01"),
+ RUNNER_ASSERT_MSG_BT(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", "rwat");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(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(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
" Error while checking smack access loaded from /etc/smack/test_smack_rules2. Result: " << result );
- RUNNER_ASSERT_MSG(checkNoAccesses("test_subject_02", "test_object_01"),
+ RUNNER_ASSERT_MSG_BT(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-ft");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(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(result == 1,
+ RUNNER_ASSERT_MSG_BT(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(result == 1,
+ RUNNER_ASSERT_MSG_BT(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(result == 1,
+ RUNNER_ASSERT_MSG_BT(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");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
" Error while checking smack access loaded from /etc/smack/test_smack_rules2. Result: " << result );
// Removing rules
// Creating rules
result = smack_accesses_new(&rulesBasic);
- RUNNER_ASSERT_MSG(result == 0, "Error while creating new accesses. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error while creating new accesses. Result: " << result);
// Loading file with partial wrong rules - test_smack_rules3
fd = open("/etc/smack/test_smack_rules3", O_RDONLY, 0644);
- RUNNER_ASSERT_MSG(fd >= 0, "Unable to open /etc/smack/test_smack_rules3");
+ RUNNER_ASSERT_MSG_BT(fd >= 0, "Unable to open /etc/smack/test_smack_rules3");
// Adding rules from file
result = smack_accesses_add_from_file(rulesBasic, fd);
close(fd);
- RUNNER_ASSERT_MSG(result != 0, "Accesses were loaded from file");
+ RUNNER_ASSERT_MSG_BT(result != 0, "Accesses were loaded from file");
// Applying rules
result = smack_accesses_apply(rulesBasic);
- RUNNER_ASSERT_MSG(result == 0, "Error while applying accesses. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error while applying accesses. Result: " << result);
// Checking rules
result = smack_have_access("test_subject_01", "test_object_01", "rwat");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
" Error while checking smack access loaded from /etc/smack/test_smack_rules3. Result: " << result );
- RUNNER_ASSERT_MSG(checkNoAccesses("test_subject_01", "test_object_02"),
+ RUNNER_ASSERT_MSG_BT(checkNoAccesses("test_subject_01", "test_object_02"),
" Error while checking smack access loaded from /etc/smack/test_smack_rules3. Accesses exist.");
result = smack_have_access("test_subject_01", "test_object_03", "x");
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
" Error while checking smack access loaded from /etc/smack/test_smack_rules3. Result: " << result );
// Removing rules
// Creating rules
result = smack_accesses_new(&rulesBasic);
- RUNNER_ASSERT_MSG(result == 0, "Error while creating new accesses. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error while creating new accesses. Result: " << result);
// Loading file with partial wrong rules - test_smack_rules4
fd = open("/etc/smack/test_smack_rules4", O_RDONLY, 0644);
- RUNNER_ASSERT_MSG(fd >= 0, "Unable to open /etc/smack/test_smack_rules4");
+ RUNNER_ASSERT_MSG_BT(fd >= 0, "Unable to open /etc/smack/test_smack_rules4");
// Adding rules from file
result = smack_accesses_add_from_file(rulesBasic, fd);
close(fd);
- RUNNER_ASSERT_MSG(result != 0, "Accesses were loaded from file");
+ RUNNER_ASSERT_MSG_BT(result != 0, "Accesses were loaded from file");
// Applying rules
result = smack_accesses_apply(rulesBasic);
- RUNNER_ASSERT_MSG(result == 0, "Error while applying accesses. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error while applying accesses. Result: " << result);
// Checking rules
result = smack_have_access("test_subject_01", "test_object_01", "rxwat");
- RUNNER_ASSERT_MSG(result == 1,
+ RUNNER_ASSERT_MSG_BT(result == 1,
" Error while checking smack access loaded from /etc/smack/test_smack_rules4. Result: " << result );
- RUNNER_ASSERT_MSG(checkNoAccesses("test_subject_01", "test_object_02"),
+ RUNNER_ASSERT_MSG_BT(checkNoAccesses("test_subject_01", "test_object_02"),
" Error while checking smack access loaded from /etc/smack/test_smack_rules4. Accesses exist.");
result = smack_have_access("test_subject_01", "test_object_03", "a");
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
" Error while checking smack access loaded from /etc/smack/test_smack_rules4. Result: " << result );
// Removing rules
number++;
result = asprintf(&smack_label, "s%d", number);
- RUNNER_ASSERT_MSG(result > 0, "asprintf failed");
+ RUNNER_ASSERT_MSG_BT(result > 0, "asprintf failed");
result = smack_set_label_for_self(smack_label);
- RUNNER_ASSERT_MSG(result == 0, "smack_set_label_for_self(" << smack_label << ") failed");
+ RUNNER_ASSERT_MSG_BT(result == 0, "smack_set_label_for_self(" << smack_label << ") failed");
free(smack_label);
}
if (fd < 0)
return;
result = smack_new_label_from_self(&smack_label);
- RUNNER_ASSERT_MSG(result >= 0, "smack_new_label_from_self() failed");
+ RUNNER_ASSERT_MSG_BT(result >= 0, "smack_new_label_from_self() failed");
result = write(fd, smack_label, strlen(smack_label));
- RUNNER_ASSERT_MSG(result == (int)strlen(smack_label), "write() failed");
+ RUNNER_ASSERT_MSG_BT(result == (int)strlen(smack_label), "write() failed");
close(fd);
free(smack_label);
}
unlink(SOCK_PATH);
smack_set_another_label_for_self();
pid = fork();
- RUNNER_ASSERT_MSG(pid >= 0, "Fork failed");
+ RUNNER_ASSERT_MSG_BT(pid >= 0, "Fork failed");
if (!pid) { /* child process, server */
int sock, result;
sock = socket(AF_UNIX, SOCK_STREAM, 0);
- RUNNER_ASSERT_MSG(sock >= 0, "socket failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(sock >= 0, "socket failed: " << strerror(errno));
result = bind(sock, (struct sockaddr*) &sockaddr, sizeof(struct sockaddr_un));
- RUNNER_ASSERT_MSG(result == 0, "bind failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "bind failed: " << strerror(errno));
result = listen(sock, 1);
- RUNNER_ASSERT_MSG(result == 0, "listen failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "listen failed: " << strerror(errno));
smack_unix_sock_server(sock);
pid = fork();
- RUNNER_ASSERT_MSG(pid >= 0, "Fork failed");
+ RUNNER_ASSERT_MSG_BT(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(sock >= 0, "socket failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(sock >= 0, "socket failed: " << strerror(errno));
result = connect(sock, (struct sockaddr*) &sockaddr, sizeof(struct sockaddr_un));
- RUNNER_ASSERT_MSG(result == 0, "connect failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result == 0, "connect failed: " << strerror(errno));
alarm(2);
result = read(sock, smack_label1, SMACK_LABEL_LEN);
- RUNNER_ASSERT_MSG(result >= 0, "read failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(result >= 0, "read failed: " << strerror(errno));
alarm(0);
smack_label1[result] = '\0';
result = smack_new_label_from_socket(sock, &smack_label2);
- RUNNER_ASSERT_MSG(result >= 0, "smack_label_from_socket failed");
+ RUNNER_ASSERT_MSG_BT(result >= 0, "smack_label_from_socket failed");
result = strcmp(smack_label1, smack_label2);
if (i < 3)
- RUNNER_ASSERT_MSG(result == 0, "smack labels differ: '" << smack_label1 << "' != '" << smack_label2 << "' i == " << i);
+ RUNNER_ASSERT_MSG_BT(result == 0, "smack labels differ: '" << smack_label1 << "' != '" << smack_label2 << "' i == " << i);
else
- RUNNER_ASSERT_MSG(result != 0, "smack labels do not differ: '" << smack_label1 << "' != '" << smack_label2 << "' i == " << i);
+ RUNNER_ASSERT_MSG_BT(result != 0, "smack labels do not differ: '" << smack_label1 << "' != '" << smack_label2 << "' i == " << i);
close(sock);
}
}
int fd = open(filePath.c_str(), O_RDWR | O_CREAT, S_IRWXU | S_IRWXG | S_IRWXO);
//restore system mask
umask(systemMask);
- RUNNER_ASSERT_MSG(fd > -1, "Unable to create file for tests: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(fd > -1, "Unable to create file for tests: " << strerror(errno));
//for descriptor protection
FDUniquePtr fp(&fd, closeFdPtr);
//change owner and group to user APP
int ret = chown(filePath.c_str(), APP_UID, APP_GID);
- RUNNER_ASSERT_MSG(ret == 0, "Unable to change file owner: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(ret == 0, "Unable to change file owner: " << strerror(errno));
//set smack label on file
ret = smack_setlabel(filePath.c_str(), fileLabel.c_str(), SMACK_LABEL_ACCESS);
- RUNNER_ASSERT_MSG(ret == 0, "Unable to set label for file: " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == 0, "Unable to get label from file");
+ RUNNER_ASSERT_MSG_BT(ret == 0, "Unable to get label from file");
std::string label_str(label ? label : "");
free(label);
- RUNNER_ASSERT_MSG(label_str == fileLabel, "File label not match set label");
+ RUNNER_ASSERT_MSG_BT(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(TRACE_FROM_HERE);
int ret = smack_have_access(selfLabel.c_str(), filename.c_str(), "l");
- RUNNER_ASSERT_MSG(ret == 1, "Error in adding laccess rule - l");
+ RUNNER_ASSERT_MSG_BT(ret == 1, "Error in adding laccess rule - l");
}
//- Create file
provider.applyAndSwithToUser(APP_UID, APP_GID, TRACE_FROM_HERE);
int ret = flock(fd, LOCK_EX | LOCK_NB);
- RUNNER_ASSERT_MSG(ret < 0, "Error, able to lock file: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(ret < 0, "Error, able to lock file: " << strerror(errno));
ret = flock(fd, LOCK_UN | LOCK_NB);
- RUNNER_ASSERT_MSG(ret < 0, "Error, able to lock file: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(ret < 0, "Error, able to lock file: " << strerror(errno));
ret = flock(fd, LOCK_SH | LOCK_NB);
- RUNNER_ASSERT_MSG(ret < 0, "Error, able to lock file: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(ret < 0, "Error, able to lock file: " << strerror(errno));
}
//- Create file
prepareEnvironment(selfLabel, filename, "l");
int ret = flock(fd, LOCK_EX | LOCK_NB);
- RUNNER_ASSERT_MSG(ret == 0, "Error, unable to exclusive lock file: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to exclusive lock file: " << strerror(errno));
ret = flock(fd, LOCK_UN | LOCK_NB);
- RUNNER_ASSERT_MSG(ret == 0, "Error, unable to unlock file: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to unlock file: " << strerror(errno));
ret = flock(fd, LOCK_SH | LOCK_NB);
- RUNNER_ASSERT_MSG(ret == 0, "Error, unable to shared lock file: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to shared lock file: " << strerror(errno));
}
//- Create file
prepareEnvironment(selfLabel, filename, "w");
int ret = flock(fd, LOCK_EX | LOCK_NB);
- RUNNER_ASSERT_MSG(ret == 0, "Error, unable to exclusive lock file: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to exclusive lock file: " << strerror(errno));
ret = flock(fd, LOCK_UN | LOCK_NB);
- RUNNER_ASSERT_MSG(ret == 0, "Error, unable to unlock file: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to unlock file: " << strerror(errno));
ret = flock(fd, LOCK_SH | LOCK_NB);
- RUNNER_ASSERT_MSG(ret == 0, "Error, unable to shared lock file: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to shared lock file: " << strerror(errno));
}
//- Create file
int fd = open(filePath.c_str(), O_RDWR);
FDUniquePtr fp(&fd, closeFdPtr);
int ret = flock(fd, LOCK_SH | LOCK_NB);
- RUNNER_ASSERT_MSG(ret == 0, "Error, unable to shared lock file: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to shared lock file: " << strerror(errno));
pid_t pid = fork();
if (pid == 0) {
prepareEnvironment(selfLabel, filename, "rw");
int child_fd = open(filePath.c_str(), O_RDWR);
- RUNNER_ASSERT_MSG(child_fd > -1, "Unable to open created file: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(child_fd > -1, "Unable to open created file: " << strerror(errno));
//for descriptor protection
FDUniquePtr fp(&child_fd, closeFdPtr);
ret = flock(child_fd, LOCK_SH | LOCK_NB);
- RUNNER_ASSERT_MSG(ret == 0, "Error, unable to lock file with shared lock: "
+ RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to lock file with shared lock: "
<< strerror(errno));
}
}
int fd = open(filePath.c_str(), O_RDWR);
FDUniquePtr fp(&fd, closeFdPtr);
int ret = flock(fd, LOCK_SH | LOCK_NB);
- RUNNER_ASSERT_MSG(ret == 0, "Error, unable to shared lock file: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to shared lock file: " << strerror(errno));
pid_t pid = fork();
if (pid == 0) {
prepareEnvironment(selfLabel, filename, "rl");
int child_fd = open(filePath.c_str(), O_RDONLY, 0);
- RUNNER_ASSERT_MSG(child_fd > -1, "Unable to open created file: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(child_fd > -1, "Unable to open created file: " << strerror(errno));
//for descriptor protection
FDUniquePtr fp(&child_fd, closeFdPtr);
ret = flock(child_fd, LOCK_SH | LOCK_NB);
- RUNNER_ASSERT_MSG(ret == 0, "Error, unable to lock file with shared lock: "
+ RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to lock file with shared lock: "
<< strerror(errno));
}
}
int fd = open(filePath.c_str(), O_RDWR);
FDUniquePtr fp(&fd, closeFdPtr);
int ret = flock(fd, LOCK_EX | LOCK_NB);
- RUNNER_ASSERT_MSG(ret == 0, "Error, unable to exclusive lock file: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to exclusive lock file: " << strerror(errno));
pid_t pid = fork();
if (pid == 0) {
prepareEnvironment(selfLabel, filename, "rw");
int child_fd = open(filePath.c_str(), O_RDWR, 0);
- RUNNER_ASSERT_MSG(child_fd > -1, "Unable to open created file: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(child_fd > -1, "Unable to open created file: " << strerror(errno));
//for descriptor protection
FDUniquePtr fp(&child_fd, closeFdPtr);
ret = flock(child_fd, LOCK_EX | LOCK_NB);
- RUNNER_ASSERT_MSG(ret < 0, "Error, able to lock file with exclusive lock");
+ RUNNER_ASSERT_MSG_BT(ret < 0, "Error, able to lock file with exclusive lock");
}
}
int fd = open(filePath.c_str(), O_RDWR, 0);
FDUniquePtr fp(&fd, closeFdPtr);
int ret = flock(fd, LOCK_EX | LOCK_NB);
- RUNNER_ASSERT_MSG(ret == 0, "Error, unable to exclusive lock file: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(ret == 0, "Error, unable to exclusive lock file: " << strerror(errno));
pid_t pid = fork();
if (pid == 0) {
prepareEnvironment(selfLabel, filename, "rl");
int child_fd = open(filePath.c_str(), O_RDONLY, 0);
- RUNNER_ASSERT_MSG(child_fd > -1, "Unable to open created file: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(child_fd > -1, "Unable to open created file: " << strerror(errno));
//for descriptor protection
FDUniquePtr fp(&child_fd, closeFdPtr);
ret = flock(child_fd, LOCK_EX | LOCK_NB);
- RUNNER_ASSERT_MSG(ret < 0, "Error, able to lock file with eclusive lock");
+ RUNNER_ASSERT_MSG_BT(ret < 0, "Error, able to lock file with eclusive lock");
}
}
//init rules
result = smack_accesses_new(&tmp);
- RUNNER_ASSERT_MSG(result == 0, "Unable to create smack_accesses instance");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to create smack_accesses instance");
//pass rules to unique_ptr
AccessesUniquePtr rules(tmp, smack_accesses_free);
//adding test rules to struct (same as SMACK version of smack02 test)
result = smack_accesses_add(rules.get(), "writer", "book", "rwx");
- RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add smack rules");
result = smack_accesses_add(rules.get(), "reader", "book", "r");
- RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add smack rules");
result = smack_accesses_add(rules.get(), "spy", "book", "rwx");
- RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add smack rules");
//applying rules to kernel (should fail)
result = smack_accesses_apply(rules.get());
- RUNNER_ASSERT_MSG(result == -1, "Unable to apply rules into kernel");
+ RUNNER_ASSERT_MSG_BT(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(result == -1, "smack_have_access should return error (SMACK is off)");
+ RUNNER_ASSERT_MSG_BT(result == -1, "smack_have_access should return error (SMACK is off)");
result = smack_have_access("reader", "book", "rwx");
- RUNNER_ASSERT_MSG(result == -1, "smack_have_access should return error (SMACK is off)");
+ RUNNER_ASSERT_MSG_BT(result == -1, "smack_have_access should return error (SMACK is off)");
result = smack_have_access("mars", "book", "rwx");
- RUNNER_ASSERT_MSG(result == -1, "smack_have_access should return error (SMACK is off)");
+ RUNNER_ASSERT_MSG_BT(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("snickers");
- RUNNER_ASSERT_MSG(result == -1, "smack_revoke_subject error - subject doesn't exist.");
+ RUNNER_ASSERT_MSG_BT(result == -1, "smack_revoke_subject error - subject doesn't exist.");
result = smack_revoke_subject("spy");
- RUNNER_ASSERT_MSG(result == -1, "smack_revoke_subject error - subject doesn't exist.");
+ RUNNER_ASSERT_MSG_BT(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(result == -1, "smack_have_access should return error (SMACK is off).");
+ RUNNER_ASSERT_MSG_BT(result == -1, "smack_have_access should return error (SMACK is off).");
result = smack_accesses_add(rules.get(), "twix", "book", "rwx");
- RUNNER_ASSERT_MSG(result == 0, "Unable to add smack rules");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to add smack rules");
//smack_accesses_clear should return error aswell
result = smack_accesses_clear(rules.get());
- RUNNER_ASSERT_MSG(result == -1, "Clearing rules should return error - no SMACK on system.");
+ RUNNER_ASSERT_MSG_BT(result == -1, "Clearing rules should return error - no SMACK on system.");
result = smack_have_access("writer", "book", "rwx");
- RUNNER_ASSERT_MSG(result == -1, "smack_have_access should return error (SMACK is off).");
+ RUNNER_ASSERT_MSG_BT(result == -1, "smack_have_access should return error (SMACK is off).");
}
/**
smack_accesses* tmp = NULL;
result = smack_accesses_new(&tmp);
- RUNNER_ASSERT_MSG(result == 0, "Error during rules creation.");
+ RUNNER_ASSERT_MSG_BT(result == 0, "Error during rules creation.");
AccessesUniquePtr rules(tmp, smack_accesses_free);
//open file with rules
fd = open("/etc/smack/test_smack_rules_full", O_RDONLY, 0644);
- RUNNER_ASSERT_MSG(fd >= 0,
+ RUNNER_ASSERT_MSG_BT(fd >= 0,
"Unable to open /etc/smack/test_smack_rules_full. Errno: " << strerror(errno));
//load accesses from file
result = smack_accesses_add_from_file(rules.get(), fd);
close(fd);
- RUNNER_ASSERT_MSG(result == 0, "Error while importing accesses from file. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(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(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.");
+ 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.");
//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(fd >= 0, "/proc/self/attr/current failed to open.");
+ RUNNER_ASSERT_MSG_BT(fd >= 0, "/proc/self/attr/current failed to open.");
result = read(fd, buff, B_SIZE); //however reading it should return error
if(result >= 0) {
close(fd);
- RUNNER_ASSERT_MSG(false, "Reading /proc/self/attr/current should return error.");
+ RUNNER_ASSERT_MSG_BT(false, "Reading /proc/self/attr/current should return error.");
}
//setting label for self should fail
result = smack_set_label_for_self("fanta");
if(result != -1) {
close(fd);
- RUNNER_ASSERT_MSG(false, "set_label_for_self should return error (SMACK is off).");
+ RUNNER_ASSERT_MSG_BT(false, "set_label_for_self should return error (SMACK is off).");
}
//getting previously set label should also fail
result = smack_new_label_from_self(&label);
if(result != -1) {
close(fd);
- RUNNER_ASSERT_MSG(false, "new_label_from_self should return error (SMACK is off).");
+ RUNNER_ASSERT_MSG_BT(false, "new_label_from_self should return error (SMACK is off).");
}
if(label != NULL) {
close(fd);
- RUNNER_ASSERT_MSG(false, "new_label_from_self shouldn't allocate memory to label.");
+ RUNNER_ASSERT_MSG_BT(false, "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
if(result != 0) {
close(fd);
- RUNNER_ASSERT_MSG(false, "lseek() error.");
+ RUNNER_ASSERT_MSG_BT(false, "lseek() error.");
}
result = read(fd, buff, B_SIZE); //however it should return error
if(result >= 0) {
close(fd);
- RUNNER_ASSERT_MSG(false, "Reading /proc/self/attr/current should return error.");
+ RUNNER_ASSERT_MSG_BT(false, "Reading /proc/self/attr/current should return error.");
}
close(fd);
smack_accesses* tmp = NULL;
result = smack_accesses_new(&tmp);
- RUNNER_ASSERT_MSG(result == 0, "Unable to allocate memory for rules. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to allocate memory for rules. Result: " << result);
AccessesUniquePtr rules(tmp, smack_accesses_free);
//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.get(), TEST_SUBJECT, TEST_OBJECT, "rwx", "");
- RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule. Result: " << result);
result = smack_accesses_add_modify(rules.get(), TEST_SUBJECT, TEST_OBJECT, "rwx", "");
- RUNNER_ASSERT_MSG(result == 0, "Unable to modify rule. Result: " << result);
+ RUNNER_ASSERT_MSG_BT(result == 0, "Unable to modify rule. Result: " << result);
result = smack_accesses_apply(rules.get());
- RUNNER_ASSERT_MSG(result == -1,
+ RUNNER_ASSERT_MSG_BT(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(false,
+ RUNNER_ASSERT_MSG_BT(false,
"smack_have_access should return error (SMACK is off). Result: " << result);
}
char* smack_label;
pid = fork();
- RUNNER_ASSERT_MSG(pid >= 0, "Fork failed");
+ RUNNER_ASSERT_MSG_BT(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(sock >= 0, "socket failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(sock >= 0, "socket failed: " << strerror(errno));
//Bind it to sockaddr
result = bind(sock, (struct sockaddr*) &sockaddr, sizeof(struct sockaddr_un));
if (result != 0) {
close(sock);
- RUNNER_ASSERT_MSG(false, "bind failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(false, "bind failed: " << strerror(errno));
}
//Prepare for listening
result = listen(sock, 1);
if (result != 0) {
close(sock);
- RUNNER_ASSERT_MSG(false, "listen failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(false, "listen failed: " << strerror(errno));
}
//Accept client
alarm(0);
if (fd < 0) {
close(sock);
- RUNNER_ASSERT_MSG(false, "Failed when accepting connection from client.");
+ RUNNER_ASSERT_MSG_BT(false, "Failed when accepting connection from client.");
}
//wait for smack_new_label_from_socket execution
//Create socket
sock = socket(AF_UNIX, SOCK_STREAM, 0);
- RUNNER_ASSERT_MSG(sock >= 0, "socket failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(sock >= 0, "socket failed: " << strerror(errno));
//Connect to sockaddr
result = connect(sock, (struct sockaddr*) &sockaddr,
sizeof(struct sockaddr_un));
if (result != 0) {
close(sock);
- RUNNER_ASSERT_MSG(false, "connect failed: " << strerror(errno));
+ RUNNER_ASSERT_MSG_BT(false, "connect failed: " << strerror(errno));
}
//Try getting label, should fail beacuse getsockopt won't get anything
result = smack_new_label_from_socket(sock, &smack_label);
close(sock);
- RUNNER_ASSERT_MSG(result == -1, "smack_new_label_from_socket should fail.");
+ RUNNER_ASSERT_MSG_BT(result == -1, "smack_new_label_from_socket should fail.");
}
}
for (int i = 0; perm_list[i] != NULL; i++) {
result = security_server_app_has_privilege(app_id, app_type, perm_list[i], &has_privilege);
- RUNNER_ASSERT_MSG(result == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == SECURITY_SERVER_API_SUCCESS,
"security_server_app_has_privilege failed with result: " << result);
- RUNNER_ASSERT_MSG(has_privilege == expected_result,
+ RUNNER_ASSERT_MSG_BT(has_privilege == expected_result,
"Unexpected result, has_privilege returned: " << has_privilege
<< ", expected: " << expected_result);
}
for (int i = 0; perm_list[i] != NULL; i++) {
result = security_server_app_caller_has_privilege(app_type, perm_list[i], &has_privilege);
- RUNNER_ASSERT_MSG(result == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == SECURITY_SERVER_API_SUCCESS,
"security_server_app_caller_has_privilege failed with result: " << result);
- RUNNER_ASSERT_MSG(has_privilege == expected_result,
+ RUNNER_ASSERT_MSG_BT(has_privilege == expected_result,
"Unexpected result, caller_has_privilege returned: " << has_privilege
<< ", expected: " << expected_result);
}
for (int i = 0; perm_list[i] != NULL; i++) {
// call api function - should return access denied error
result = security_server_app_has_privilege(app_id, app_type, perm_list[i], &has_privilege);
- RUNNER_ASSERT_MSG(result == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
+ RUNNER_ASSERT_MSG_BT(result == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
"security_server_app_has_privilege returned unexpected value, "
"result: " << result);
}
for (int i = 0; perm_list[i] != NULL; i++) {
// call api function - should return access denied error
result = security_server_app_caller_has_privilege(app_type, perm_list[i], &has_privilege);
- RUNNER_ASSERT_MSG(result == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
+ RUNNER_ASSERT_MSG_BT(result == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
"security_server_app_caller_has_privilege returned unexpected value, "
"result: " << result);
}
Cookie getCookieFromSS(const Tracker &tracker = Tracker()) {
Cookie cookie(security_server_get_cookie_size());
- RUNNER_ASSERT_MSG(SECURITY_SERVER_API_SUCCESS ==
+ RUNNER_ASSERT_MSG_BT(SECURITY_SERVER_API_SUCCESS ==
security_server_request_cookie(cookie.data(), cookie.size()),
tracker.str() << " 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(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_BUFFER_TOO_SMALL,
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
"Error in security_server_check_privilege() argument checking: " << ret);
}
RUNNER_CHILD_TEST(tc_arguments_03_01_security_server_check_privilege_by_cookie)
{
int ret = security_server_check_privilege_by_cookie(NULL, "wiadro", "rwx");
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
"Error in security_server_check_privilege_by_cookie() argument checking: "
<< ret);
}
Cookie cookie = getCookieFromSS(TRACE_FROM_HERE);
int ret = security_server_check_privilege_by_cookie(cookie.data(), NULL, "rwx");
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
"Error in security_server_check_privilege_by_cookie() argument checking: "
<< ret);
}
Cookie cookie = getCookieFromSS(TRACE_FROM_HERE);
int ret = security_server_check_privilege_by_cookie(cookie.data(), "wiadro", NULL);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
"Error in security_server_get_cookie_pid() argument checking: " << ret);
}
{
char *label = NULL;
label = security_server_get_smacklabel_cookie(NULL);
- RUNNER_ASSERT_MSG(label == NULL,
+ RUNNER_ASSERT_MSG_BT(label == NULL,
"Error in security_server_get_smacklabel_cookie() argument checking");
}
{
uid_t uid;
int ret = security_server_get_uid_by_cookie(NULL, &uid);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
"Error in security_server_get_uid_by_cookie() argument checking: "
<< ret);
}
Cookie cookie = getCookieFromSS(TRACE_FROM_HERE);
int ret = security_server_get_uid_by_cookie(cookie.data(), NULL);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
"Error in security_server_get_uid_by_cookie() argument checking: "
<< ret);
}
{
gid_t gid;
int ret = security_server_get_gid_by_cookie(NULL, &gid);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
"Error in security_server_get_gid_by_cookie() argument checking: "
<< ret);
}
Cookie cookie = getCookieFromSS(TRACE_FROM_HERE);
int ret = security_server_get_gid_by_cookie(cookie.data(), NULL);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM,
"Error in security_server_get_gid_by_cookie() argument checking: "
<< ret);
}
RUNNER_CHILD_TEST(tc_unit_01_01_security_server_get_cookie_size)
{
int ret = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG(ret == KNOWN_COOKIE_SIZE,
+ RUNNER_ASSERT_MSG_BT(ret == KNOWN_COOKIE_SIZE,
"Error in security_server_get_cookie_size(): " << ret);
}
provider.applyAndSwithToUser(APP_UID, APP_GID, TRACE_FROM_HERE);
int ret = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG(ret == KNOWN_COOKIE_SIZE,
+ RUNNER_ASSERT_MSG_BT(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(cookieSize == KNOWN_COOKIE_SIZE,
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
"Error in security_server_request_cookie(): " << ret);
}
Cookie cookie = getCookieFromSS(TRACE_FROM_HERE);
int ret = security_server_check_privilege(cookie.data(), 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
"Error in security_server_check_privilege(): " << ret);
}
provider.applyAndSwithToUser(APP_UID, APP_GID, TRACE_FROM_HERE);
int ret = security_server_check_privilege(cookie.data(), 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
"Error in security_server_check_privilege(): " << ret);
}
provider.applyAndSwithToUser(APP_UID, APP_GID, TRACE_FROM_HERE);
int ret = security_server_check_privilege(cookie.data(), 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
"Error in security_server_check_privilege(): " << ret);
}
Cookie cookie = getCookieFromSS(TRACE_FROM_HERE);
int ret = security_server_get_cookie_pid(cookie.data());
- RUNNER_ASSERT_MSG(ret > -1, "Error in security_server_get_cookie_pid(): " << ret);
+ RUNNER_ASSERT_MSG_BT(ret > -1, "Error in security_server_get_cookie_pid(): " << ret);
int pid = getpid();
- RUNNER_ASSERT_MSG(pid == ret, "No match in PID received from cookie");
+ RUNNER_ASSERT_MSG_BT(pid == ret, "No match in PID received from cookie");
}
//privileges drop and no smack rule
provider.applyAndSwithToUser(APP_UID, APP_GID, TRACE_FROM_HERE);
int ret = security_server_get_cookie_pid(cookie.data());
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
"Error in security_server_get_cookie_pid(): " << ret);
}
provider.applyAndSwithToUser(APP_UID, APP_GID, TRACE_FROM_HERE);
int ret = security_server_get_cookie_pid(cookie.data());
- RUNNER_ASSERT_MSG(ret > -1, "Error in security_server_get_cookie_pid(): " << ret);
+ RUNNER_ASSERT_MSG_BT(ret > -1, "Error in security_server_get_cookie_pid(): " << ret);
int pid = getpid();
- RUNNER_ASSERT_MSG(pid == ret, "No match in PID received from cookie");
+ RUNNER_ASSERT_MSG_BT(pid == ret, "No match in PID received from cookie");
}
//---------------------------------------------------------------------------
Cookie cookie = getCookieFromSS(TRACE_FROM_HERE);
UniquePtrCstring label(security_server_get_smacklabel_cookie(cookie.data()), free);
- RUNNER_ASSERT_MSG(strcmp(label.get(), "selflabel_06_01") == 0,
+ RUNNER_ASSERT_MSG_BT(strcmp(label.get(), "selflabel_06_01") == 0,
"No match in smack label received from cookie, received label: "
<< label.get());
}
provider.applyAndSwithToUser(APP_UID, APP_GID, TRACE_FROM_HERE);
UniquePtrCstring label(security_server_get_smacklabel_cookie(cookie.data()), free);
- RUNNER_ASSERT_MSG(label.get() == NULL,
+ RUNNER_ASSERT_MSG_BT(label.get() == NULL,
"NULL should be received due to access denied, received label: "
<< label.get());
}
Cookie cookie = getCookieFromSS(TRACE_FROM_HERE);
UniquePtrCstring label(security_server_get_smacklabel_cookie(cookie.data()), free);
- RUNNER_ASSERT_MSG(strcmp(label.get(), "selflabel_06_03") == 0,
+ RUNNER_ASSERT_MSG_BT(strcmp(label.get(), "selflabel_06_03") == 0,
"No match in smack label received from cookie, received label: "
<< label.get());
}
uid_t uid;
int ret = security_server_get_uid_by_cookie(cookie.data(), &uid);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
"Error in security_server_get_uid_by_cookie(): " << ret);
ret = getuid();
- RUNNER_ASSERT_MSG(ret == (int)uid, "No match in UID received from cookie");
+ RUNNER_ASSERT_MSG_BT(ret == (int)uid, "No match in UID received from cookie");
}
//privileges drop and no smack rule
uid_t uid;
int ret = security_server_get_uid_by_cookie(cookie.data(), &uid);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
"Error in security_server_get_uid_by_cookie(): " << ret);
}
uid_t uid;
int ret = security_server_get_uid_by_cookie(cookie.data(), &uid);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
"Error in security_server_get_uid_by_cookie(): " << ret);
ret = getuid();
- RUNNER_ASSERT_MSG(ret == (int)uid, "No match in UID received from cookie");
+ RUNNER_ASSERT_MSG_BT(ret == (int)uid, "No match in UID received from cookie");
}
//---------------------------------------------------------------------------
gid_t gid;
int ret = security_server_get_gid_by_cookie(cookie.data(), &gid);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
"Error in security_server_get_gid_by_cookie(): " << ret);
ret = getgid();
- RUNNER_ASSERT_MSG(ret == (int)gid, "No match in GID received from cookie");
+ RUNNER_ASSERT_MSG_BT(ret == (int)gid, "No match in GID received from cookie");
}
//privileges drop and no smack rule
gid_t gid;
int ret = security_server_get_gid_by_cookie(cookie.data(), &gid);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED,
"Error in security_server_get_gid_by_cookie(): " << ret);
}
gid_t gid;
int ret = security_server_get_gid_by_cookie(cookie.data(), &gid);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
"Error in security_server_get_gid_by_cookie(): " << ret);
ret = getgid();
- RUNNER_ASSERT_MSG(ret == (int)gid, "No match in GID received from cookie");
+ RUNNER_ASSERT_MSG_BT(ret == (int)gid, "No match in GID received from cookie");
}
#include <dpl/test/test_runner.h>
#include <dpl/test/test_runner_child.h>
#include <dpl/test/test_runner_multiprocess.h>
+#include <tests_common.h>
#include <errno.h>
#include <float.h>
#include <fcntl.h>
ssize_t rest = count;
ssize_t s;
while (rest > 0) {
- RUNNER_ASSERT_MSG(0 < (s = TEMP_FAILURE_RETRY(read(fd, ((char*)buf) + readf, rest))), "Error in read from pipe");
+ RUNNER_ASSERT_MSG_BT(0 < (s = TEMP_FAILURE_RETRY(read(fd, ((char*)buf) + readf, rest))), "Error in read from pipe");
rest -= s;
readf += s;
}
ssize_t rest = count;
ssize_t s;
while (rest > 0) {
- RUNNER_ASSERT_MSG(0 <= (s = TEMP_FAILURE_RETRY(write(fd, ((char*)buf) + writef, rest))), "Error in write to pipe");
+ RUNNER_ASSERT_MSG_BT(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(res == 0, "gettimeofday() returned error value: " << res);
+ RUNNER_ASSERT_MSG_BT(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(ret == 0, "system sleep function returned premature wake-up; ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == 0, "system sleep function returned premature wake-up; ret = " << ret);
end_stats_update(&stats);
}
finish_stats(&stats, "my_nanosecsleep");
- 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);
+ 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);
}
/*
for (int i = 1; i <= NUMBER_OF_CALLS; i++) {
start_stats_update(&stats);
ret = security_server_get_gid(EXISTING_GROUP_NAME);
- RUNNER_ASSERT_MSG(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(0 == pipe(pipefd), "error in pipe");
+ RUNNER_ASSERT_MSG_BT(0 == pipe(pipefd), "error in pipe");
initialize_stats(&stats);
for (int i = 0; i < NUMBER_OF_CALLS; i++) {
- RUNNER_ASSERT_MSG(-1 != (cpid = fork()), "error in fork #i = " << i);
+ RUNNER_ASSERT_MSG_BT(-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(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");
+ 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");
close(pipefd[1]);
exit(EXIT_SUCCESS);
} else
{ /* Parent */
- 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(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(number_of_calls > 0, "commmunication error");
+ RUNNER_ASSERT_MSG_BT(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(cookie_size > 0, "cookie_size = " << cookie_size);
+ RUNNER_ASSERT_MSG_BT(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(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
end_stats_update(&stats);
}
finish_stats(&stats, "security_server_check_privilege");
int ret;
readwrite_stats stats;
initialize_stats(&stats);
- RUNNER_ASSERT_MSG(-1 != system("touch /opt/home/root/pid_cycle"),
+ RUNNER_ASSERT_MSG_BT(-1 != system("touch /opt/home/root/pid_cycle"),
"Cannot prepare environment for test.");
- RUNNER_ASSERT_MSG(0 == smack_set_label_for_self(subject_label),
+ RUNNER_ASSERT_MSG_BT(0 == smack_set_label_for_self(subject_label),
"Cannot prepare environment for test.");
- RUNNER_ASSERT_MSG(0 == (ret = smack_accesses_new(&handle)), "Error in smack_accesses_new()");
- RUNNER_ASSERT_MSG(0 == smack_accesses_add(handle,
+ RUNNER_ASSERT_MSG_BT(0 == (ret = smack_accesses_new(&handle)), "Error in smack_accesses_new()");
+ RUNNER_ASSERT_MSG_BT(0 == smack_accesses_add(handle,
subject_label,
object_label,
access_rights), "Error in smack_accesses_add()" );
- RUNNER_ASSERT_MSG(0 == (ret = smack_accesses_apply(handle)), "Error in smack_accesses_apply(); ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(0 == (ret = smack_accesses_apply(handle)), "Error in smack_accesses_apply(); ret = " << ret);
smack_accesses_free(handle);
- RUNNER_ASSERT_MSG(0 == (ret = smack_set_label_for_self(subject_label)), "Error in smack_set_label_for_self(); ret = " << ret);
- RUNNER_ASSERT_MSG(SECURITY_SERVER_API_SUCCESS == security_server_request_cookie(cookie, cookie_size), "Error in security_server_request_cookie()");
+ RUNNER_ASSERT_MSG_BT(0 == (ret = smack_set_label_for_self(subject_label)), "Error in smack_set_label_for_self(); ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(SECURITY_SERVER_API_SUCCESS == security_server_request_cookie(cookie, cookie_size), "Error in security_server_request_cookie()");
for (int i = 1; i <= NUMBER_OF_CALLS; i++) {
start_stats_update(&stats);
/*odd(i) - ask for possessed privileges, even(i) ask for not possessed privileges */
object_label,
access_rights_ext);
- RUNNER_ASSERT_MSG(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
end_stats_update(&stats);
}
finish_stats(&stats, "security_server_check_privilege_by_cookie");
readwrite_stats stats;
initialize_stats(&stats);
smack_accesses *handle;
- RUNNER_ASSERT(0 == smack_accesses_new(&handle));
- RUNNER_ASSERT(0 == smack_accesses_add(handle,
+ RUNNER_ASSERT_BT(0 == smack_accesses_new(&handle));
+ RUNNER_ASSERT_BT(0 == smack_accesses_add(handle,
subject_label,
object_label,
access_rights));
- RUNNER_ASSERT(0 == smack_accesses_apply(handle));
+ RUNNER_ASSERT_BT(0 == smack_accesses_apply(handle));
smack_accesses_free(handle);
int pid = fork();
- RUNNER_ASSERT(-1 != pid);
+ RUNNER_ASSERT_BT(-1 != pid);
if (0 == pid) {
// child
int sockfd = create_new_socket();
- RUNNER_ASSERT_MSG(sockfd >= 0, "create_new_socket() failed");
+ RUNNER_ASSERT_MSG_BT(sockfd >= 0, "create_new_socket() failed");
SockFDUniquePtr sockfd_ptr(&sockfd, closesockfdptr);
- RUNNER_ASSERT_MSG(0 == smack_set_label_for_self(subject_label), "child label " << subject_label << " not set");
+ RUNNER_ASSERT_MSG_BT(0 == smack_set_label_for_self(subject_label), "child label " << subject_label << " not set");
- RUNNER_ASSERT_MSG(listen(sockfd, 5) >= 0, "child listen failed");
+ RUNNER_ASSERT_MSG_BT(listen(sockfd, 5) >= 0, "child listen failed");
struct sockaddr_un client_addr;
socklen_t client_len = sizeof(client_addr);
int csockfd;
- RUNNER_ASSERT_MSG((csockfd = accept(sockfd,(struct sockaddr*)&client_addr, &client_len)) > 0, "child accept failed");
+ RUNNER_ASSERT_MSG_BT((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(sockfd >= 0, "connect_to_testserver() failed");
+ RUNNER_ASSERT_MSG_BT(sockfd >= 0, "connect_to_testserver() failed");
SockFDUniquePtr sockfd_ptr(&sockfd, closesockfdptr);
sockfd,
object_label,
access_rights);
- RUNNER_ASSERT_MSG(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "security_server_request_cookie failed; ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(communication_succeeded(ret) == 0, "commmunication error; ret = " << ret);
end_stats_update(&stats);
}
finish_stats(&stats, "security_server_check_privilege_by_pid");
#define ENVIRONMENT \
do { \
const char *subject_label = "mylabel"; \
- RUNNER_ASSERT_MSG(-1 != system("touch /opt/home/root/pid_cycle"), \
+ RUNNER_ASSERT_MSG_BT(-1 != system("touch /opt/home/root/pid_cycle"), \
"Cannot prepare environment for test."); \
- RUNNER_ASSERT_MSG(0 == smack_set_label_for_self(subject_label), \
+ RUNNER_ASSERT_MSG_BT(0 == smack_set_label_for_self(subject_label), \
"Cannot prepare environment for test."); \
- RUNNER_ASSERT_MSG(-1 != setgid(1), \
+ RUNNER_ASSERT_MSG_BT(-1 != setgid(1), \
"Cannot prepare environment for test."); \
- RUNNER_ASSERT_MSG(-1 != setuid(1), \
+ RUNNER_ASSERT_MSG_BT(-1 != setuid(1), \
"Cannot prepare environment for test"); \
} while (0)
#define ENVIRONMENT_NOSMACK \
do { \
int fd = open("/opt/home/root/pid_cycle", O_CREAT|O_APPEND, 0444);\
- RUNNER_ASSERT_MSG(fd >= 0, \
+ RUNNER_ASSERT_MSG_BT(fd >= 0, \
"Couldn't create pid_cycle file. errno: " << strerror(errno));\
close(fd); \
- RUNNER_ASSERT_MSG(-1 != setgid(1), \
+ RUNNER_ASSERT_MSG_BT(-1 != setgid(1), \
"Cannot prepare environment for test."); \
- RUNNER_ASSERT_MSG(-1 != setuid(1), \
+ RUNNER_ASSERT_MSG_BT(-1 != setuid(1), \
"Cannot prepare environment for test"); \
} while (0)
ENVIRONMENT;
int ret = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG(20 == ret, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(20 == ret, "ret = " << ret);
}
/*
char cookie[20];
int ret = security_server_request_cookie(cookie, 20);
LogDebug("ret = " << ret);
- RUNNER_ASSERT(SECURITY_SERVER_API_SUCCESS == ret);
+ RUNNER_ASSERT_BT(SECURITY_SERVER_API_SUCCESS == ret);
}
/*
char cookie[20];
int ret = security_server_request_cookie(cookie, 10);
LogDebug("ret = " << ret);
- RUNNER_ASSERT(SECURITY_SERVER_API_ERROR_BUFFER_TOO_SMALL == ret);
+ RUNNER_ASSERT_BT(SECURITY_SERVER_API_ERROR_BUFFER_TOO_SMALL == ret);
}
/*
int ret = security_server_get_gid("abc123xyz_pysiaczek");
LogDebug("ret = " << ret);
- RUNNER_ASSERT_MSG(SECURITY_SERVER_API_ERROR_NO_SUCH_OBJECT == ret, "Ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(SECURITY_SERVER_API_ERROR_NO_SUCH_OBJECT == ret, "Ret: " << ret);
ret = security_server_get_gid("root");
LogDebug("ret = " << ret);
- RUNNER_ASSERT_MSG(0 == ret, "Ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(0 == ret, "Ret: " << ret);
}
/*
access.add(subject_label, "security-server::api-cookie-check", "w", TRACE_FROM_HERE);
access.apply(TRACE_FROM_HERE);
- RUNNER_ASSERT(0 == smack_set_label_for_self(subject_label));
+ RUNNER_ASSERT_BT(0 == smack_set_label_for_self(subject_label));
- RUNNER_ASSERT(SECURITY_SERVER_API_SUCCESS ==
+ RUNNER_ASSERT_BT(SECURITY_SERVER_API_SUCCESS ==
security_server_request_cookie(cookie,20));
- RUNNER_ASSERT_MSG(drop_root_privileges() == 0, "uid = " << getuid());
+ RUNNER_ASSERT_MSG_BT(drop_root_privileges() == 0, "uid = " << getuid());
- RUNNER_ASSERT(SECURITY_SERVER_API_SUCCESS ==
+ RUNNER_ASSERT_BT(SECURITY_SERVER_API_SUCCESS ==
security_server_check_privilege_by_cookie(
cookie,
object_label,
access_rights));
- RUNNER_ASSERT(SECURITY_SERVER_API_ERROR_ACCESS_DENIED ==
+ RUNNER_ASSERT_BT(SECURITY_SERVER_API_ERROR_ACCESS_DENIED ==
security_server_check_privilege_by_cookie(
cookie,
object_label,
int result2 = -1;
smack_accesses *handle;
- RUNNER_ASSERT(0 == smack_accesses_new(&handle));
- RUNNER_ASSERT(0 == smack_accesses_add(handle,
+ RUNNER_ASSERT_BT(0 == smack_accesses_new(&handle));
+ RUNNER_ASSERT_BT(0 == smack_accesses_add(handle,
subject_label,
object_label,
access_rights));
- RUNNER_ASSERT(0 == smack_accesses_apply(handle));
+ RUNNER_ASSERT_BT(0 == smack_accesses_apply(handle));
smack_accesses_free(handle);
int pid = fork();
char *label;
- RUNNER_ASSERT(-1 != pid);
+ RUNNER_ASSERT_BT(-1 != pid);
if (0 == pid) {
// child
- RUNNER_ASSERT_MSG(0 == smack_set_label_for_self(subject_label), "child label " << subject_label << " not set");
+ RUNNER_ASSERT_MSG_BT(0 == smack_set_label_for_self(subject_label), "child label " << subject_label << " not set");
int sockfd = create_new_socket();
- RUNNER_ASSERT_MSG(sockfd >= 0, "create_new_socket() failed");
+ RUNNER_ASSERT_MSG_BT(sockfd >= 0, "create_new_socket() failed");
SockFDUniquePtr sockfd_ptr(&sockfd, closesockfdptr);
label = security_server_get_smacklabel_sockfd(sockfd);
- RUNNER_ASSERT_MSG(label != NULL, "security_server_get_smacklabel_sockfd failed");
- RUNNER_ASSERT_MSG(strcmp(label,"") == 0, "label is \"" << label << "\"");
+ RUNNER_ASSERT_MSG_BT(label != NULL, "security_server_get_smacklabel_sockfd failed");
+ RUNNER_ASSERT_MSG_BT(strcmp(label,"") == 0, "label is \"" << label << "\"");
free(label);
- RUNNER_ASSERT_MSG(drop_root_privileges() == 0, "uid = " << getuid());
+ RUNNER_ASSERT_MSG_BT(drop_root_privileges() == 0, "uid = " << getuid());
- RUNNER_ASSERT_MSG(listen(sockfd, 5) >= 0, "child listen failed");
+ RUNNER_ASSERT_MSG_BT(listen(sockfd, 5) >= 0, "child listen failed");
label = security_server_get_smacklabel_sockfd(sockfd);
- RUNNER_ASSERT_MSG(label != NULL, "security_server_get_smacklabel_sockfd failed");
- RUNNER_ASSERT_MSG(strcmp(label,"") == 0, "label is \"" << label << "\"");
+ RUNNER_ASSERT_MSG_BT(label != NULL, "security_server_get_smacklabel_sockfd failed");
+ RUNNER_ASSERT_MSG_BT(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((csockfd = accept(sockfd,(struct sockaddr*)&client_addr, &client_len)) > 0, "child accept failed");
+ RUNNER_ASSERT_MSG_BT((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(sockfd >= 0, "connect_to_testserver() failed");
+ RUNNER_ASSERT_MSG_BT(sockfd >= 0, "connect_to_testserver() failed");
SockFDUniquePtr sockfd_ptr(&sockfd, closesockfdptr);
label = security_server_get_smacklabel_sockfd(sockfd);
- 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 << "\"" );
+ 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 << "\"" );
free(label);
result1 = security_server_check_privilege_by_sockfd(
access_rights_ext);
}
- RUNNER_ASSERT_MSG(SECURITY_SERVER_API_SUCCESS == result1, "result = " << result1);
- RUNNER_ASSERT_MSG(SECURITY_SERVER_API_ERROR_ACCESS_DENIED == result2, "result = " << result2);
+ RUNNER_ASSERT_MSG_BT(SECURITY_SERVER_API_SUCCESS == result1, "result = " << result1);
+ RUNNER_ASSERT_MSG_BT(SECURITY_SERVER_API_ERROR_ACCESS_DENIED == result2, "result = " << result2);
}
/*
access.apply(TRACE_FROM_HERE);
int pid = fork();
- RUNNER_ASSERT(-1 != pid);
+ RUNNER_ASSERT_BT(-1 != pid);
if (0 == pid) {
pid = fork();
- RUNNER_ASSERT(-1 != pid);
+ RUNNER_ASSERT_BT(-1 != pid);
if (0 == pid) {
// child
int sockfd = create_new_socket();
- RUNNER_ASSERT_MSG(sockfd >= 0, "create_new_socket() failed");
+ RUNNER_ASSERT_MSG_BT(sockfd >= 0, "create_new_socket() failed");
SockFDUniquePtr sockfd_ptr(&sockfd, closesockfdptr);
- RUNNER_ASSERT_MSG(0 == smack_set_label_for_self(subject_label), "child label " << subject_label << " not set");
+ RUNNER_ASSERT_MSG_BT(0 == smack_set_label_for_self(subject_label), "child label " << subject_label << " not set");
- RUNNER_ASSERT_MSG(drop_root_privileges() == 0, "uid = " << getuid());
+ RUNNER_ASSERT_MSG_BT(drop_root_privileges() == 0, "uid = " << getuid());
- RUNNER_ASSERT_MSG(listen(sockfd, 5) >= 0, "child listen failed");
+ RUNNER_ASSERT_MSG_BT(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(sockfd >= 0, "connect_to_testserver() failed");
+ RUNNER_ASSERT_MSG_BT(sockfd >= 0, "connect_to_testserver() failed");
result1 = security_server_check_privilege_by_sockfd(
sockfd,
close(sockfd);
- RUNNER_ASSERT_MSG(SECURITY_SERVER_API_SUCCESS == result1, "result1 = " << result1);
- RUNNER_ASSERT_MSG(SECURITY_SERVER_API_ERROR_ACCESS_DENIED == result2, " result2 = " << result2);
+ RUNNER_ASSERT_MSG_BT(SECURITY_SERVER_API_SUCCESS == result1, "result1 = " << result1);
+ RUNNER_ASSERT_MSG_BT(SECURITY_SERVER_API_ERROR_ACCESS_DENIED == result2, " result2 = " << result2);
}
}
}
ENVIRONMENT_NOSMACK;
int ret = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG(ret == 20, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == 20, "ret = " << ret);
}
RUNNER_CHILD_TEST_NOSMACK(tc02_security_server_request_cookie_normal_case_nosmack)
char cookie[20];
int ret = security_server_request_cookie(cookie, 20);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
RUNNER_CHILD_TEST_NOSMACK(tc03_security_server_request_cookie_too_small_buffer_size_nosmack)
char cookie[20];
int ret = security_server_request_cookie(cookie, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_BUFFER_TOO_SMALL, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_BUFFER_TOO_SMALL, "ret = " << ret);
}
RUNNER_CHILD_TEST_NOSMACK(tc04_security_server_get_gid_nosmack)
ENVIRONMENT_NOSMACK;
int ret = security_server_get_gid("definitely_not_existing_object");
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_SUCH_OBJECT, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_SUCH_OBJECT, "ret = " << ret);
ret = security_server_get_gid("root");
- RUNNER_ASSERT_MSG(ret == 0, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == 0, "ret = " << ret);
}
/*
char cookie[20];
const char* object_label = "tc05objectlabel";
- RUNNER_ASSERT(security_server_request_cookie(cookie,20) == SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT_BT(security_server_request_cookie(cookie,20) == SECURITY_SERVER_API_SUCCESS);
- RUNNER_ASSERT_MSG(drop_root_privileges() == 0, "uid = " << getuid());
+ RUNNER_ASSERT_MSG_BT(drop_root_privileges() == 0, "uid = " << getuid());
- RUNNER_ASSERT(SECURITY_SERVER_API_SUCCESS ==
+ RUNNER_ASSERT_BT(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(SECURITY_SERVER_API_SUCCESS ==
+ RUNNER_ASSERT_BT(SECURITY_SERVER_API_SUCCESS ==
security_server_check_privilege_by_cookie(cookie, object_label, "rw"));
}
int pid = fork();
char* label;
- RUNNER_ASSERT(pid >= 0);
+ RUNNER_ASSERT_BT(pid >= 0);
int ret;
if (pid == 0) { //child process - server
//create new socket
int sockfd = create_new_socket();
- RUNNER_ASSERT_MSG(sockfd >= 0, "create_new_socket() failed");
+ RUNNER_ASSERT_MSG_BT(sockfd >= 0, "create_new_socket() failed");
SockFDUniquePtr sockfd_ptr(&sockfd, closesockfdptr);
//check if get_smacklabel_sockfd works correctly
label = security_server_get_smacklabel_sockfd(sockfd);
- RUNNER_ASSERT_MSG(label != NULL, "security_server_get_smacklabel_sockfd failed");
+ RUNNER_ASSERT_MSG_BT(label != NULL, "security_server_get_smacklabel_sockfd failed");
ret = strcmp(label, "");
free(label);
- RUNNER_ASSERT_MSG(ret == 0, "label is \"" << label << "\"");
+ RUNNER_ASSERT_MSG_BT(ret == 0, "label is \"" << label << "\"");
- RUNNER_ASSERT_MSG(drop_root_privileges() == 0, "uid = " << getuid());
+ RUNNER_ASSERT_MSG_BT(drop_root_privileges() == 0, "uid = " << getuid());
- RUNNER_ASSERT_MSG(listen(sockfd, 5) >= 0, "child listen failed");
+ RUNNER_ASSERT_MSG_BT(listen(sockfd, 5) >= 0, "child listen failed");
struct sockaddr_un client_addr;
socklen_t client_len = sizeof(client_addr);
int csockfd;
- RUNNER_ASSERT_MSG((csockfd = accept(sockfd,(struct sockaddr*)&client_addr, &client_len)) > 0, "child accept failed");
+ RUNNER_ASSERT_MSG_BT((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(sockfd >= 0, "Failed to connect to server.");
+ RUNNER_ASSERT_MSG_BT(sockfd >= 0, "Failed to connect to server.");
SockFDUniquePtr sockfd_ptr(&sockfd, closesockfdptr);
label = security_server_get_smacklabel_sockfd(sockfd);
- RUNNER_ASSERT_MSG(label != NULL, "get_smacklabel_sockfd failed.");
+ RUNNER_ASSERT_MSG_BT(label != NULL, "get_smacklabel_sockfd failed.");
ret = strcmp(label, "");
free(label);
- RUNNER_ASSERT_MSG(ret == 0, "label is \"" << label << "\"");
+ RUNNER_ASSERT_MSG_BT(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(result1 == SECURITY_SERVER_API_SUCCESS, "result = " << result1);
- RUNNER_ASSERT_MSG(result2 == SECURITY_SERVER_API_SUCCESS, "result = " << result2);
+ RUNNER_ASSERT_MSG_BT(result1 == SECURITY_SERVER_API_SUCCESS, "result = " << result1);
+ RUNNER_ASSERT_MSG_BT(result2 == SECURITY_SERVER_API_SUCCESS, "result = " << result2);
}
/**
int result2 = -1;
int pid = fork();
- RUNNER_ASSERT(-1 != pid);
+ RUNNER_ASSERT_BT(-1 != pid);
if (pid == 0) {
pid = fork();
- RUNNER_ASSERT(-1 != pid);
+ RUNNER_ASSERT_BT(-1 != pid);
if (pid == 0) { //child process
//Create socket
int sockfd = create_new_socket();
- RUNNER_ASSERT_MSG(sockfd >= 0, "create_new_socket() failed");
+ RUNNER_ASSERT_MSG_BT(sockfd >= 0, "create_new_socket() failed");
SockFDUniquePtr sockfd_ptr(&sockfd, closesockfdptr);
//Drop privileges
- RUNNER_ASSERT_MSG(drop_root_privileges() == 0, "uid = " << getuid());
+ RUNNER_ASSERT_MSG_BT(drop_root_privileges() == 0, "uid = " << getuid());
//Prepare for accepting
- RUNNER_ASSERT_MSG(listen(sockfd, 5) >= 0, "child listen failed");
+ RUNNER_ASSERT_MSG_BT(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((csockfd = accept(sockfd,(struct sockaddr*)&client_addr, &client_len)) > 0, "child accept failed");
+ RUNNER_ASSERT_MSG_BT((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(drop_root_privileges() == 0, "uid = " << getuid());
+ RUNNER_ASSERT_MSG_BT(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(sockfd >= 0, "Failed to create socket fd.");
+ RUNNER_ASSERT_MSG_BT(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(SECURITY_SERVER_API_SUCCESS == result1, "result1 = " << result1);
- RUNNER_ASSERT_MSG(SECURITY_SERVER_API_SUCCESS == result2, "result2 = " << result2);
+ RUNNER_ASSERT_MSG_BT(SECURITY_SERVER_API_SUCCESS == result1, "result1 = " << result1);
+ RUNNER_ASSERT_MSG_BT(SECURITY_SERVER_API_SUCCESS == result2, "result2 = " << result2);
}
}
}
RUNNER_TEST(tc10_security_server_get_uid_by_cookie)
{
int cookieSize = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG(cookieSize == 20, "Wrong cookie size");
+ RUNNER_ASSERT_MSG_BT(cookieSize == 20, "Wrong cookie size");
std::vector<char> cookie(cookieSize);
int retval = security_server_request_cookie(&cookie[0], cookieSize);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
//checking function
uid_t cookieUid, realUid;
realUid = getuid();
retval = security_server_get_uid_by_cookie(&cookie[0], &cookieUid);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get UID from cookie. My uid: " << realUid << " Server error: " << retval);
- RUNNER_ASSERT_MSG(realUid == cookieUid, "No match in received UID");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get UID from cookie. My uid: " << realUid << " Server error: " << retval);
+ RUNNER_ASSERT_MSG_BT(realUid == cookieUid, "No match in received UID");
//checking for input parameters
retval = security_server_get_uid_by_cookie(NULL, &cookieUid);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "Error in checking input parameters by function");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "Error in checking input parameters by function");
retval = security_server_get_uid_by_cookie(&cookie[0], NULL);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "Error in checking input parameters by function");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "Error in checking input parameters by function");
}
RUNNER_CHILD_TEST_SMACK(tc11_security_server_get_uid_by_cookie_smack)
{
int cookieSize = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG(cookieSize == 20, "Wrong cookie size");
+ RUNNER_ASSERT_MSG_BT(cookieSize == 20, "Wrong cookie size");
std::vector<char> cookie(cookieSize);
int retval = security_server_request_cookie(&cookie[0], cookieSize);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
//preapare SMACK environment
- RUNNER_ASSERT_MSG(smack_set_label_for_self("BialyMis") == 0, "Unable to set label for self");
- RUNNER_ASSERT_MSG(smack_revoke_subject("BialyMis") == 0, "Error in smack_revoke_subject");
+ RUNNER_ASSERT_MSG_BT(smack_set_label_for_self("BialyMis") == 0, "Unable to set label for self");
+ RUNNER_ASSERT_MSG_BT(smack_revoke_subject("BialyMis") == 0, "Error in smack_revoke_subject");
//drop privileges
- RUNNER_ASSERT_MSG(setuid(APP_UID) == 0, "Unable to drop privileges");
+ RUNNER_ASSERT_MSG_BT(setuid(APP_UID) == 0, "Unable to drop privileges");
//checking function
uid_t cookieUid;
retval = security_server_get_uid_by_cookie(&cookie[0], &cookieUid);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "Socket not protected by smack");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "Socket not protected by smack");
}
RUNNER_CHILD_TEST_SMACK(tc12_security_server_get_uid_by_cookie_smack)
{
int cookieSize = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG(cookieSize == 20, "Wrong cookie size");
+ RUNNER_ASSERT_MSG_BT(cookieSize == 20, "Wrong cookie size");
uid_t realUid = getuid();
std::vector<char> cookie(cookieSize);
int retval = security_server_request_cookie(&cookie[0], cookieSize);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
//preapare SMACK environment
- RUNNER_ASSERT_MSG(smack_set_label_for_self("BialyMis") == 0, "Unable to set label for self");
- RUNNER_ASSERT_MSG(apply_smack_rule("BialyMis", "security-server::api-cookie-check", "w") == 0, "Error in adding rule");
+ RUNNER_ASSERT_MSG_BT(smack_set_label_for_self("BialyMis") == 0, "Unable to set label for self");
+ RUNNER_ASSERT_MSG_BT(apply_smack_rule("BialyMis", "security-server::api-cookie-check", "w") == 0, "Error in adding rule");
//drop privileges
- RUNNER_ASSERT_MSG(setuid(APP_UID) == 0, "Unable to drop privileges");
+ RUNNER_ASSERT_MSG_BT(setuid(APP_UID) == 0, "Unable to drop privileges");
//checking function
uid_t cookieUid;
retval = security_server_get_uid_by_cookie(&cookie[0], &cookieUid);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get UID from cookie");
- RUNNER_ASSERT_MSG(realUid == cookieUid, "No match in received UID");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get UID from cookie");
+ RUNNER_ASSERT_MSG_BT(realUid == cookieUid, "No match in received UID");
}
RUNNER_CHILD_TEST_NOSMACK(tc12_security_server_get_uid_by_cookie_nosmack)
{
int cookieSize = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG(cookieSize == 20, "Wrong cookie size");
+ RUNNER_ASSERT_MSG_BT(cookieSize == 20, "Wrong cookie size");
uid_t realUid = getuid();
std::vector<char> cookie(cookieSize);
int retval = security_server_request_cookie(&cookie[0], cookieSize);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
//drop privileges
- RUNNER_ASSERT_MSG(setuid(APP_UID) == 0, "Unable to drop privileges");
+ RUNNER_ASSERT_MSG_BT(setuid(APP_UID) == 0, "Unable to drop privileges");
//checking function
uid_t cookieUid;
retval = security_server_get_uid_by_cookie(&cookie[0], &cookieUid);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get UID from cookie");
- RUNNER_ASSERT_MSG(realUid == cookieUid, "No match in received UID");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get UID from cookie");
+ RUNNER_ASSERT_MSG_BT(realUid == cookieUid, "No match in received UID");
}
RUNNER_CHILD_TEST_SMACK(tc13_security_server_get_uid_by_cookie_smack)
{
int cookieSize = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG(cookieSize == 20, "Wrong cookie size");
+ RUNNER_ASSERT_MSG_BT(cookieSize == 20, "Wrong cookie size");
//preapare SMACK environment
- RUNNER_ASSERT_MSG(smack_set_label_for_self("BialyMis") == 0, "Unable to set label for self");
- RUNNER_ASSERT_MSG(apply_smack_rule("BialyMis", "security-server::api-cookie-check", "w") == 0, "Error in adding rule");
- RUNNER_ASSERT_MSG(apply_smack_rule("BialyMis", "security-server::api-cookie-get", "w") == 0, "Error in adding rule");
+ RUNNER_ASSERT_MSG_BT(smack_set_label_for_self("BialyMis") == 0, "Unable to set label for self");
+ RUNNER_ASSERT_MSG_BT(apply_smack_rule("BialyMis", "security-server::api-cookie-check", "w") == 0, "Error in adding rule");
+ RUNNER_ASSERT_MSG_BT(apply_smack_rule("BialyMis", "security-server::api-cookie-get", "w") == 0, "Error in adding rule");
//drop privileges
- RUNNER_ASSERT_MSG(setuid(APP_UID) == 0, "Unable to drop privileges");
+ RUNNER_ASSERT_MSG_BT(setuid(APP_UID) == 0, "Unable to drop privileges");
std::vector<char> cookie(cookieSize);
int retval = security_server_request_cookie(&cookie[0], cookieSize);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
//checking function
uid_t cookieUid, realUid = getuid();
retval = security_server_get_uid_by_cookie(&cookie[0], &cookieUid);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get UID from cookie");
- RUNNER_ASSERT_MSG(realUid == cookieUid, "No match in received UID");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get UID from cookie");
+ RUNNER_ASSERT_MSG_BT(realUid == cookieUid, "No match in received UID");
}
RUNNER_CHILD_TEST_NOSMACK(tc13_security_server_get_uid_by_cookie_nosmack)
{
int cookieSize = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG(cookieSize == 20, "Wrong cookie size");
+ RUNNER_ASSERT_MSG_BT(cookieSize == 20, "Wrong cookie size");
//drop privileges
- RUNNER_ASSERT_MSG(setuid(APP_UID) == 0, "Unable to drop privileges");
+ RUNNER_ASSERT_MSG_BT(setuid(APP_UID) == 0, "Unable to drop privileges");
std::vector<char> cookie(cookieSize);
int retval = security_server_request_cookie(&cookie[0], cookieSize);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
//checking function
uid_t cookieUid, realUid = getuid();
retval = security_server_get_uid_by_cookie(&cookie[0], &cookieUid);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get UID from cookie");
- RUNNER_ASSERT_MSG(realUid == cookieUid, "No match in received UID");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get UID from cookie");
+ RUNNER_ASSERT_MSG_BT(realUid == cookieUid, "No match in received UID");
}
RUNNER_TEST(tc14_security_server_get_gid_by_cookie)
{
int cookieSize = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG(cookieSize == 20, "Wrong cookie size");
+ RUNNER_ASSERT_MSG_BT(cookieSize == 20, "Wrong cookie size");
std::vector<char> cookie(cookieSize);
int retval = security_server_request_cookie(&cookie[0], cookieSize);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
//checking function
gid_t cookieGid, realGid;
realGid = getgid();
retval = security_server_get_gid_by_cookie(&cookie[0], &cookieGid);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get GID from cookie");
- RUNNER_ASSERT_MSG(realGid == cookieGid, "No match in received GID");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get GID from cookie");
+ RUNNER_ASSERT_MSG_BT(realGid == cookieGid, "No match in received GID");
//checking for input parameters
retval = security_server_get_gid_by_cookie(NULL, &cookieGid);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "Error in checking input parameters by function");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "Error in checking input parameters by function");
retval = security_server_get_gid_by_cookie(&cookie[0], NULL);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "Error in checking input parameters by function");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "Error in checking input parameters by function");
}
RUNNER_CHILD_TEST_SMACK(tc15_security_server_get_gid_by_cookie_smack)
{
int cookieSize = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG(cookieSize == 20, "Wrong cookie size");
+ RUNNER_ASSERT_MSG_BT(cookieSize == 20, "Wrong cookie size");
std::vector<char> cookie(cookieSize);
int retval = security_server_request_cookie(&cookie[0], cookieSize);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
//preapare SMACK environment
- RUNNER_ASSERT_MSG(smack_set_label_for_self("BialyMis") == 0, "Unable to set label for self");
- RUNNER_ASSERT_MSG(smack_revoke_subject("BialyMis") == 0, "Error in smack_revoke_subject");
+ RUNNER_ASSERT_MSG_BT(smack_set_label_for_self("BialyMis") == 0, "Unable to set label for self");
+ RUNNER_ASSERT_MSG_BT(smack_revoke_subject("BialyMis") == 0, "Error in smack_revoke_subject");
//drop privileges
- RUNNER_ASSERT_MSG(setgid(APP_GID) == 0, "Unable to drop privileges");
- RUNNER_ASSERT_MSG(setuid(APP_UID) == 0, "Unable to drop privileges");
+ RUNNER_ASSERT_MSG_BT(setgid(APP_GID) == 0, "Unable to drop privileges");
+ RUNNER_ASSERT_MSG_BT(setuid(APP_UID) == 0, "Unable to drop privileges");
//checking function
gid_t cookieGid, realGid;
realGid = getgid();
retval = security_server_get_gid_by_cookie(&cookie[0], &cookieGid);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "Socket not protected by smack");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "Socket not protected by smack");
}
RUNNER_CHILD_TEST_SMACK(tc16_security_server_get_gid_by_cookie_smack)
{
int cookieSize = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG(cookieSize == 20, "Wrong cookie size");
+ RUNNER_ASSERT_MSG_BT(cookieSize == 20, "Wrong cookie size");
std::vector<char> cookie(cookieSize);
gid_t realGid = getgid();
int retval = security_server_request_cookie(&cookie[0], cookieSize);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
//preapare SMACK environment
- RUNNER_ASSERT_MSG(smack_set_label_for_self("BialyMis") == 0, "Unable to set label for self");
- RUNNER_ASSERT_MSG(apply_smack_rule("BialyMis", "security-server::api-cookie-check", "w") == 0, "Error in adding rule");
+ RUNNER_ASSERT_MSG_BT(smack_set_label_for_self("BialyMis") == 0, "Unable to set label for self");
+ RUNNER_ASSERT_MSG_BT(apply_smack_rule("BialyMis", "security-server::api-cookie-check", "w") == 0, "Error in adding rule");
//drop privileges
- RUNNER_ASSERT_MSG(setgid(APP_GID) == 0, "Unable to drop privileges");
- RUNNER_ASSERT_MSG(setuid(APP_UID) == 0, "Unable to drop privileges");
+ RUNNER_ASSERT_MSG_BT(setgid(APP_GID) == 0, "Unable to drop privileges");
+ RUNNER_ASSERT_MSG_BT(setuid(APP_UID) == 0, "Unable to drop privileges");
//checking function
gid_t cookieGid;
retval = security_server_get_gid_by_cookie(&cookie[0], &cookieGid);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get GID from cookie");
- RUNNER_ASSERT_MSG(realGid == cookieGid, "No match in received GID. ReadGid: " << realGid << " CookieGid: " << cookieGid);
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get GID from cookie");
+ RUNNER_ASSERT_MSG_BT(realGid == cookieGid, "No match in received GID. ReadGid: " << realGid << " CookieGid: " << cookieGid);
}
RUNNER_CHILD_TEST_NOSMACK(tc16_security_server_get_gid_by_cookie_nosmack)
{
int cookieSize = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG(cookieSize == 20, "Wrong cookie size");
+ RUNNER_ASSERT_MSG_BT(cookieSize == 20, "Wrong cookie size");
std::vector<char> cookie(cookieSize);
gid_t realGid = getgid();
int retval = security_server_request_cookie(&cookie[0], cookieSize);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
//drop privileges
- RUNNER_ASSERT_MSG(setgid(APP_GID) == 0, "Unable to drop privileges");
- RUNNER_ASSERT_MSG(setuid(APP_UID) == 0, "Unable to drop privileges");
+ RUNNER_ASSERT_MSG_BT(setgid(APP_GID) == 0, "Unable to drop privileges");
+ RUNNER_ASSERT_MSG_BT(setuid(APP_UID) == 0, "Unable to drop privileges");
//checking function
gid_t cookieGid;
retval = security_server_get_gid_by_cookie(&cookie[0], &cookieGid);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get GID from cookie");
- RUNNER_ASSERT_MSG(realGid == cookieGid, "No match in received GID. ReadGid: " << realGid << " CookieGid: " << cookieGid);
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get GID from cookie");
+ RUNNER_ASSERT_MSG_BT(realGid == cookieGid, "No match in received GID. ReadGid: " << realGid << " CookieGid: " << cookieGid);
}
RUNNER_CHILD_TEST_SMACK(tc17_security_server_get_gid_by_cookie_smack)
{
int cookieSize = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG(cookieSize == 20, "Wrong cookie size");
+ RUNNER_ASSERT_MSG_BT(cookieSize == 20, "Wrong cookie size");
//preapare SMACK environment
- RUNNER_ASSERT_MSG(smack_set_label_for_self("BialyMis") == 0, "Unable to set label for self");
- RUNNER_ASSERT_MSG(apply_smack_rule("BialyMis", "security-server::api-cookie-check", "w") == 0, "Error in adding rule");
- RUNNER_ASSERT_MSG(apply_smack_rule("BialyMis", "security-server::api-cookie-get", "w") == 0, "Error in adding rule");
+ RUNNER_ASSERT_MSG_BT(smack_set_label_for_self("BialyMis") == 0, "Unable to set label for self");
+ RUNNER_ASSERT_MSG_BT(apply_smack_rule("BialyMis", "security-server::api-cookie-check", "w") == 0, "Error in adding rule");
+ RUNNER_ASSERT_MSG_BT(apply_smack_rule("BialyMis", "security-server::api-cookie-get", "w") == 0, "Error in adding rule");
//drop privileges
- RUNNER_ASSERT_MSG(setgid(APP_GID) == 0, "Unable to drop privileges");
- RUNNER_ASSERT_MSG(setuid(APP_UID) == 0, "Unable to drop privileges");
+ RUNNER_ASSERT_MSG_BT(setgid(APP_GID) == 0, "Unable to drop privileges");
+ RUNNER_ASSERT_MSG_BT(setuid(APP_UID) == 0, "Unable to drop privileges");
std::vector<char> cookie(cookieSize);
int retval = security_server_request_cookie(&cookie[0], cookieSize);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
//checking function
gid_t cookieGid, realGid = getgid();
retval = security_server_get_gid_by_cookie(&cookie[0], &cookieGid);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get GID from cookie");
- RUNNER_ASSERT_MSG(realGid == cookieGid, "No match in received GID. ReadGid: " << realGid << " CookieGid: " << cookieGid);
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get GID from cookie");
+ RUNNER_ASSERT_MSG_BT(realGid == cookieGid, "No match in received GID. ReadGid: " << realGid << " CookieGid: " << cookieGid);
}
RUNNER_CHILD_TEST_NOSMACK(tc17_security_server_get_gid_by_cookie_nosmack)
{
int cookieSize = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG(cookieSize == 20, "Wrong cookie size");
+ RUNNER_ASSERT_MSG_BT(cookieSize == 20, "Wrong cookie size");
//drop privileges
- RUNNER_ASSERT_MSG(setgid(APP_GID) == 0, "Unable to drop privileges");
- RUNNER_ASSERT_MSG(setuid(APP_UID) == 0, "Unable to drop privileges");
+ RUNNER_ASSERT_MSG_BT(setgid(APP_GID) == 0, "Unable to drop privileges");
+ RUNNER_ASSERT_MSG_BT(setuid(APP_UID) == 0, "Unable to drop privileges");
std::vector<char> cookie(cookieSize);
int retval = security_server_request_cookie(&cookie[0], cookieSize);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get cookie");
//checking function
gid_t cookieGid, realGid = getgid();
retval = security_server_get_gid_by_cookie(&cookie[0], &cookieGid);
- RUNNER_ASSERT_MSG(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get GID from cookie");
- RUNNER_ASSERT_MSG(realGid == cookieGid, "No match in received GID. ReadGid: " << realGid << " CookieGid: " << cookieGid);
+ RUNNER_ASSERT_MSG_BT(retval == SECURITY_SERVER_API_SUCCESS, "Unable to get GID from cookie");
+ RUNNER_ASSERT_MSG_BT(realGid == cookieGid, "No match in received GID. ReadGid: " << realGid << " CookieGid: " << cookieGid);
}
RUNNER_TEST_SMACK(tc18_security_server_get_smacklabel_cookie) {
char *cookie = NULL;
int cookie_size = security_server_get_cookie_size();
- RUNNER_ASSERT_MSG(PROPER_COOKIE_SIZE == cookie_size, "Wrong cookie size from security-server");
+ RUNNER_ASSERT_MSG_BT(PROPER_COOKIE_SIZE == cookie_size, "Wrong cookie size from security-server");
mypid = getpid();
cookie = (char*) calloc(cookie_size, 1);
- RUNNER_ASSERT_MSG(NULL != cookie, "Memory allocation error");
+ RUNNER_ASSERT_MSG_BT(NULL != cookie, "Memory allocation error");
res = security_server_request_cookie(cookie, cookie_size);
if (res != SECURITY_SERVER_API_SUCCESS) {
free(cookie);
- RUNNER_ASSERT_MSG(res == SECURITY_SERVER_API_SUCCESS, "Error in requesting cookie from security-server");
+ RUNNER_ASSERT_MSG_BT(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(label_ss != NULL, "Error in getting label by cookie");
+ RUNNER_ASSERT_MSG_BT(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(res == 0, "Error in getting self SMACK label");
+ RUNNER_ASSERT_MSG_BT(res == 0, "Error in getting self SMACK label");
}
std::string label_self(label_smack ? label_smack : "");
free(label_smack);
- RUNNER_ASSERT_MSG(label_self == label_cookie, "No match in SMACK labels");
+ RUNNER_ASSERT_MSG_BT(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(PROPER_COOKIE_SIZE == cookie_size,
+ RUNNER_ASSERT_MSG_BT(PROPER_COOKIE_SIZE == cookie_size,
"Wrong cookie size from security-server. Size: " << cookie_size);
cookie = (char*) calloc(cookie_size, sizeof(char));
- RUNNER_ASSERT_MSG(NULL != cookie, "Memory allocation error");
+ RUNNER_ASSERT_MSG_BT(NULL != cookie, "Memory allocation error");
mypid = getpid();
res = security_server_request_cookie(cookie, cookie_size);
std::unique_ptr<char, std::function<void(char*)> > cookie_ptr(cookie, free);
cookie = NULL;
- RUNNER_ASSERT_MSG(res == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(label_ss != NULL, "Error in getting label by cookie");
+ RUNNER_ASSERT_MSG_BT(label_ss != NULL, "Error in getting label by cookie");
//Check if label_ss is correct, that is only one NULL character.
if (label_ss[0] != '\0') {
free(label_ss);
- RUNNER_ASSERT_MSG(label_ss[0] == '\0', "label_ss was not an empty string.");
+ RUNNER_ASSERT_MSG_BT(label_ss[0] == '\0', "label_ss was not an empty string.");
}
free(label_ss);
char *smack_context = NULL;
pid_t pid = fork();
- RUNNER_ASSERT_MSG(-1 != pid, "fork() failed");
+ RUNNER_ASSERT_MSG_BT(-1 != pid, "fork() failed");
if (pid == 0) {
// child
ret = smack_set_label_for_self(subject_child);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS,
"smack_set__label_for_self() failed, ret: " << ret);
ret = smack_accesses_new(&handle);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS,
"smack_accesses_new() failed, ret: " << ret);
ret = smack_accesses_add(handle, subject_child, API_DATA_SHARE, API_FREE_ACCESS);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS,
"smack_accesses_add() failed, ret: " << ret);
ret = smack_accesses_apply(handle);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS,
"smack_accesses_apply() failed, ret: " << ret);
ret = smack_set_label_for_self(subject_child);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS,
"smack_set_label_for_self() failed, ret: " << ret);
smack_accesses_free(handle);
ret = dbus_error_is_set(&err);
if (1 == ret) {
dbus_error_free(&err);
- RUNNER_ASSERT_MSG(0 == ret, "dbus_bus_get() failed, ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(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(DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret,
+ RUNNER_ASSERT_MSG_BT(DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret,
"dbus_bus_request_name() failed, ret: " << ret);
}
DBUS_SMACK_INTERFACE,
DBUS_SMACK_METHOD);
- RUNNER_ASSERT_MSG(NULL != msg,
+ RUNNER_ASSERT_MSG_BT(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(1 == ret, "Out of memory");
+ RUNNER_ASSERT_MSG_BT(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(1 == ret, "Out of memory");
- RUNNER_ASSERT_MSG(NULL != pending, "Pending call null");
+ RUNNER_ASSERT_MSG_BT(1 == ret, "Out of memory");
+ RUNNER_ASSERT_MSG_BT(NULL != pending, "Pending call null");
dbus_connection_flush(conn);
// get the reply
msg = dbus_pending_call_steal_reply(pending);
- RUNNER_ASSERT_MSG(NULL != msg, "Reply null");
+ RUNNER_ASSERT_MSG_BT(NULL != msg, "Reply null");
// free message handle
dbus_pending_call_unref(pending);
ret = dbus_message_iter_init(msg, &iter);
if (0 == ret) {
- RUNNER_ASSERT_MSG(0 == ret, "Message has no arguments");
+ RUNNER_ASSERT_MSG_BT(0 == ret, "Message has no arguments");
} else {
dbus_message_iter_recurse(&iter, &var);
while (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_INVALID) {
dbus_connection_unref(conn);
ret = strcmp(smack_context, subject_parent);
- RUNNER_ASSERT_MSG(0 == ret,
+ RUNNER_ASSERT_MSG_BT(0 == ret,
"Context mismatch! context from dbus: " << smack_context);
exit(0);
} else {
// parent
ret = smack_set_label_for_self(subject_parent);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS,
"smack_set_label_for_self() failed, ret: " << ret);
ret = smack_accesses_new(&handle);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS,
"smack_accesses_new() failed, ret: " << ret);
ret = smack_accesses_add(handle, subject_parent, API_DATA_SHARE, API_FREE_ACCESS);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS,
"smack_accesses_add() failed, ret: " << ret);
ret = smack_accesses_apply(handle);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS,
"smack_accesses_apply() failed, ret: " << ret);
ret = smack_set_label_for_self(subject_parent);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS,
"smack_set_label_for_self() failed, ret: " << ret);
smack_accesses_free(handle);
ret = dbus_error_is_set(&err);
if (1 == ret) {
dbus_error_free(&err);
- RUNNER_ASSERT_MSG(0 == ret, "dbus_bus_get() failed, ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(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(DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret,
+ RUNNER_ASSERT_MSG_BT(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(-1 != pid, "fork() failed");
+ RUNNER_ASSERT_MSG_BT(-1 != pid, "fork() failed");
if (pid == 0) {
// child
ret = dbus_error_is_set(&err);
if (1 == ret) {
dbus_error_free(&err);
- RUNNER_ASSERT_MSG(false, "Failed to connect to system bus. Ret " << ret);
+ RUNNER_ASSERT_MSG_BT(false, "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(false, "Failed to request name on the bus. Ret " << ret);
+ RUNNER_ASSERT_MSG_BT(false, "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(msg != NULL, "dbus_message_new_method_call() failed.");
+ RUNNER_ASSERT_MSG_BT(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(ret == 1, "Out of memory. Ret " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == 1, "Out of memory. Ret " << ret);
- RUNNER_ASSERT_MSG(pending != NULL, "Pending call is NULL.");
+ RUNNER_ASSERT_MSG_BT(ret == 1, "Out of memory. Ret " << ret);
+ RUNNER_ASSERT_MSG_BT(pending != NULL, "Pending call is NULL.");
dbus_connection_flush(conn);
// get the reply
msg = dbus_pending_call_steal_reply(pending);
- RUNNER_ASSERT_MSG(msg != NULL, "Failed to get the reply from bus.");
+ RUNNER_ASSERT_MSG_BT(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(ret != 0, "DBus message has no arguments. Ret " << ret);
+ RUNNER_ASSERT_MSG_BT(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_connection_unref(conn);
ret = strcmp(smack_context, subject_parent);
- RUNNER_ASSERT_MSG(ret == 0, "Context mismatch. Context " << smack_context);
+ RUNNER_ASSERT_MSG_BT(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(0 == ret, "dbus_bus_get() failed, ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(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(DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret,
+ RUNNER_ASSERT_MSG_BT(DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != ret,
"dbus_bus_request_name() failed, ret: " << ret);
}
provider.applyAndSwithToUser(APP_UID, APP_GID, TRACE_FROM_HERE);
int ret = security_server_open_for(file, fd_ptr.get());
- RUNNER_ASSERT_MSG(ret == 0, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == 0, "ret: " << ret);
ret = write(*fd_ptr, write_buf1, strlen(write_buf1));
- RUNNER_ASSERT_MSG(ret == (int)strlen(write_buf1), "error in write: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == (int)strlen(write_buf1), "error in write: " << ret);
}
RUNNER_CHILD_TEST_SMACK(tc14_open_for_read_from_existing_file)
provider.applyAndSwithToUser(APP_UID, APP_GID, TRACE_FROM_HERE);
int ret = security_server_open_for(file, fd_ptr.get());
- RUNNER_ASSERT_MSG(ret == 0, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == 0, "ret: " << ret);
ret = read(*fd_ptr, read_buf1, strlen(write_buf1));
int err = errno;
- RUNNER_ASSERT_MSG(ret == (int)strlen(write_buf1), "error in read: " << ret << " err: " << strerror(err));
+ RUNNER_ASSERT_MSG_BT(ret == (int)strlen(write_buf1), "error in read: " << ret << " err: " << strerror(err));
- RUNNER_ASSERT_MSG(strncmp(read_buf1, write_buf1, strlen(read_buf1)) == 0, "string mismatch");
+ RUNNER_ASSERT_MSG_BT(strncmp(read_buf1, write_buf1, strlen(read_buf1)) == 0, "string mismatch");
}
RUNNER_CHILD_TEST_SMACK(tc15_open_for_write_to_existing_file)
ret = write(*fd_ptr, write_buf2, strlen(write_buf2));
int err = errno;
- RUNNER_ASSERT_MSG(ret == (int)strlen(write_buf2), "error in read: " << ret << " err: " << strerror(err));
+ RUNNER_ASSERT_MSG_BT(ret == (int)strlen(write_buf2), "error in read: " << ret << " err: " << strerror(err));
SecurityServer::AccessProvider provider(TEST01_SUBJECT);
provider.allowFunction("security_server_open_for", TRACE_FROM_HERE);
provider.applyAndSwithToUser(APP_UID, APP_GID, TRACE_FROM_HERE);
ret = security_server_open_for(file, fd_ptr.get());
- RUNNER_ASSERT_MSG(ret == 0, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == 0, "ret: " << ret);
ret = read(*fd_ptr, read_buf2, strlen(write_buf2));
err = errno;
- RUNNER_ASSERT_MSG(ret == (int)strlen(write_buf2), "error in read: " << ret << " err: " << strerror(err));
+ RUNNER_ASSERT_MSG_BT(ret == (int)strlen(write_buf2), "error in read: " << ret << " err: " << strerror(err));
- RUNNER_ASSERT_MSG(strncmp(read_buf2, write_buf2, strlen(read_buf2)) == 0, "string mismatch");
+ RUNNER_ASSERT_MSG_BT(strncmp(read_buf2, write_buf2, strlen(read_buf2)) == 0, "string mismatch");
}
RUNNER_CHILD_TEST_SMACK(tc16_open_for_bad_file_name)
"..","." };
for (auto iter = badFile.begin(); iter != badFile.end(); ++iter) {
int ret = security_server_open_for((*iter).c_str(), fd_ptr.get());
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
}
}
#include <dirent.h>
#include "security-server.h"
#include <dpl/test/test_runner.h>
+#include <tests_common.h>
#include <dlog.h>
#include "security_server_clean_env.h"
#include <tracker.h>
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- 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);
+ 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);
}
else
{
// TESTS:
// WITHOUT password
ret = security_server_set_pwd_validity(10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
ret = security_server_set_pwd_validity(11);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
// WITH password
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_validity(10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_validity(11);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
/**
// TESTS:
// WITHOUT password
ret = security_server_set_pwd_max_challenge(5);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
ret = security_server_set_pwd_max_challenge(6);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
// WITH password
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_max_challenge(5);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_max_challenge(6);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
/**
// 33 char password
ret = security_server_chk_pwd("abcdefghijklmnopqrstuvwxyz0123456", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
ret = security_server_chk_pwd("password", NULL, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
ret = security_server_chk_pwd("password", &attempt, NULL, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
ret = security_server_chk_pwd("password", &attempt, &max_attempt, NULL);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
}
/**
// TEST
ret = security_server_chk_pwd("isthisempty", &attempt, &max_attempt, &expire_sec);
- 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);
+ 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);
}
/**
// TEST
ret = security_server_set_pwd(NULL, NULL, 0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
}
/**
// TEST
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server(TRACE_FROM_HERE);
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
sleep(1);
// 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(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
sleep(1);
// 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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server(TRACE_FROM_HERE);
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
sleep(1);
ret = security_server_set_pwd(TEST_PASSWORD, SECOND_TEST_PASSWORD, UINT_MAX, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server(TRACE_FROM_HERE);
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
sleep(1);
ret = security_server_set_pwd(TEST_PASSWORD, "", 0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server(TRACE_FROM_HERE);
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
sleep(1);
long_password[5000] = '\0';
memset(long_password, 'A', 5000);
ret = security_server_set_pwd(TEST_PASSWORD,long_password, 10, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server(TRACE_FROM_HERE);
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
sleep(1);
ret = security_server_chk_pwd("", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server(TRACE_FROM_HERE);
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
ret = security_server_set_pwd_validity(0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_validity(1);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
ret = security_server_set_pwd_validity(2);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server(TRACE_FROM_HERE);
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 2);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST:
sleep(1);
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &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);
+ 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);
}
/**
// 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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TESTS
sleep(1);
ret = security_server_set_pwd_max_challenge(0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
sleep(1);
ret = security_server_set_pwd_max_challenge(UINT_MAX);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
sleep(1);
ret = security_server_set_pwd_max_challenge(5);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
sleep(1);
ret = security_server_set_pwd_max_challenge(6);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
// Prepare environment
reset_security_server(TRACE_FROM_HERE);
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
sleep(1);
ret = security_server_set_pwd_max_challenge(6);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
- RUNNER_ASSERT_MSG(max_attempt == 6, "max_attempt = " << max_attempt);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(max_attempt == 6, "max_attempt = " << max_attempt);
}
/**
// Prepare environment
reset_security_server(TRACE_FROM_HERE);
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
sleep(1);
ret = security_server_chk_pwd(TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, ret);
sleep(1);
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server(TRACE_FROM_HERE);
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
//TEST
sleep(1);
ret = security_server_chk_pwd(SECOND_TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server(TRACE_FROM_HERE);
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
sleep(1);
ret = security_server_set_pwd(SECOND_TEST_PASSWORD, THIRD_TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server(TRACE_FROM_HERE);
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
sleep(1);
ret = security_server_set_pwd(TEST_PASSWORD, SECOND_TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server(TRACE_FROM_HERE);
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
printf("5 subtests started...");
for (i = 1; i <= 5; i++) {
sleep(1);
ret = security_server_chk_pwd(SECOND_TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
- RUNNER_ASSERT_MSG(attempt == i, "attempt = " << attempt << ", expected " << i);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(attempt == i, "attempt = " << attempt << ", expected " << i);
}
printf("DONE\n");
sleep(1);
ret = security_server_chk_pwd(TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
sleep(1);
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- 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);
+ 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);
}
/**
// Prepare environment
reset_security_server(TRACE_FROM_HERE);
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 10, 1);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
printf("10 subtests started...");
for (i = 1; i <= 10; i++) {
sleep(1);
ret = security_server_chk_pwd(SECOND_TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
- RUNNER_ASSERT_MSG(attempt == i, "attempt = " << attempt << ", expected " << i);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(attempt == i, "attempt = " << attempt << ", expected " << i);
}
// The check, that exceeds max number
sleep(1);
ret = security_server_chk_pwd(SECOND_TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MAX_ATTEMPTS_EXCEEDED, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MAX_ATTEMPTS_EXCEEDED, "ret = " << ret);
printf("DONE\n");
sleep(1);
ret = security_server_chk_pwd(TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MAX_ATTEMPTS_EXCEEDED, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MAX_ATTEMPTS_EXCEEDED, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server(TRACE_FROM_HERE);
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 5, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
sleep(1);
ret = security_server_reset_pwd(TEST_PASSWORD, 10, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server(TRACE_FROM_HERE);
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 5, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
char* long_password = (char*) malloc(5001);
long_password[5000] = '\0';
memset(long_password, 'A', 5000);
ret = security_server_chk_pwd(long_password, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server(TRACE_FROM_HERE);
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 5, 1);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
sleep(1);
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
- RUNNER_ASSERT_MSG((expire_sec < 86402) && (expire_sec > 86396), "expire_sec = " << ret);
+ 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);
}
/**
// Prepare environment
reset_security_server(TRACE_FROM_HERE);
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 5, 1);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TESTS
sleep(1);
ret = security_server_set_pwd_history(100);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
sleep(1);
ret = security_server_set_pwd_history(51);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
sleep(1);
ret = security_server_set_pwd_history(-5);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
sleep(1);
ret = security_server_set_pwd_history(50);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
sleep(1);
ret = security_server_set_pwd_history(0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
sleep(1);
ret = security_server_set_pwd_history(INT_MAX);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
sleep(1);
ret = security_server_set_pwd_history(INT_MIN);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
sleep(1);
ret = security_server_set_pwd_history(10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
clean_password_dir();
ret = security_server_set_pwd_history(9);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
sleep(1);
ret = security_server_reset_pwd("history0", 0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
printf("11 subtests started...");
for (i = 0; i < 11; i++) {
sleep(1);
ret = security_server_set_pwd(buf1, buf2, 0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
printf("DONE\n");
sleep(1);
ret = security_server_set_pwd("history11", "history1", 0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
sleep(1);
ret = security_server_set_pwd("history1", "history8", 0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
sleep(1);
ret = security_server_set_pwd("history1", "history12", 0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
printf("DONE\n");
usleep(i);
}
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
}
/**
// Prepare environment
reset_security_server(TRACE_FROM_HERE);
ret = security_server_set_pwd(NULL, TEST_PASSWORD, 4, 1);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// TEST
sleep(1);
ret = security_server_chk_pwd(TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = gettimeofday(&cur_time, NULL);
- RUNNER_ASSERT_MSG(ret > -1, ret);
+ RUNNER_ASSERT_MSG_BT(ret > -1, ret);
cur_time.tv_sec += (expire_sec + 1);
ret = settimeofday(&cur_time, NULL);
- RUNNER_ASSERT_MSG(ret > -1, ret);
+ RUNNER_ASSERT_MSG_BT(ret > -1, ret);
sleep(1);
ret = security_server_chk_pwd(TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXPIRED, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXPIRED, "ret = " << ret);
sleep(1);
ret = security_server_chk_pwd(SECOND_TEST_PASSWORD, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
}
/**
// TEST
ret = security_server_reset_pwd(NULL, 10, 10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == expected_result,
+ RUNNER_ASSERT_MSG_BT(ret == expected_result,
tracker.str() <<
"security_server_chk_pwd returned "
<< ret << " (expected: " << expected_result << ")");
// validate current attempts value
- RUNNER_ASSERT_MSG(attempt == expected_current_attempt,
+ RUNNER_ASSERT_MSG_BT(attempt == expected_current_attempt,
tracker.str() <<
"security_server_chk_pwd returned attempt = " << attempt <<
" (expected: " << expected_current_attempt << ")");
// validate max attempt value
- RUNNER_ASSERT_MSG(max_attempt == expected_max_attempt,
+ RUNNER_ASSERT_MSG_BT(max_attempt == expected_max_attempt,
tracker.str() <<
"security_server_chk_pwd returned max_attempt = " << max_attempt <<
" (expected: " << expected_max_attempt << ")");
// validate expire seconds
if (expected_valid_secs == PASSWORD_INFINITE_EXPIRATION_TIME) {
- RUNNER_ASSERT_MSG(expire_sec == expected_valid_secs,
+ RUNNER_ASSERT_MSG_BT(expire_sec == expected_valid_secs,
tracker.str() <<
"security_server_chk_pwd returned expire_sec = " << expire_sec <<
" (expected: " << expected_valid_secs << ")");
unsigned int begin = expected_valid_secs > 5 ? expected_valid_secs - 5 : 0;
unsigned int end = expected_valid_secs + 5;
- RUNNER_ASSERT_MSG(expire_sec >= begin && expire_sec <= end,
+ RUNNER_ASSERT_MSG_BT(expire_sec >= begin && expire_sec <= end,
tracker.str() <<
"security_server_chk_pwd returned expire_sec = " << expire_sec <<
" (expected: <" << begin << "," << end << ")");
reset_security_server(TRACE_FROM_HERE);
int ret = security_server_set_pwd(NULL, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// change max attempts number few times
std::vector<unsigned int> max_challenge_tab = {1, 4, 2};
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd_max_challenge(max_challenges);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(TRACE_FROM_HERE);
int ret = security_server_set_pwd(NULL, TEST_PASSWORD, max_challenge_more, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// missed attempts
for (unsigned int attempt = 1; attempt <= max_challenge_more; ++attempt)
// lower max_challenge
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd_max_challenge(max_challenge_less);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd_max_challenge(0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// try valid password again - should pass
verify_chk_pwd(TEST_PASSWORD, SECURITY_SERVER_API_SUCCESS, 1, 0, TRACE_FROM_HERE);
// 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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// validate new password
verify_chk_pwd(SECOND_TEST_PASSWORD, SECURITY_SERVER_API_SUCCESS, 1, 0, TRACE_FROM_HERE);
reset_security_server(TRACE_FROM_HERE);
int ret = security_server_set_pwd_history(history_depth);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_reset_pwd(TEST_PASSWORD, max_challenge, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(TRACE_FROM_HERE);
ret = security_server_set_pwd_history(initial_history_depth);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_reset_pwd(TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
/*
* Lower history depth. At this point SS should treat THIRD_TEST_PASSWORD as current pwd,
*/
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd_history(decreased_history_depth);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
/*
* Increase history depth to 3. At this point SS should remember TEST_PASSWORD
*/
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd_history(increased_history_depth);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
}
/**
reset_security_server(TRACE_FROM_HERE);
int ret = security_server_set_pwd(NULL, TEST_PASSWORD, max_challenge, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
// missed attempts
for (unsigned int attempt = 1; attempt <= invalid_attempts_num; ++attempt)
usleep(PASSWORD_RETRY_TIMEOUT_US);
attempt = max_attempt = expire_sec = UINT_MAX;
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &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 = " <<
+ 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 = " <<
expire_sec);
// restart server - triggers loading password data from file
reset_security_server(TRACE_FROM_HERE);
int ret = security_server_set_pwd_history(history_depth);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_reset_pwd(TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
/**
//set new history count
int ret = security_server_set_pwd_history(history_depth);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
//set new password and fill history
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_reset_pwd(TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
//reset history limit to no history at all
usleep(PASSWORD_RETRY_TIMEOUT_US);
ret = security_server_set_pwd_history(empty_history_depth);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_PASSWORD_RETRY_TIMER, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_PASSWORD_RETRY_TIMER, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
//do test
ret = security_server_set_pwd(TEST_PASSWORD, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_RETRY_TIMER, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_RETRY_TIMER, "ret = " << ret);
ret = security_server_set_pwd(TEST_PASSWORD, TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_RETRY_TIMER, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
//do test
ret = security_server_set_pwd_validity(11);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_validity(11);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
//do test
ret = security_server_reset_pwd(TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_reset_pwd(TEST_PASSWORD, 0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
//do test
ret = security_server_set_pwd_history(5);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_history(5);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
//do test
ret = security_server_set_pwd_max_challenge(5);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_max_challenge(5);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
- RUNNER_ASSERT_MSG((time_t) expire_sec == PASSWORD_INFINITE_EXPIRATION_TIME,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+ RUNNER_ASSERT_MSG_BT((time_t) expire_sec == PASSWORD_INFINITE_EXPIRATION_TIME,
"invalid expiration time " << expire_sec);
clean_password_dir();
if (isSmack) {
//preapre environment
int ret = smack_set_label_for_self(g_subject.data());
- RUNNER_ASSERT_MSG(ret == 0, "Error in smack_set_label_for_self()");
+ RUNNER_ASSERT_MSG_BT(ret == 0, "Error in smack_set_label_for_self()");
struct smack_accesses *rulesRaw = NULL;
ret = smack_accesses_new(&rulesRaw);
- RUNNER_ASSERT_MSG(ret == 0, "Error in smack_accesses_new()");
+ RUNNER_ASSERT_MSG_BT(ret == 0, "Error in smack_accesses_new()");
AccessesUniquePtr rules(rulesRaw, smack_accesses_free);
ret = smack_accesses_add(rules.get(), g_subject.data(), g_object.data(), g_rule.data());
- RUNNER_ASSERT_MSG(ret == 0, "Error in smack_accesses_add()");
+ RUNNER_ASSERT_MSG_BT(ret == 0, "Error in smack_accesses_add()");
ret = smack_accesses_apply(rules.get());
- RUNNER_ASSERT_MSG(ret == 0, "Error in smack_accesses_apply()");
+ RUNNER_ASSERT_MSG_BT(ret == 0, "Error in smack_accesses_apply()");
}
//spawning threads
{
testFunction(true);
- RUNNER_ASSERT_MSG(g_successes == g_threadsNumber,
+ RUNNER_ASSERT_MSG_BT(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(g_successes == g_threadsNumber,
+ RUNNER_ASSERT_MSG_BT(g_successes == g_threadsNumber,
"Not all threads exit with success: "
<< g_successes << "/ " << g_threadsNumber
<< std::endl << "Errors:" << std::endl << g_errors);
reset_security_server();
ret = smack_accesses_new(&handle);
- RUNNER_ASSERT_MSG(ret == 0, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == 0, "ret: " << ret);
/* our subject 'subject_allow' has access to security-server::api-password-check */
ret = smack_accesses_add(handle, subject_allow, API_PASSWD_CHECK, API_RULE_REQUIRED);
- RUNNER_ASSERT_MSG(ret == 0, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == 0, "ret: " << ret);
ret = smack_accesses_apply(handle);
- RUNNER_ASSERT_MSG(ret == 0, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == 0, "ret: " << ret);
ret = smack_set_label_for_self(subject_allow);
- RUNNER_ASSERT_MSG(ret == 0, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == 0, "ret: " << ret);
smack_accesses_free(handle);
attempt = max_attempt = expire_sec = UINT_MAX;
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- 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);
+ 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);
/* we revoke all rules for subject 'subject_allow' */
ret = smack_revoke_subject(subject_allow);
- RUNNER_ASSERT_MSG(ret == 0, "Revoking subject didn't work.");
+ RUNNER_ASSERT_MSG_BT(ret == 0, "Revoking subject didn't work.");
sleep(1);
{
// get group ID by gtoup name
group *gr = getgrnam(group_name);
- RUNNER_ASSERT_MSG(gr != NULL, "Group '" << group_name << "' does not exist.");
+ RUNNER_ASSERT_MSG_BT(gr != NULL, "Group '" << group_name << "' does not exist.");
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(ngroups + 1, groups.data());
- RUNNER_ASSERT_MSG(ret == 0, "setgroups failed. ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == 0, "setgroups failed. ret = " << ret);
}
/*
{
// get group ID by gtoup name
group *gr = getgrnam(group_name);
- RUNNER_ASSERT_MSG(gr != NULL, "Group '" << group_name << "' does not exist.");
+ RUNNER_ASSERT_MSG_BT(gr != NULL, "Group '" << group_name << "' does not exist.");
const gid_t new_group_id = gr->gr_gid;
// get number of groups that the current process belongs to
// apply change
int ret = setgroups(ngroups - 1, groups.data());
- RUNNER_ASSERT_MSG(ret == 0, "setgroups failed. ret = " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == 0, "setgroups failed. ret = " << ret);
return;
}
}
RUNNER_TEST(tc_security_server_get_gid_normal_case_trying_to_get_gid_of_tel_gprs)
{
- RUNNER_ASSERT(security_server_get_gid("tel_gprs") >= 0);
+ RUNNER_ASSERT_BT(security_server_get_gid("tel_gprs") >= 0);
}
RUNNER_TEST(tc_security_server_get_gid_empty_object_name)
{
- RUNNER_ASSERT(security_server_get_gid("") == SECURITY_SERVER_API_ERROR_INPUT_PARAM);
+ RUNNER_ASSERT_BT(security_server_get_gid("") == SECURITY_SERVER_API_ERROR_INPUT_PARAM);
}
RUNNER_TEST(tc_security_server_get_gid_wrong_object_name_teltel)
{
- RUNNER_ASSERT(security_server_get_gid("teltel") == SECURITY_SERVER_API_ERROR_NO_SUCH_OBJECT);
+ RUNNER_ASSERT_BT(security_server_get_gid("teltel") == SECURITY_SERVER_API_ERROR_NO_SUCH_OBJECT);
}
//RUNNER_CHILD_TEST(tc_cookie_check_groups_privilege_negative)
//{
// remove_process_group(PROC_AUDIO_GROUP_NAME);
//
-// RUNNER_ASSERT(security_server_request_cookie((char*)cookie, COOKIE_SIZE) ==
+// RUNNER_ASSERT_BT(security_server_request_cookie((char*)cookie, COOKIE_SIZE) ==
// SECURITY_SERVER_API_SUCCESS);
// ret = security_server_get_gid(PROC_AUDIO_GROUP_NAME);
// ret = security_server_check_privilege((char*) cookie, ret);
-// RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
+// RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
//}
//
//RUNNER_CHILD_TEST(tc_cookie_check_groups_privilege_positive)
//{
// add_process_group(PROC_AUDIO_GROUP_NAME);
//
-// RUNNER_ASSERT(security_server_request_cookie((char*)cookie, COOKIE_SIZE) ==
+// RUNNER_ASSERT_BT(security_server_request_cookie((char*)cookie, COOKIE_SIZE) ==
// SECURITY_SERVER_API_SUCCESS);
// ret = security_server_get_gid(PROC_AUDIO_GROUP_NAME);
// ret = security_server_check_privilege((char*) cookie, ret);
-// RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
+// RUNNER_ASSERT_BT(ret == SECURITY_SERVER_API_SUCCESS);
//}
//RUNNER_TEST(tc_ask_for_privilege_with_default_cookie_case_with_wrong_cookie)
// for (i = 0; i < COOKIE_SIZE; i++)
// wrong_cookie[i] = rand() % 255;
// ret = security_server_check_privilege((const char*) wrong_cookie, ret);
-// RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
+// RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
//}
//
{
const char wrong_cookie[20] = {'w','a','t','?'};
int audioGID = security_server_get_gid("audio");
- RUNNER_ASSERT(SECURITY_SERVER_API_ERROR_ACCESS_DENIED
+ RUNNER_ASSERT_BT(SECURITY_SERVER_API_ERROR_ACCESS_DENIED
== security_server_check_privilege((const char*) wrong_cookie, audioGID));
}
RUNNER_TEST(tc_get_pid_of_non_existing_cookie)
{
const char wrong_cookie[20] = {'w', 'a', 't', '?'};
- RUNNER_ASSERT(security_server_get_cookie_pid(wrong_cookie) == SECURITY_SERVER_API_ERROR_NO_SUCH_COOKIE);
+ RUNNER_ASSERT_BT(security_server_get_cookie_pid(wrong_cookie) == SECURITY_SERVER_API_ERROR_NO_SUCH_COOKIE);
}
RUNNER_TEST(tc_get_pid_of_null_cookie)
{
- RUNNER_ASSERT(security_server_get_cookie_pid(NULL) == SECURITY_SERVER_API_ERROR_INPUT_PARAM);
+ RUNNER_ASSERT_BT(security_server_get_cookie_pid(NULL) == SECURITY_SERVER_API_ERROR_INPUT_PARAM);
}
RUNNER_CHILD_TEST_SMACK(tc01a_security_server_app_give_access)
smack_set_label_for_self(object);
- RUNNER_ASSERT_MSG(drop_root_privileges() == 0, "uid = " << getuid());
+ RUNNER_ASSERT_MSG_BT(drop_root_privileges() == 0, "uid = " << getuid());
security_server_app_give_access(subject, getpid());
- RUNNER_ASSERT(1 == smack_have_access(subject, object, "rwxat"));
+ RUNNER_ASSERT_BT(1 == smack_have_access(subject, object, "rwxat"));
}
/*
// time.
sleep(1);
- 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_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_CHILD_TEST_SMACK(tc01c_security_server_app_give_access_no_access)
smack.add(subject, object, "-----", TRACE_FROM_HERE);
smack.apply(TRACE_FROM_HERE);
- RUNNER_ASSERT_MSG(0 == smack_set_label_for_self(object), "Error in smack_label_for_self");
+ RUNNER_ASSERT_MSG_BT(0 == smack_set_label_for_self(object), "Error in smack_label_for_self");
- RUNNER_ASSERT_MSG(drop_root_privileges() == 0, "uid = " << getuid());
+ RUNNER_ASSERT_MSG_BT(drop_root_privileges() == 0, "uid = " << getuid());
- RUNNER_ASSERT(SECURITY_SERVER_API_ERROR_ACCESS_DENIED == security_server_app_give_access(subject, getpid()));
+ RUNNER_ASSERT_BT(SECURITY_SERVER_API_ERROR_ACCESS_DENIED == security_server_app_give_access(subject, getpid()));
- RUNNER_ASSERT(0 == smack_have_access(subject, object, "r"));
+ RUNNER_ASSERT_BT(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(ret == SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT_BT(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(ret != SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT_BT(ret != SECURITY_SERVER_API_SUCCESS);
}
RUNNER_CHILD_TEST_SMACK(tc03_check_API_passwd_allow)
attempt = max_attempt = expire_sec = 0;
ret = clear_password(&str);
- RUNNER_ASSERT_MSG(ret == 0, "ret: " << str);
+ RUNNER_ASSERT_MSG_BT(ret == 0, "ret: " << str);
SecurityServer::AccessProvider provider(TEST03_SUBJECT);
provider.allowAPI(API_PASSWD_CHECK, API_RULE_REQUIRED, TRACE_FROM_HERE);
provider.applyAndSwithToUser(APP_UID, APP_GID, TRACE_FROM_HERE);
ret = security_server_set_pwd_validity(10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret: " << ret);
ret = security_server_set_pwd_max_challenge(5);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret: " << ret);
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret: " << ret);
sleep(1);
ret = security_server_set_pwd(NULL, "12345", 0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
sleep(1);
ret = security_server_reset_pwd("12345",0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
sleep(1);
ret = security_server_chk_pwd("12345", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
sleep(1);
ret = security_server_set_pwd_history(10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
}
RUNNER_CHILD_TEST(tc04_check_API_passwd_denied)
*/
ret = security_server_set_pwd_validity(10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
ret = security_server_set_pwd_max_challenge(5);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
sleep(1);
ret = security_server_set_pwd("12345", "12346", 0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
sleep(1);
ret = security_server_reset_pwd("12346",0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
sleep(1);
ret = security_server_chk_pwd("12346", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
sleep(1);
ret = security_server_set_pwd_history(10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
}
RUNNER_CHILD_TEST_SMACK(tc05_check_API_middleware_allow)
provider.applyAndSwithToUser(APP_UID, APP_GID, TRACE_FROM_HERE);
ret = security_server_request_cookie(cookie, cookie_size);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
ret = security_server_get_gid(PROC_AUDIO_GROUP_NAME);
ret = security_server_check_privilege(cookie, ret);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
ret = security_server_get_gid("root");
- RUNNER_ASSERT_MSG(ret > -1, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret > -1, "ret: " << ret);
ret = security_server_get_cookie_pid(cookie);
- RUNNER_ASSERT_MSG(ret == getpid(), "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == getpid(), "ret: " << ret);
ss_label = security_server_get_smacklabel_cookie(cookie);
- RUNNER_ASSERT_MSG(ss_label != NULL, "ret: " << ss_label);
+ RUNNER_ASSERT_MSG_BT(ss_label != NULL, "ret: " << ss_label);
ret = security_server_check_privilege_by_pid(getpid(), "_", "rx");
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
}
RUNNER_CHILD_TEST(tc06_check_API_middleware_denied)
provider.applyAndSwithToUser(APP_UID, APP_GID, TRACE_FROM_HERE);
ret = security_server_request_cookie(cookie, cookie_size);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
ret = security_server_check_privilege(cookie, DB_ALARM_GID);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
ret = security_server_get_gid("root");
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
ret = security_server_get_cookie_pid(cookie);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
ss_label = security_server_get_smacklabel_cookie(cookie);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
ret = security_server_check_privilege_by_pid(getpid(), "_", "rx");
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
}
RUNNER_CHILD_TEST_SMACK(tc07_check_API_data_share_allow)
provider.applyAndSwithToUser(APP_UID, APP_GID, TRACE_FROM_HERE);
int ret = security_server_app_give_access(TEST07_SUBJECT, getpid());
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
}
RUNNER_CHILD_TEST_SMACK(tc08_check_API_data_share_denied)
provider.applyAndSwithToUser(APP_UID, APP_GID, TRACE_FROM_HERE);
int ret = security_server_app_give_access(TEST08_SUBJECT, getpid());
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
}
RUNNER_CHILD_TEST(tc09_check_API_app_enable_permissions)
// need to install WGT once again, in case it was removed before
DB_BEGIN
ret = perm_app_uninstall(WGT_APP_ID);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS, "Cannot uninstall WGT_APP_ID, ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS, "Cannot uninstall WGT_APP_ID, ret: " << ret);
ret = perm_app_install(WGT_APP_ID);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS, "Cannot install WGT_APP_ID, ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS, "Cannot install WGT_APP_ID, ret: " << ret);
DB_END
// enable permission
ret = security_server_app_enable_permissions(WGT_APP_ID, APP_TYPE_WGT, perm_list, persistent);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
SecurityServer::AccessProvider provider(TEST09_SUBJECT);
provider.allowFunction("security_server_app_has_privilege", TRACE_FROM_HERE);
// need to install WGT once again, in case it was removed before
DB_BEGIN
ret = perm_app_uninstall(WGT_APP_ID);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS, "Cannot uninstall WGT_APP_ID, ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS, "Cannot uninstall WGT_APP_ID, ret: " << ret);
ret = perm_app_install(WGT_APP_ID);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS, "Cannot install WGT_APP_ID, ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS, "Cannot install WGT_APP_ID, ret: " << ret);
DB_END
// disable permission
ret = security_server_app_disable_permissions(WGT_APP_ID, APP_TYPE_WGT, perm_list);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
SecurityServer::AccessProvider provider(TEST10_SUBJECT);
provider.allowFunction("security_server_app_has_privilege", TRACE_FROM_HERE);
NULL};
DB_BEGIN
ret = perm_app_uninstall(TEST11_SUBJECT);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS, "Cannot uninstall TEST11_SUBJECT, ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS, "Cannot uninstall TEST11_SUBJECT, ret: " << ret);
ret = perm_app_install(TEST11_SUBJECT);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS, "Cannot install TEST11_SUBJECT, ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS, "Cannot install TEST11_SUBJECT, ret: " << ret);
DB_END
// enable permission
ret = security_server_app_enable_permissions(TEST11_SUBJECT, APP_TYPE_WGT, perm_list_pers, 1);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
ret = security_server_app_enable_permissions(TEST11_SUBJECT, APP_TYPE_WGT, perm_list_temp, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
// Check if permissions are given using API with app_label parameter
check_app_has_privilege(TEST11_SUBJECT, APP_TYPE_WGT, perm_list_pers, true);
DB_BEGIN
ret = perm_app_uninstall(TEST11_SUBJECT);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS, "Cannot uninstall TEST11_SUBJECT, ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS, "Cannot uninstall TEST11_SUBJECT, ret: " << ret);
ret = perm_app_install(TEST11_SUBJECT);
- RUNNER_ASSERT_MSG(ret == PC_OPERATION_SUCCESS, "Cannot install TEST11_SUBJECT, ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == PC_OPERATION_SUCCESS, "Cannot install TEST11_SUBJECT, ret: " << ret);
DB_END
// enable permission
ret = security_server_app_enable_permissions(TEST11_SUBJECT, APP_TYPE_WGT, perm_list_pers, 1);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
ret = security_server_app_enable_permissions(TEST11_SUBJECT, APP_TYPE_WGT, perm_list_temp, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
SecurityServer::AccessProvider provider(TEST11_SUBJECT);
provider.allowFunction("security_server_app_caller_has_privilege", TRACE_FROM_HERE);
// set smack label without previously assigned permissions to api socket
ret = smack_set_label_for_self(TEST12_SUBJECT);
- RUNNER_ASSERT_MSG(ret == 0, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == 0, "ret: " << ret);
// drop root privileges
- RUNNER_ASSERT_MSG(drop_root_privileges() == 0, "uid = " << getuid());
+ RUNNER_ASSERT_MSG_BT(drop_root_privileges() == 0, "uid = " << getuid());
// call common function to perform the check
check_app_caller_has_privilege_denied(APP_TYPE_WGT, perm_list);
int result = 0;
result = drop_root_privileges();
- RUNNER_ASSERT_MSG(result == 0,
+ RUNNER_ASSERT_MSG_BT(result == 0,
"Failed to drop root privileges. Result: " << result << "uid = " << getuid());
result = security_server_app_give_access(subject, getpid());
- RUNNER_ASSERT_MSG(result == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(result == SECURITY_SERVER_API_SUCCESS,
"Error in security_server_app_give_access. Result: " << result);
result = smack_have_access(subject, object, "rwxat");
- RUNNER_ASSERT_MSG(result == -1,
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD,
"is_pwd_faild should return no password error. Result: " << ret);
- 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.");
+ 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.");
sleep(1);
// drop root privileges
ret = drop_root_privileges();
- RUNNER_ASSERT_MSG(ret == 0,
+ RUNNER_ASSERT_MSG_BT(ret == 0,
"Failed to drop root privileges. Result: " << ret << "uid = " << getuid());
ret = security_server_set_pwd_validity(10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD,
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD,
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD,
"is_pwd_valid should return no password error. Result: " << ret);
sleep(1);
ret = security_server_set_pwd(NULL, "12345", 0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
"set_pwd failed. Result: " << ret);
sleep(1);
ret = security_server_reset_pwd("12345",0, 0);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
"reset_pwd failed. Result: " << ret);
sleep(1);
ret = security_server_chk_pwd("12345", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
"chk_pwd failed. Result: " << ret);
sleep(1);
ret = security_server_set_pwd_history(10);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
"set_pwd_history failed. Result: " << ret);
}
// drop root privileges
ret = drop_root_privileges();
- RUNNER_ASSERT_MSG(ret == 0,
+ RUNNER_ASSERT_MSG_BT(ret == 0,
"Failed to drop root privileges. Result: " << ret << "uid = " << getuid());
ret = security_server_request_cookie(cookie, cookie_size);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
"request_cookie failed. Result: " << ret);
ret = security_server_get_gid(PROC_AUDIO_GROUP_NAME);
- RUNNER_ASSERT_MSG(ret > -1, "Failed to get \"" << PROC_AUDIO_GROUP_NAME << "\" gid. Result: "
+ RUNNER_ASSERT_MSG_BT(ret > -1, "Failed to get \"" << PROC_AUDIO_GROUP_NAME << "\" gid. Result: "
<< ret);
ret = security_server_check_privilege(cookie, ret);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
"check_privilege failed. Result: " << ret);
ret = security_server_get_gid("root");
- RUNNER_ASSERT_MSG(ret > -1,
+ RUNNER_ASSERT_MSG_BT(ret > -1,
"Failed to get \"root\" gid. Result: " << ret);
ret = security_server_get_cookie_pid(cookie);
- RUNNER_ASSERT_MSG(ret == getpid(),
+ RUNNER_ASSERT_MSG_BT(ret == getpid(),
"get_cookie_pid returned different pid than it should. Result: " << ret);
ss_label = security_server_get_smacklabel_cookie(cookie);
- RUNNER_ASSERT_MSG(ss_label != NULL, "get_smacklabel_cookie failed.");
+ RUNNER_ASSERT_MSG_BT(ss_label != NULL, "get_smacklabel_cookie failed.");
ret = security_server_check_privilege_by_pid(getpid(), "_", "rx");
if(ret != SECURITY_SERVER_API_SUCCESS) {
free(ss_label);
- RUNNER_ASSERT_MSG(false, "check_privilege_by_pid failed. Result: " << ret);
+ RUNNER_ASSERT_MSG_BT(false, "check_privilege_by_pid failed. Result: " << ret);
}
}
// drop root privileges
ret = drop_root_privileges();
- RUNNER_ASSERT_MSG(ret == 0,
+ RUNNER_ASSERT_MSG_BT(ret == 0,
"Failed to drop root privileges. Result: " << ret << "uid = " << getuid());
ret = security_server_app_give_access(TEST07_SUBJECT, getpid());
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
"app_give_access failed. Result: " << ret);
}
/* normal param case */
ret = security_server_get_gid("tel_sim");
- RUNNER_ASSERT_MSG(ret > -1, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret > -1, "ret: " << ret);
/* wrong param case */
ret = security_server_get_gid("elephony_akecall");
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_SUCH_OBJECT, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_SUCH_OBJECT, "ret: " << ret);
/* weird param case */
ret = security_server_get_gid(weird);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_SUCH_OBJECT, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_NO_SUCH_OBJECT, "ret: " << ret);
/* null param case */
ret = security_server_get_gid(NULL);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
/* param too long case */
ret = security_server_get_gid("abcdefghijklmnopqrstuvwxyz01234");
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
/* empty param case */
ret = security_server_get_gid("");
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_BUFFER_TOO_SMALL, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
char cookie2[cookie_size];
ret = security_server_request_cookie(cookie2, cookie_size);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
/* big gid case */
gid = 70666;
ret = security_server_check_privilege(cookie2, gid);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS, "ret: " << ret);
ret = security_server_check_privilege_by_cookie(cookie2, object2, access_rights);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret: " << ret);
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM);
+ RUNNER_ASSERT_BT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM);
}
///////////////////////////
//invalid sockfd case
ret = security_server_check_privilege_by_sockfd(sockfd, object, access_rights);
- RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(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(ret == SECURITY_SERVER_API_SUCCESS,
+ RUNNER_ASSERT_MSG_BT(ret == SECURITY_SERVER_API_SUCCESS,
"check_privilege_by_sockfd failed. Result: " << ret);
}