libnm-core: fix verify() implementations to allow connection=NULL

This commit is contained in:
Lubomir Rintel 2017-05-31 19:08:12 +02:00
parent 0d71c0569f
commit c22672b383
3 changed files with 7 additions and 3 deletions

View file

@ -1787,6 +1787,9 @@ _nm_connection_verify_required_interface_name (NMConnection *connection,
{
const char *interface_name;
if (!connection)
return TRUE;
interface_name = nm_connection_get_interface_name (connection);
if (interface_name)
return TRUE;

View file

@ -645,7 +645,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
}
}
if (nm_connection_get_setting_infiniband (connection)) {
if (connection && nm_connection_get_setting_infiniband (connection)) {
if (strcmp (mode_new, "active-backup") != 0) {
g_set_error (error,
NM_CONNECTION_ERROR,

View file

@ -181,7 +181,7 @@ nm_setting_infiniband_get_virtual_interface_name (NMSettingInfiniband *setting)
static gboolean
verify (NMSetting *setting, NMConnection *connection, GError **error)
{
NMSettingConnection *s_con;
NMSettingConnection *s_con = NULL;
NMSettingInfinibandPrivate *priv = NM_SETTING_INFINIBAND_GET_PRIVATE (setting);
guint32 normerr_max_mtu = 0;
@ -241,7 +241,8 @@ verify (NMSetting *setting, NMConnection *connection, GError **error)
}
}
s_con = nm_connection_get_setting_connection (connection);
if (connection)
s_con = nm_connection_get_setting_connection (connection);
if (s_con) {
const char *interface_name = nm_setting_connection_get_interface_name (s_con);
GError *tmp_error = NULL;