1. Overview
The SystemUser module provides system-account and encrypted-home discovery for BastionGuard Backup. It parses passwd records, distinguishes normal and system accounts, and detects eCryptfs home and private-directory layouts.
The implementation is written in Vala and uses GLib/GIO together with the application utility namespaces required by the file.
2. Dependencies and Integration
The module imports:
TeeJee.LoggingTeeJee.FileSystemTeeJee.ProcessHelper
Key runtime integrations include:
- Gee – typed lists, maps, queues, or collection operations
3. Declared Types
3.1 SystemUser
public class SystemUser : GLib.Object
This class encapsulates the state and operations described by this source file.
4. State, Properties, Constants, and Signals
Public and protected state
public string name– Name or identifier for name.public string password– In-memory credential; the source intentionally avoids serializing it.public int uid– Runtime state used by the module.public int gid– Runtime state used by the module.public string user_info– Runtime state used by the module.public string home_path– Filesystem-related value used for home path.public string shell_path– Filesystem-related value used for shell path.public string full_name– Name or identifier for full name.public string room_num– Runtime state used by the module.public string phone_work– Runtime state used by the module.public string phone_home– Runtime state used by the module.public string other_info– Runtime state used by the module.public bool has_encrypted_home– Boolean state controlling or reporting encrypted home.public bool has_encrypted_private_dirs– Boolean state controlling or reporting encrypted private dirs.public Gee.ArrayList<string> encrypted_dirs– Collection storing runtime data for this component.public Gee.ArrayList<string> encrypted_private_dirs– Collection storing runtime data for this component.public bool is_selected– UI selection state.public static Gee.HashMap<string,SystemUser> all_users– Collection storing runtime data for this component.public static Gee.ArrayList<SystemUser> all_users_sorted– Collection storing runtime data for this component.public bool is_system– Boolean state controlling or reporting system.public string group_names– Runtime state used by the module.
5. Public API and Operational Methods
5.1 SystemUser()
public SystemUser(string name)
Initializes the object state, allocates required collections or widgets, and applies constructor parameters.
5.2 query_users()
public static void query_users()
Queries users and refreshes the associated object state.
5.3 read_users_from_file()
public static Gee.HashMap<string,SystemUser> read_users_from_file(string passwd_file)
Reads passwd-compatible records, creates SystemUser objects, filters and enriches account metadata, and checks encrypted directory layouts.
- Performs filesystem access and handles files or directories through GLib or TeeJee helpers.
5.4 check_encrypted_dirs()
public void check_encrypted_dirs()
Implements the check encrypted dirs operation for this module.
- Performs filesystem access and handles files or directories through GLib or TeeJee helpers.
6. Internal Helpers
6.1 parse_line_passwd()
private static SystemUser? parse_line_passwd(string line)
Parses line passwd and updates structured runtime data.
7. Filesystem Paths and Resource Locations
The source references the following absolute or template paths:
/etc/passwd
/home/.ecryptfs/%s/.ecryptfs/Private.mnt
Some values are templates completed at runtime with application names, process IDs, device identifiers, or file names.
8. Operational Flow
- Read or discover source data and normalize it into the module data model.
- Transform raw values, command output, or metadata into structured or display-ready form.
9. Error Handling and Diagnostics
- The TeeJee logging layer records errors, debug state, generated commands, and operational messages.
- Boolean, nullable, or empty-string return values communicate recoverable failures to callers.
10. Runtime and Security Considerations
- Dynamic command construction: caller-controlled values must be validated and escaped before being inserted into shell commands.
- Sensitive data: credentials and passphrases should not be logged or persisted without protected storage and restrictive permissions.
- Linux-specific paths: the module depends on Linux virtual filesystems or privileged system directories.
- Shared state: static caches and global switches are shared by all callers and are not automatically thread-isolated.
11. Licensing
The source is distributed under the GNU General Public License version 2 or any later version.
The source header identifies:
Copyright 2012-2018 Tony George <teejeetech@gmail.com>
