priv-helper: fix D-Bus patch to not contain forbidden character '-'

"-" is not allowed as D-Bus path and interface name, and discouraged as
bus name. This cause nm-priv-helper to crash, because GDBus asserts the
the object path is valid.

Replace the '-' with '_'. This way, it's consistent with
"nm_dispatcher".

Fixes: d68ab6b8f0 ('nm-sudo: rename to nm-priv-helper')
This commit is contained in:
Thomas Haller
2022-02-08 16:43:22 +01:00
parent 3b67b7768d
commit 16a45d07ed
9 changed files with 22 additions and 21 deletions

3
.gitignore vendored
View File

@@ -72,7 +72,7 @@ test-*.trs
/src/nm-dispatcher/tests/test-dispatcher-envp /src/nm-dispatcher/tests/test-dispatcher-envp
/src/nm-priv-helper/nm-priv-helper /src/nm-priv-helper/nm-priv-helper
/src/nm-priv-helper/org.freedesktop.nm-priv-helper.service /src/nm-priv-helper/org.freedesktop.nm_priv_helper.service
/data/NetworkManager.service /data/NetworkManager.service
/data/NetworkManager-wait-online.service /data/NetworkManager-wait-online.service
@@ -437,6 +437,7 @@ test-*.trs
/src/ndisc/tests/test-ndisc-linux /src/ndisc/tests/test-ndisc-linux
/src/nm-daemon-helper/nm-daemon-helper /src/nm-daemon-helper/nm-daemon-helper
/src/nm-iface-helper /src/nm-iface-helper
/src/nm-priv-helper/org.freedesktop.nm-priv-helper.service
/src/nm-sudo/nm-sudo /src/nm-sudo/nm-sudo
/src/nm-sudo/org.freedesktop.nm.sudo.service /src/nm-sudo/org.freedesktop.nm.sudo.service
/src/platform/tests/dump /src/platform/tests/dump

View File

@@ -4595,19 +4595,19 @@ src_nm_priv_helper_nm_priv_helper_LDADD = \
$(GLIB_LIBS) \ $(GLIB_LIBS) \
$(NULL) $(NULL)
src/nm-priv-helper/org.freedesktop.nm-priv-helper.service: $(srcdir)/src/nm-priv-helper/org.freedesktop.nm-priv-helper.service.in src/nm-priv-helper/org.freedesktop.nm_priv_helper.service: $(srcdir)/src/nm-priv-helper/org.freedesktop.nm_priv_helper.service.in
@sed \ @sed \
-e 's|@libexecdir[@]|$(libexecdir)|g' \ -e 's|@libexecdir[@]|$(libexecdir)|g' \
$< >$@ $< >$@
dbusactivation_DATA += src/nm-priv-helper/org.freedesktop.nm-priv-helper.service dbusactivation_DATA += src/nm-priv-helper/org.freedesktop.nm_priv_helper.service
CLEANFILES += src/nm-priv-helper/org.freedesktop.nm-priv-helper.service CLEANFILES += src/nm-priv-helper/org.freedesktop.nm_priv_helper.service
dbusservice_DATA += src/nm-priv-helper/nm-priv-helper.conf dbusservice_DATA += src/nm-priv-helper/nm-priv-helper.conf
EXTRA_DIST += \ EXTRA_DIST += \
src/nm-priv-helper/nm-priv-helper.conf \ src/nm-priv-helper/nm-priv-helper.conf \
src/nm-priv-helper/org.freedesktop.nm-priv-helper.service.in \ src/nm-priv-helper/org.freedesktop.nm_priv_helper.service.in \
src/nm-priv-helper/meson.build \ src/nm-priv-helper/meson.build \
$(NULL) $(NULL)

View File

@@ -1047,7 +1047,7 @@ fi
%dir %{_localstatedir}/lib/NetworkManager %dir %{_localstatedir}/lib/NetworkManager
%dir %{_sysconfdir}/sysconfig/network-scripts %dir %{_sysconfdir}/sysconfig/network-scripts
%{_datadir}/dbus-1/system-services/org.freedesktop.nm_dispatcher.service %{_datadir}/dbus-1/system-services/org.freedesktop.nm_dispatcher.service
%{_datadir}/dbus-1/system-services/org.freedesktop.nm-priv-helper.service %{_datadir}/dbus-1/system-services/org.freedesktop.nm_priv_helper.service
%{_datadir}/polkit-1/actions/*.policy %{_datadir}/polkit-1/actions/*.policy
%{_prefix}/lib/udev/rules.d/*.rules %{_prefix}/lib/udev/rules.d/*.rules
%if %{with firewalld_zone} %if %{with firewalld_zone}

View File

@@ -18,7 +18,7 @@ Description=NetworkManager Privileged Helper
[Service] [Service]
Type=dbus Type=dbus
BusName=org.freedesktop.nm-priv-helper BusName=org.freedesktop.nm_priv_helper
ExecStart=@libexecdir@/nm-priv-helper ExecStart=@libexecdir@/nm-priv-helper
NotifyAccess=main NotifyAccess=main
@@ -76,4 +76,4 @@ SystemCallFilter=@resources
[Install] [Install]
Alias=dbus-org.freedesktop.nm-priv-helper.service Alias=dbus-org.freedesktop.nm_priv_helper.service

View File

@@ -5,9 +5,9 @@
/*****************************************************************************/ /*****************************************************************************/
#define NM_PRIV_HELPER_DBUS_BUS_NAME "org.freedesktop.nm-priv-helper" #define NM_PRIV_HELPER_DBUS_BUS_NAME "org.freedesktop.nm_priv_helper"
#define NM_PRIV_HELPER_DBUS_OBJECT_PATH "/org/freedesktop/nm-priv-helper" #define NM_PRIV_HELPER_DBUS_OBJECT_PATH "/org/freedesktop/nm_priv_helper"
#define NM_PRIV_HELPER_DBUS_IFACE_NAME "org.freedesktop.nm-priv-helper" #define NM_PRIV_HELPER_DBUS_IFACE_NAME "org.freedesktop.nm_priv_helper"
/*****************************************************************************/ /*****************************************************************************/

View File

@@ -1,7 +1,7 @@
# SPDX-License-Identifier: LGPL-2.1-or-later # SPDX-License-Identifier: LGPL-2.1-or-later
configure_file( configure_file(
input: 'org.freedesktop.nm-priv-helper.service.in', input: 'org.freedesktop.nm_priv_helper.service.in',
output: '@BASENAME@', output: '@BASENAME@',
install_dir: dbus_system_bus_services_dir, install_dir: dbus_system_bus_services_dir,
configuration: data_conf, configuration: data_conf,

View File

@@ -3,11 +3,11 @@
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig> <busconfig>
<policy user="root"> <policy user="root">
<allow own="org.freedesktop.nm.priv-helper"/> <allow own="org.freedesktop.nm_priv_helper"/>
<allow send_destination="org.freedesktop.nm.priv-helper"/> <allow send_destination="org.freedesktop.nm_priv_helper"/>
</policy> </policy>
<policy context="default"> <policy context="default">
<deny own="org.freedesktop.nm.priv-helper"/> <deny own="org.freedesktop.nm_priv_helper"/>
<deny send_destination="org.freedesktop.nm.priv-helper"/> <deny send_destination="org.freedesktop.nm_priv_helper"/>
</policy> </policy>
</busconfig> </busconfig>

View File

@@ -1,5 +0,0 @@
[D-BUS Service]
Name=org.freedesktop.nm-priv-helper
Exec=@libexecdir@/nm-priv-helper
User=root
SystemdService=dbus-org.freedesktop.nm-priv-helper.service

View File

@@ -0,0 +1,5 @@
[D-BUS Service]
Name=org.freedesktop.nm_priv_helper
Exec=@libexecdir@/nm-priv-helper
User=root
SystemdService=dbus-org.freedesktop.nm_priv_helper.service