nss: only read logging config from environment variables
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 11 Jan 2022 12:36:39 +0000 (13:36 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 13 Jan 2022 10:26:40 +0000 (11:26 +0100)
commitd11093fd313c63bcbc23ee561759025eff87ac69
treedaed1a61cf2936aa9184879b52519ba2ed48cb45
parenta972215efa775871ccaeedc6dfba60e7a3e782e0
nss: only read logging config from environment variables

log_parse_environment() uses should_parse_proc_cmdline() to determine whether
it should parse settings from the kernel command line. But the checks that
should_parse_proc_cmdline() apply to the whole process, and we could get a positive
answer also when log_parse_environment() was called from one of the nss modules.
In case of nss-modules, we don't want to look at the kernel command line.

log_parse_environment_variables() that only looks at the environment variables
is split out and used in the nss modules.

Fixes #22020.

(cherry picked from commit a7d15a24659770b0fa9f4cd26fc7bbb17765cbb7)
(cherry picked from commit 9e29d13926b62c10d931d287b30b7874872bfe39)
src/basic/log.c
src/basic/log.h
src/nss-mymachines/nss-mymachines.c
src/nss-resolve/nss-resolve.c
src/nss-systemd/nss-systemd.c