mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 03:50:17 +01:00
libnm: normalize "connection.read-only" to FALSE
This commit is contained in:
parent
8ecd5a675a
commit
9ccb4a83ec
2 changed files with 27 additions and 0 deletions
|
|
@ -883,6 +883,20 @@ _normalize_connection_uuid(NMConnection *self)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_normalize_connection(NMConnection *self)
|
||||
{
|
||||
NMSettingConnection *s_con = nm_connection_get_setting_connection(self);
|
||||
gboolean changed = FALSE;
|
||||
|
||||
if (nm_setting_connection_get_read_only(s_con)) {
|
||||
g_object_set(s_con, NM_SETTING_CONNECTION_READ_ONLY, FALSE, NULL);
|
||||
changed = TRUE;
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_nm_setting_connection_verify_secondaries(GArray *secondaries, GError **error)
|
||||
{
|
||||
|
|
@ -2005,6 +2019,7 @@ _connection_normalize(NMConnection *connection,
|
|||
was_modified |= _normalize_connection_type(connection);
|
||||
was_modified |= _normalize_connection_slave_type(connection);
|
||||
was_modified |= _normalize_connection_secondaries(connection);
|
||||
was_modified |= _normalize_connection(connection);
|
||||
was_modified |= _normalize_required_settings(connection);
|
||||
was_modified |= _normalize_invalid_slave_port_settings(connection);
|
||||
was_modified |= _normalize_ip_config(connection, parameters);
|
||||
|
|
|
|||
|
|
@ -1610,6 +1610,18 @@ after_interface_name:
|
|||
if (!_nm_setting_connection_verify_secondaries(priv->secondaries.arr, error))
|
||||
return NM_SETTING_VERIFY_NORMALIZABLE;
|
||||
|
||||
if (priv->read_only) {
|
||||
g_set_error_literal(error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_MISSING_PROPERTY,
|
||||
_("read-only is deprecated and not settable for the user"));
|
||||
g_prefix_error(error,
|
||||
"%s.%s: ",
|
||||
NM_SETTING_CONNECTION_SETTING_NAME,
|
||||
NM_SETTING_CONNECTION_READ_ONLY);
|
||||
return NM_SETTING_VERIFY_NORMALIZABLE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue