From 38f7ceafbaf74bad3f4c990da3120eb67d9dd4de Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 16 Nov 2022 13:13:53 +0100 Subject: c-e: workaround crash in required error for import nm-vpnc crashes when passing no error argument, see [1]. Try with VPNC plugin installed: ./src/connection-editor/nm-connection-editor -i /some/invalid/file Workaround that. Also, libnm is going to work around that too ([2)]. But the bug should be fixed also for older libnm/plugin versions. [1] https://gitlab.gnome.org/GNOME/NetworkManager-vpnc/-/blob/c7d197477c94c5bae0396f0ef826db4d835e487d/properties/nm-vpnc-editor-plugin.c#L281 [2] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/commit/3b2eb689f3da1e957216b6106382b9a46bae266f --- src/connection-editor/connection-helpers.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/connection-editor/connection-helpers.c b/src/connection-editor/connection-helpers.c index 0d29f20a..6ed85577 100644 --- a/src/connection-editor/connection-helpers.c +++ b/src/connection-editor/connection-helpers.c @@ -165,9 +165,21 @@ no_description: NMConnection * vpn_connection_from_file (const char *filename, GError **error) { + gs_free_error GError *unused_error = NULL; NMConnection *connection = NULL; GSList *iter; + if (!error) { + /* Some VPN plugins crash when passing no error variable ([1]). Work + * around that. In the meantime, libnm does the same workaround ([2]). + * + * + * [1] https://gitlab.gnome.org/GNOME/NetworkManager-vpnc/-/blob/c7d197477c94c5bae0396f0ef826db4d835e487d/properties/nm-vpnc-editor-plugin.c#L281 + * [2] https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/commit/3b2eb689f3da1e957216b6106382b9a46bae266f + */ + error = &unused_error; + } + for (iter = vpn_get_plugin_infos (); !connection && iter; iter = iter->next) { NMVpnEditorPlugin *plugin; -- cgit v1.2.1