From b8f736b30e20a2b44e7c34bb4e43b0d97ae77e3c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 15 Oct 2020 10:54:48 +0200 Subject: [PATCH 1/2] pager: lets check SYSTEMD_PAGERSECURE with secure_getenv() I can't think of any real vulnerability about this, but it still feels better to check a variable with "secure" in its name with secure_getenv() rather than plain getenv(). Paranoia FTW! --- src/shared/pager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/pager.c b/src/shared/pager.c index 9a14d44d69..9af7009b3f 100644 --- a/src/shared/pager.c +++ b/src/shared/pager.c @@ -171,7 +171,7 @@ int pager_open(PagerFlags flags) { * pager. If they didn't, use secure mode when under euid is changed. If $SYSTEMD_PAGERSECURE * wasn't explicitly set, and we autodetect the need for secure mode, only use the pager we * know to be good. */ - int use_secure_mode = getenv_bool("SYSTEMD_PAGERSECURE"); + int use_secure_mode = getenv_bool_secure("SYSTEMD_PAGERSECURE"); bool trust_pager = use_secure_mode >= 0; if (use_secure_mode == -ENXIO) { uid_t uid; From edfa55174bc542c88e92cdaeeb22ab8db1a79f1a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 15 Oct 2020 10:56:01 +0200 Subject: [PATCH 2/2] systemctl: fix tabs indentations --- src/systemctl/systemctl-set-environment.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/systemctl/systemctl-set-environment.c b/src/systemctl/systemctl-set-environment.c index ac1ec7d6fe..4d17c91df2 100644 --- a/src/systemctl/systemctl-set-environment.c +++ b/src/systemctl/systemctl-set-environment.c @@ -63,7 +63,7 @@ int show_environment(int argc, char *argv[], void *userdata) { static void invalid_callback(const char *p, void *userdata) { _cleanup_free_ char *t = cescape(p); - + log_debug("Ignoring invalid environment assignment \"%s\".", strnull(t)); } @@ -120,13 +120,13 @@ int import_environment(int argc, char *argv[], void *userdata) { if (argc < 2) { _cleanup_strv_free_ char **copy = NULL; - + copy = strv_copy(environ); if (!copy) return log_oom(); - + strv_env_clean_with_callback(copy, invalid_callback, NULL); - + r = sd_bus_message_append_strv(m, copy); } else {