manager: ensure device is exported on D-Bus in authentication request

Resolves: #2210271
This commit is contained in:
Fernando Fernandez Mancera 2023-08-23 17:15:11 +02:00
parent b9418b4e49
commit 02dc37f90a
2 changed files with 59 additions and 2 deletions

View File

@ -0,0 +1,54 @@
From 6302c2ea52c6c28d36b6006b29823c469e171e2a Mon Sep 17 00:00:00 2001
From: Wen Liang <liangwen12year@gmail.com>
Date: Thu, 3 Aug 2023 10:16:42 -0400
Subject: [PATCH] nm-manager: ensure device is exported on D-Bus in
authentication request
The device authentication request is an async process, it can not know
the answer right away, it is not guarantee that device is still
exported on D-Bus when authentication finishes. Thus, do not return
SUCCESS and abort the authentication request when device is not alive.
https://bugzilla.redhat.com/show_bug.cgi?id=2210271
(cherry picked from commit b341161e2a4988403ae4a6ef7653e01567da36a0)
(cherry picked from commit 0e27e84247ed824b27d105292d7bf42dc0341cbb)
---
src/core/nm-manager.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/core/nm-manager.c b/src/core/nm-manager.c
index 9c7212202b..937acbba1e 100644
--- a/src/core/nm-manager.c
+++ b/src/core/nm-manager.c
@@ -3222,6 +3222,13 @@ device_auth_done_cb(NMAuthChain *chain, GDBusMethodInvocation *context, gpointer
nm_assert(error || (result == NM_AUTH_CALL_RESULT_YES));
}
+ if (!error && !nm_dbus_object_is_exported(NM_DBUS_OBJECT(device))) {
+ g_set_error(&error,
+ NM_MANAGER_ERROR,
+ NM_MANAGER_ERROR_UNKNOWN_DEVICE,
+ "device no longer exists");
+ }
+
callback(device, context, subject, error, nm_auth_chain_get_data(chain, "user-data"));
}
@@ -3287,6 +3294,14 @@ nm_manager_device_auth_request(NMManager *self,
&error))
goto fail_on_idle;
+ if (!nm_dbus_object_is_exported(NM_DBUS_OBJECT(device))) {
+ g_set_error(&error,
+ NM_MANAGER_ERROR,
+ NM_MANAGER_ERROR_UNKNOWN_DEVICE,
+ "device no longer exists");
+ goto fail_on_idle;
+ }
+
chain = nm_auth_chain_new_subject(subject, context, device_auth_done_cb, self);
if (cancellable)
nm_auth_chain_set_cancellable(chain, cancellable);
--
2.41.0

View File

@ -3,7 +3,7 @@
%global ppp_version %(pkg-config --modversion pppd 2>/dev/null || sed -n 's/^#define\\s*VERSION\\s*"\\([^\\s]*\\)"$/\\1/p' %{_includedir}/pppd/patchlevel.h 2>/dev/null | grep . || echo bad) %global ppp_version %(pkg-config --modversion pppd 2>/dev/null || sed -n 's/^#define\\s*VERSION\\s*"\\([^\\s]*\\)"$/\\1/p' %{_includedir}/pppd/patchlevel.h 2>/dev/null | grep . || echo bad)
%global glib2_version %(pkg-config --modversion glib-2.0 2>/dev/null || echo bad) %global glib2_version %(pkg-config --modversion glib-2.0 2>/dev/null || echo bad)
%global epoch_version 1 %global epoch_version 2
%global real_version 1.44.0 %global real_version 1.44.0
%global rpm_version %{real_version} %global rpm_version %{real_version}
%global release_version 1 %global release_version 1
@ -202,7 +202,7 @@ Source7: readme-ifcfg-rh.txt
# Patch0001: 0001-some.patch # Patch0001: 0001-some.patch
# Bugfixes that are only relevant until next rebase of the package. # Bugfixes that are only relevant until next rebase of the package.
# Patch1001: 1001-some.patch Patch1001: 1001-nm-manager-ensure-device-is-exported-on-D-Bus-in-aut-rhbz2210271.patch
Requires(post): systemd Requires(post): systemd
%if 0%{?fedora} || 0%{?rhel} >= 8 %if 0%{?fedora} || 0%{?rhel} >= 8
@ -1252,6 +1252,9 @@ fi
%changelog %changelog
* Wed Aug 23 2023 Fernando Fernandez Mancera <ferferna@redhat.com> - 1:1.44.0-2
- manager: ensure device is exported on D-Bus in authentication request (rh #2210271)
* Thu Aug 10 2023 Fernando Fernandez Mancera <ferferna@redhat.com> - 1:1.44.0-1 * Thu Aug 10 2023 Fernando Fernandez Mancera <ferferna@redhat.com> - 1:1.44.0-1
- update to 1.44.0 release - update to 1.44.0 release
- nmcli: add nmcli version mismatch warning (rh #2173196) - nmcli: add nmcli version mismatch warning (rh #2173196)