systemctl: gracefully adjust bus transport and runtime scope when --boot-loader-entry...
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 4 Aug 2024 05:09:53 +0000 (14:09 +0900)
committerLuca Boccassi <bluca@debian.org>
Thu, 15 Aug 2024 13:04:41 +0000 (14:04 +0100)
commitb50419e83856566564d27b8a0b69459617609dac
tree83fffc1d50dff6e6217f6fd0eef8b6f758e3d4c1
parent74f830e048beab8b48c4a25dcb8666a861981aec
systemctl: gracefully adjust bus transport and runtime scope when --boot-loader-entry=help

This fixes the following assertion:
===
SYSTEMD_LOG_LEVEL=debug systemctl --user -H foo --boot-loader-entry=help
Assertion 'transport != BUS_TRANSPORT_REMOTE || runtime_scope == RUNTIME_SCOPE_SYSTEM' failed at src/shared/bus-util.c:284, function bus_connect_transport(). Ignoring.
Failed to connect to bus: Operation not supported
===

Fixes a bug introduced by 97af80c5a7029c3f92e982dcf9338b9e67ad9cde.
Fixes #33661.
Fixes oss-fuzz#70153.

(cherry picked from commit 1056457d1132e78cbf914e8abfa661465b952412)
src/systemctl/systemctl-logind.c
test/fuzz/fuzz-systemctl-parse-argv/oss-fuzz-70153 [new file with mode: 0644]