mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-05 06:30:33 +01:00
libnm: handle all-default settings in nm_setting_to_hash() properly
Before, _nm_setting_to_dbus() would return NULL instead of an empty
hash. This would be the case, if all properties are default.
When exporting connections via DBUS, we eventually call
_nm_setting_to_dbus() to convert the connection into a hash of hashes.
By _nm_setting_to_hash() converting empty hashes to NULL, the setting
is missing. Not returning empty hashes means that to_dbus() and
new_from_dbus() don't make a valid round-trip conversion.
Fix that by always returning a hash from _nm_setting_to_dbus()
https://bugzilla.gnome.org/show_bug.cgi?id=735255
See-also: 4d32618264
Signed-off-by: Thomas Haller <thaller@redhat.com>
This commit is contained in:
parent
85909d080f
commit
6325c596c0
2 changed files with 1 additions and 7 deletions
|
|
@ -744,12 +744,6 @@ _nm_setting_to_dbus (NMSetting *setting, NMConnection *connection, NMConnectionS
|
|||
destroy_gvalue (value);
|
||||
}
|
||||
|
||||
/* Don't return empty hashes, except for base types */
|
||||
if (g_hash_table_size (hash) < 1 && !_nm_setting_is_base_type (setting)) {
|
||||
g_hash_table_destroy (hash);
|
||||
hash = NULL;
|
||||
}
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -678,7 +678,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);
|
||||
g_assert_cmpint (g_hash_table_size (secrets), ==, 1);
|
||||
g_assert_cmpint (g_hash_table_size (secrets), ==, 3);
|
||||
g_assert (g_hash_table_lookup (secrets, NM_SETTING_WIRELESS_SETTING_NAME));
|
||||
|
||||
success = nm_connection_update_secrets (connection,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue