From 4621a9a8a46a4a846e32b324e3a84fed8faad59b Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Mon, 13 Mar 2023 21:44:31 +0100 Subject: [PATCH] WIP: manager: check device path on AddAndActivate validate_activation_request() just acts as if a no device was passed if nm_manager_get_device_by_path() can't resolve the path into a NMDevice. That means a bogus path name is silently ignored. TODO: Check if that's indeed the case --- src/core/nm-manager.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/core/nm-manager.c b/src/core/nm-manager.c index b65966cc9a..4eb9e16798 100644 --- a/src/core/nm-manager.c +++ b/src/core/nm-manager.c @@ -6584,6 +6584,17 @@ impl_manager_add_and_activate_connection(NMDBusObject *obj, specific_object_path = nm_dbus_path_not_empty(specific_object_path); device_path = nm_dbus_path_not_empty(device_path); + if (device_path) { + device = nm_manager_get_device_by_path(self, device_path); + if (!device) { + error = g_error_new(NM_MANAGER_ERROR, + NM_MANAGER_ERROR_UNKNOWN_DEVICE, + "Device does not exist: %s", + device_path); + goto error; + } + } + /* Try to create a new connection with the given settings. * We allow empty settings for AddAndActivateConnection(). In that case, * the connection will be completed in nm_utils_complete_generic() or