Skip to content
API Documentation
BastionGuard™
UnlockSession Struct Reference

#include <encryption_support.hpp>

Public Member Functions

void cleanup (std::vector< std::string > &logs)

Public Attributes

std::string container_type
std::string source_path
uint64_t source_offset {0}
std::string mapped_path
std::string loop_path
std::string mapper_name
std::string helper_mount_dir
std::string helper_loop_path
bool uses_dislocker {false}

Detailed Description

Definition at line 9 of file encryption_support.hpp.

Member Function Documentation

◆ cleanup()

void UnlockSession::cleanup ( std::vector< std::string > & logs)

Definition at line 393 of file encryption_support.cpp.

393 {
394 if (!mapper_name.empty() && container_type == "LUKS" && command_exists("cryptsetup")) {
395 const std::string cmd = "cryptsetup close " + shell_quote(mapper_name) + " >/dev/null 2>&1";
396 std::system(cmd.c_str());
397 logs.push_back(trs("Closed mapper:") + std::string(" ") + mapper_name);
398 }
399 if (!helper_loop_path.empty() && command_exists("losetup")) {
400 const std::string cmd = "losetup -d " + shell_quote(helper_loop_path) + " >/dev/null 2>&1";
401 std::system(cmd.c_str());
402 logs.push_back(trs("Detached helper loop device:") + std::string(" ") + helper_loop_path);
403 }
404 if (!loop_path.empty() && command_exists("losetup")) {
405 const std::string cmd = "losetup -d " + shell_quote(loop_path) + " >/dev/null 2>&1";
406 std::system(cmd.c_str());
407 logs.push_back(trs("Detached loop device:") + std::string(" ") + loop_path);
408 }
409 if (!helper_mount_dir.empty()) {
410 std::error_code ec;
411 fs::remove_all(helper_mount_dir, ec);
412 if (!ec) logs.push_back(trs("Removed helper directory:") + std::string(" ") + helper_mount_dir);
413 }
414 mapped_path.clear();
415 loop_path.clear();
416 mapper_name.clear();
417 helper_mount_dir.clear();
418 helper_loop_path.clear();
419 uses_dislocker = false;
420}
std::string trs(const char *msgid)
Definition i18n.cpp:22
std::string shell_quote(const std::string &argument)
std::string mapped_path
std::string helper_loop_path
std::string container_type
std::string helper_mount_dir
std::string mapper_name

References container_type, helper_loop_path, helper_mount_dir, loop_path, mapped_path, mapper_name, trs(), and uses_dislocker.

Member Data Documentation

◆ container_type

◆ helper_loop_path

std::string UnlockSession::helper_loop_path

◆ helper_mount_dir

std::string UnlockSession::helper_mount_dir

◆ loop_path

◆ mapped_path

◆ mapper_name

◆ source_offset

◆ source_path

◆ uses_dislocker

bool UnlockSession::uses_dislocker {false}

The documentation for this struct was generated from the following files: