GNOME Bugzilla – Bug 761714
[RFE] make changes to applied connection (Reapply) atomic
Last modified: 2016-02-16 10:35:28 UTC
Reapply() (bug 697370) and GetAppliedConnection() (bug 760884) should expose an ~transaction id~ and reject reapply if the id changed in the meantime.
Branch on review. See bug 760884
> core: add transaction-id to NMActiveConnection I find that version_id would be a more appropriate name, since it's a value that identifies a given version of the object, even if no transaction has happened (for example, for new constructed objects). But no strong opinion about this. Also, can you shortly explain in the commit message what is the purpose of this new field? > all: add transaction-id to device's Reapply method /** * nm_device_reapply_async: * @device: a #NMDevice * @connection: the #NMConnection to replace the applied settings with or %NULL to reuse existing + * @transaction_id: zero or a the current transaction id of the applied connection s/or a the/or the/ (the same also in nm_device_reapply()) > core: add NMDevice's GetAppliedConnection D-Bus call + <tp:docstring> + The currently applied connection on the device. This is a snapshot of the last activated s/The currently/Get the currently/ +static void +impl_device_get_appied_connection (NMDevice *self, + GDBusMethodInvocation *context) s/appied/applied/ +{ + g_return_if_fail (NM_IS_DEVICE (self)); + + /* Ask the manager to authenticate this request for us */ + g_signal_emit (self, signals[AUTH_REQUEST], 0, + context, + nm_device_get_applied_connection (self), + NM_AUTH_PERMISSION_NETWORK_CONTROL, Is there any reason why getting the current applied settings requires some permissions? Probably this should be available to everyone...
(In reply to Beniamino Galvani from comment #2) > + /* Ask the manager to authenticate this request for us */ > + g_signal_emit (self, signals[AUTH_REQUEST], 0, > + context, > + nm_device_get_applied_connection (self), > + NM_AUTH_PERMISSION_NETWORK_CONTROL, > > Is there any reason why getting the current applied settings requires > some permissions? Probably this should be available to everyone... maybe. But AUTH_REQUEST signal handler in NMManager requires permissions to be requested and the argument cannot be omitted. So this would need some refactoring. The main use of this is to work together with Reapply(), so a user who can use Reapply() also has permissions for GetAppliedConnection(). Not sure what we want here, but for now to be more strict seems acceptable. Fixed the rest
merged as https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=a058cf41dc8dd6f952c4652ae689f3ed8ac042d6