dispatcher: tolerate lack of connection path

If the dispatcher is being invoked because the connection was removed
(e.g. device going down), it doesn't have a path or a filename anymore.
Don't abort in such cases.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/205
(cherry picked from commit 0c62445853)
This commit is contained in:
Lubomir Rintel 2019-07-15 17:30:09 +00:00
parent 23d244dee1
commit cbf5d13584

View file

@ -456,12 +456,8 @@ nm_dispatcher_utils_construct_envp (const char *action,
goto done;
/* Connection properties */
if (!g_variant_lookup (connection_props, NMD_CONNECTION_PROPS_PATH, "&o", &path)) {
*out_error_message = "Missing or invalid required value " NMD_CONNECTION_PROPS_PATH "!";
return NULL;
}
_items_add_key (items, NULL, "CONNECTION_DBUS_PATH", path);
if (g_variant_lookup (connection_props, NMD_CONNECTION_PROPS_PATH, "&o", &path))
_items_add_key (items, NULL, "CONNECTION_DBUS_PATH", path);
if (g_variant_lookup (connection_props, NMD_CONNECTION_PROPS_EXTERNAL, "b", &external) && external)
_items_add_str (items, "CONNECTION_EXTERNAL=1");