mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-05 17:00:29 +01:00
all: Replace deprecated NM_CONNECTION_SERIALIZE_* flags
Review and replace usages of the two nm_connection_to_dbus() flags
marked deprecated in commit 84648e562c98 ('libnm: Refactor
NM_CONNECTION_SERIALIZE_* flags'):
NM_CONNECTION_SERIALIZE_NO_SECRETS and
NM_CONNECTION_SERIALIZE_ONLY_SECRETS.
This commit is contained in:
parent
2a1b65ce12
commit
f0fe7384e1
10 changed files with 19 additions and 19 deletions
|
|
@ -12926,7 +12926,8 @@ impl_device_get_applied_connection(NMDBusObject * obj,
|
|||
return;
|
||||
}
|
||||
|
||||
var_settings = nm_connection_to_dbus(applied_connection, NM_CONNECTION_SERIALIZE_NO_SECRETS);
|
||||
var_settings =
|
||||
nm_connection_to_dbus(applied_connection, NM_CONNECTION_SERIALIZE_WITH_NON_SECRET);
|
||||
if (!var_settings)
|
||||
var_settings = g_variant_new_array(G_VARIANT_TYPE("{sa{sv}}"), NULL, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -550,7 +550,7 @@ _dispatcher_call(NMDispatcherAction action,
|
|||
|
||||
if (applied_connection)
|
||||
connection_dict =
|
||||
nm_connection_to_dbus(applied_connection, NM_CONNECTION_SERIALIZE_NO_SECRETS);
|
||||
nm_connection_to_dbus(applied_connection, NM_CONNECTION_SERIALIZE_WITH_NON_SECRET);
|
||||
else
|
||||
connection_dict = g_variant_new_array(G_VARIANT_TYPE("{sa{sv}}"), NULL, 0);
|
||||
|
||||
|
|
|
|||
|
|
@ -583,7 +583,7 @@ nm_secret_agent_delete_secrets(NMSecretAgent * self,
|
|||
priv = NM_SECRET_AGENT_GET_PRIVATE(self);
|
||||
|
||||
/* No secrets sent; agents must be smart enough to track secrets using the UUID or something */
|
||||
dict = nm_connection_to_dbus(connection, NM_CONNECTION_SERIALIZE_NO_SECRETS);
|
||||
dict = nm_connection_to_dbus(connection, NM_CONNECTION_SERIALIZE_WITH_NON_SECRET);
|
||||
|
||||
call_id = _call_id_new(self, METHOD_DELETE_SECRETS, path, NULL, callback, callback_data);
|
||||
|
||||
|
|
|
|||
|
|
@ -1333,7 +1333,7 @@ get_settings_auth_cb(NMSettingsConnection * self,
|
|||
* protected against leakage of secrets to unprivileged callers.
|
||||
*/
|
||||
settings = nm_connection_to_dbus_full(nm_settings_connection_get_connection(self),
|
||||
NM_CONNECTION_SERIALIZE_NO_SECRETS,
|
||||
NM_CONNECTION_SERIALIZE_WITH_NON_SECRET,
|
||||
&options);
|
||||
g_dbus_method_invocation_return_value(context, g_variant_new("(@a{sa{sv}})", settings));
|
||||
}
|
||||
|
|
@ -1866,7 +1866,7 @@ dbus_get_agent_secrets_cb(NMSettingsConnection * self,
|
|||
* by the time we get here.
|
||||
*/
|
||||
dict = nm_connection_to_dbus(nm_settings_connection_get_connection(self),
|
||||
NM_CONNECTION_SERIALIZE_ONLY_SECRETS);
|
||||
NM_CONNECTION_SERIALIZE_WITH_SECRETS);
|
||||
if (!dict)
|
||||
dict = g_variant_new_array(G_VARIANT_TYPE("{sa{sv}}"), NULL, 0);
|
||||
g_dbus_method_invocation_return_value(context, g_variant_new("(@a{sa{sv}})", dict));
|
||||
|
|
|
|||
|
|
@ -1541,9 +1541,7 @@ _add_connection_to_first_plugin(NMSettings * self,
|
|||
}
|
||||
|
||||
agent_owned_secrets =
|
||||
nm_connection_to_dbus(new_connection,
|
||||
NM_CONNECTION_SERIALIZE_ONLY_SECRETS
|
||||
| NM_CONNECTION_SERIALIZE_WITH_SECRETS_AGENT_OWNED);
|
||||
nm_connection_to_dbus(new_connection, NM_CONNECTION_SERIALIZE_WITH_SECRETS_AGENT_OWNED);
|
||||
connection_to_add_real =
|
||||
_connection_changed_normalize_connection(storage,
|
||||
connection_to_add,
|
||||
|
|
@ -2218,9 +2216,7 @@ nm_settings_update_connection(NMSettings * self,
|
|||
nm_assert(nm_streq(uuid, nm_settings_storage_get_uuid(new_storage)));
|
||||
|
||||
agent_owned_secrets =
|
||||
nm_connection_to_dbus(connection,
|
||||
NM_CONNECTION_SERIALIZE_ONLY_SECRETS
|
||||
| NM_CONNECTION_SERIALIZE_WITH_SECRETS_AGENT_OWNED);
|
||||
nm_connection_to_dbus(connection, NM_CONNECTION_SERIALIZE_WITH_SECRETS_AGENT_OWNED);
|
||||
new_connection_real = _connection_changed_normalize_connection(new_storage,
|
||||
new_connection,
|
||||
agent_owned_secrets,
|
||||
|
|
|
|||
|
|
@ -2583,7 +2583,10 @@ test_setting_to_dbus_no_secrets(void)
|
|||
|
||||
s_wsec = make_test_wsec_setting("setting-to-dbus-no-secrets");
|
||||
|
||||
dict = _nm_setting_to_dbus(NM_SETTING(s_wsec), NULL, NM_CONNECTION_SERIALIZE_NO_SECRETS, NULL);
|
||||
dict = _nm_setting_to_dbus(NM_SETTING(s_wsec),
|
||||
NULL,
|
||||
NM_CONNECTION_SERIALIZE_WITH_NON_SECRET,
|
||||
NULL);
|
||||
|
||||
/* Make sure non-secret keys are there */
|
||||
g_assert(_variant_contains(dict, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT));
|
||||
|
|
@ -2606,7 +2609,7 @@ test_setting_to_dbus_only_secrets(void)
|
|||
s_wsec = make_test_wsec_setting("setting-to-dbus-only-secrets");
|
||||
|
||||
dict =
|
||||
_nm_setting_to_dbus(NM_SETTING(s_wsec), NULL, NM_CONNECTION_SERIALIZE_ONLY_SECRETS, NULL);
|
||||
_nm_setting_to_dbus(NM_SETTING(s_wsec), NULL, NM_CONNECTION_SERIALIZE_WITH_SECRETS, NULL);
|
||||
|
||||
/* Make sure non-secret keys are not there */
|
||||
g_assert(!_variant_contains(dict, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT));
|
||||
|
|
|
|||
|
|
@ -605,7 +605,7 @@ test_update_secrets_whole_connection_empty_base_setting(void)
|
|||
*/
|
||||
|
||||
connection = wifi_connection_new();
|
||||
secrets = nm_connection_to_dbus(connection, NM_CONNECTION_SERIALIZE_ONLY_SECRETS);
|
||||
secrets = nm_connection_to_dbus(connection, NM_CONNECTION_SERIALIZE_WITH_SECRETS);
|
||||
g_assert_cmpint(g_variant_n_children(secrets), ==, 3);
|
||||
|
||||
setting = g_variant_lookup_value(secrets, NM_SETTING_WIRELESS_SETTING_NAME, NULL);
|
||||
|
|
|
|||
|
|
@ -3245,8 +3245,8 @@ test_roundtrip_conversion(gconstpointer test_data)
|
|||
gs_unref_ptrarray GPtrArray * wg_peers = NULL;
|
||||
const NMConnectionSerializationFlags dbus_serialization_flags[] = {
|
||||
NM_CONNECTION_SERIALIZE_ALL,
|
||||
NM_CONNECTION_SERIALIZE_NO_SECRETS,
|
||||
NM_CONNECTION_SERIALIZE_ONLY_SECRETS,
|
||||
NM_CONNECTION_SERIALIZE_WITH_NON_SECRET,
|
||||
NM_CONNECTION_SERIALIZE_WITH_SECRETS,
|
||||
};
|
||||
guint dbus_serialization_flags_idx;
|
||||
gs_unref_object NMConnection *con = NULL;
|
||||
|
|
@ -3643,7 +3643,7 @@ test_roundtrip_conversion(gconstpointer test_data)
|
|||
|
||||
if (flag == NM_CONNECTION_SERIALIZE_ALL)
|
||||
_rndt_wg_peers_assert_equal(s_wg2, wg_peers, TRUE, TRUE, FALSE);
|
||||
else if (flag == NM_CONNECTION_SERIALIZE_NO_SECRETS)
|
||||
else if (flag == NM_CONNECTION_SERIALIZE_WITH_NON_SECRET)
|
||||
_rndt_wg_peers_assert_equal(s_wg2, wg_peers, FALSE, FALSE, TRUE);
|
||||
else
|
||||
g_assert_not_reached();
|
||||
|
|
|
|||
|
|
@ -5821,7 +5821,7 @@ gen_cmd_print0(const char *text, int state)
|
|||
int i = 0;
|
||||
|
||||
settings = nm_connection_to_dbus(nmc_tab_completion.connection,
|
||||
NM_CONNECTION_SERIALIZE_NO_SECRETS);
|
||||
NM_CONNECTION_SERIALIZE_WITH_NON_SECRET);
|
||||
words = g_new(char *, g_variant_n_children(settings) + 2);
|
||||
g_variant_iter_init(&iter, settings);
|
||||
while (g_variant_iter_next(&iter, "{&s@a{sv}}", &setting_name, NULL))
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ build_edit_connection(NMConnection *orig_connection)
|
|||
if (!NM_IS_REMOTE_CONNECTION(orig_connection))
|
||||
return edit_connection;
|
||||
|
||||
settings = nm_connection_to_dbus(orig_connection, NM_CONNECTION_SERIALIZE_NO_SECRETS);
|
||||
settings = nm_connection_to_dbus(orig_connection, NM_CONNECTION_SERIALIZE_WITH_NON_SECRET);
|
||||
g_variant_iter_init(&iter, settings);
|
||||
while (g_variant_iter_next(&iter, "{&s@a{sv}}", &setting_name, NULL)) {
|
||||
if (!nm_meta_setting_info_editor_has_secrets(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue