libnm: Don't crash if service tells us a new key management mode

The NetworkManager service sometimes adds new key management modes.
If it does, an older client library (perhaps in a container, or loaded
into a pre-existing process before an upgrade) shouldn't crash when
talking to a newer NetworkManager service over D-Bus.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/744

Signed-off-by: Simon McVittie <smcv@collabora.com>

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/887

Fixes: 4c4f59674a ('2007-10-23  Dan Williams  <dcbw@redhat.com>')

(cherry picked from commit 18c76388f0)
This commit is contained in:
Simon McVittie 2021-06-10 14:14:09 +01:00 committed by Thomas Haller
parent a25c577556
commit a90a7b2d5f
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -866,8 +866,9 @@ need_secrets(NMSetting *setting)
goto no_secrets;
}
g_assert_not_reached();
return secrets;
/* If we get here, we're an older libnm talking to a newer NetworkManager
* service (perhaps from a container or during an upgrade). Assume that
* unknown/future key management modes don't need any extra secrets. */
no_secrets:
if (secrets)