Skip to content

[th/libnm-no-connection-clear-secrets] libnm: don't clear secrets during NMSimpleConnection:dispose()

Thomas Haller requested to merge th/libnm-no-connection-clear-secrets into main

NMConnection is an interface, implemented by NMSimpleConnection and NMRemoteConnection. A connection is basically a set of NMSetting instances.

Usually you would expect that one NMSetting instance only gets added to zero or one NMConnection. It seems a bit ugly, to have one setting tracked by multiple NMConnection. Still, technically I am not aware of a single problem with doing that, where it not for NMSimpleConnection:dispose() to clear the secrets.

There is no need to clear the secrets of an NMSetting, when the NMConnection gets destroyed. Either this destroys the NMSetting instance right away (and NMSetting's destructor will clear the secrets anyway), or somebody else (e.g. another NMConnection instance), keeps the setting alive. In the latter case, it is wrong to clear the secrets at this point.

This was done since commit 6a19e68a ('libnm-core: clear secrets from NMSimpleConnection and NMSettingsConnection dispose()'), but let's stop doing that.

This also causes problems in practice, see [1].

[1] https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1099#note_1334333

#876 (closed)

Merge request reports

Loading