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
This commit is contained in:
Lubomir Rintel 2023-03-13 21:44:31 +01:00
parent c92f9963c8
commit 4621a9a8a4

View file

@ -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