manager: allow add-and-activate option "bind" with non-volatile profiles

For one, there was a bug here: we cannot "goto error" without setting
the @error variable.

Anyway, restricting "bind" "dbus-client" only to profiles that are
"persist" mode "volatile" seems wrong. The "bind" option as it is,
limits the lifetime of the active-connection. This has no direct relation
with the lifetime of the setting-connection. Indeed, if the
settings-connection's lifetime is itself set to "volatile", then
it will indeed go away with the active-connection. However, these
two concepts are not strictly related.

In the future, we might add an option to limite the lifetime of
a settings-connection to a D-Bus client ("bind-setting"). Possibly
we should thus rename "bind" to "bind-activation", to make the
distinction clearer.
This commit is contained in:
Thomas Haller 2018-11-18 11:48:44 +01:00
parent f10f019982
commit 6f28f4b661
2 changed files with 2 additions and 6 deletions

View file

@ -129,7 +129,7 @@
parameters. At this time the following options are supported:
* persist: A string value of either "disk" (default), "memory" or "volatile". If "memory" is passed, the connection will not be saved to disk. If "volatile" is passed, the connection will not be saved to disk and will be destroyed when disconnected.
* bind: Bind the connections lifetime. Set to "dbus-name" to automatically disconnect when the requesting process disappears from the bus. The default of "none" means the connection is kept alive normally. If restricted, then persist must be set to "volatile".
* bind: Bind the activation lifetime. Set to "dbus-name" to automatically disconnect when the requesting process disappears from the bus. The default of "none" means the connection is kept activated normally.
-->
<method name="AddAndActivateConnection2">
<arg name="connection" type="a{sa{sv}}" direction="in"/>

View file

@ -5364,12 +5364,8 @@ impl_manager_add_and_activate_connection (NMDBusObject *obj,
if (!active)
goto error;
if (g_strcmp0 (bind_lifetime, "dbus-client") == 0) {
if (persist != NM_SETTINGS_CONNECTION_PERSIST_MODE_VOLATILE_ONLY)
goto error;
if (g_strcmp0 (bind_lifetime, "dbus-client") == 0)
nm_active_connection_bind_dbus_client (active, dbus_connection, sender);
}
nm_active_connection_authorize (active,
incompl_conn,