diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2023-03-13 21:44:31 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2023-03-16 17:50:49 +0100 |
commit | 4621a9a8a46a4a846e32b324e3a84fed8faad59b (patch) | |
tree | 69d667d8d9df17312b6c52d2e8626363df6ee8f6 | |
parent | c92f9963c8e288591a79330137dbc914a11966cd (diff) | |
download | NetworkManager-4621a9a8a46a4a846e32b324e3a84fed8faad59b.tar.gz |
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
-rw-r--r-- | src/core/nm-manager.c | 11 |
1 files changed, 11 insertions, 0 deletions
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 |