bootctl: switch a few getenv() calls to secure_getenv()

Following the rule that we should always prefer the secure flavour over
the regular one unless there's a clear reason for the regular one, let's
switch this over. Better safe than sorry.
This commit is contained in:
Lennart Poettering
2025-09-20 00:47:46 +09:00
committed by Yu Watanabe
parent 6aaff2d532
commit 5c396a0110
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -102,7 +102,7 @@ static int load_kernel_install_layout(void) {
int r;
r = load_kernel_install_conf(arg_root,
getenv("KERNEL_INSTALL_CONF_ROOT"),
secure_getenv("KERNEL_INSTALL_CONF_ROOT"),
/* ret_machine_id= */ NULL,
/* ret_boot_root= */ NULL,
&layout,
@@ -578,7 +578,7 @@ static int install_entry_token(void) {
if (!arg_make_entry_directory && arg_entry_token_type == BOOT_ENTRY_TOKEN_MACHINE_ID)
return 0;
p = path_join(arg_root, getenv("KERNEL_INSTALL_CONF_ROOT") ?: "/etc/kernel/", "entry-token");
p = path_join(arg_root, secure_getenv("KERNEL_INSTALL_CONF_ROOT") ?: "/etc/kernel/", "entry-token");
if (!p)
return log_oom();
+1 -1
View File
@@ -61,7 +61,7 @@ static int set_system_token(void) {
if (!touch_variables())
return 0;
r = getenv_bool("SYSTEMD_WRITE_SYSTEM_TOKEN");
r = secure_getenv_bool("SYSTEMD_WRITE_SYSTEM_TOKEN");
if (r < 0) {
if (r != -ENXIO)
log_warning_errno(r, "Failed to parse $SYSTEMD_WRITE_SYSTEM_TOKEN, ignoring.");
+1 -1
View File
@@ -124,7 +124,7 @@ int settle_entry_token(void) {
r = boot_entry_token_ensure(
arg_root,
getenv("KERNEL_INSTALL_CONF_ROOT"),
secure_getenv("KERNEL_INSTALL_CONF_ROOT"),
arg_machine_id,
/* machine_id_is_random = */ false,
&arg_entry_token_type,