mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-25 04:50:37 +01:00
libnm-util: accept old-style UUIDs as valid
Old versions such as 0.9.4 generated 40-character UUIDs with no hashes, but libnm-util regards them as invalid. That means that existing connections stop working when upgrading from 0.9.4. Continue accepting such UUIDs as valid, and add a test so that we don't forget in future.
This commit is contained in:
parent
ff2bd46396
commit
3f4811be22
2 changed files with 32 additions and 1 deletions
|
|
@ -2264,5 +2264,12 @@ nm_utils_is_uuid (const char *str)
|
|||
p++;
|
||||
}
|
||||
|
||||
return (num_dashes == 4) && (p - str == 36);
|
||||
if ((num_dashes == 4) && (p - str == 36))
|
||||
return TRUE;
|
||||
|
||||
/* Backwards compat for older configurations */
|
||||
if ((num_dashes == 0) && (p - str == 40))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2075,6 +2075,29 @@ test_setting_802_1x_changed_signal (void)
|
|||
g_object_unref (connection);
|
||||
}
|
||||
|
||||
static void
|
||||
test_setting_old_uuid (void)
|
||||
{
|
||||
GError *error = NULL;
|
||||
NMSetting *setting;
|
||||
gboolean success;
|
||||
|
||||
/* NetworkManager-0.9.4.0 generated 40-character UUIDs with no dashes,
|
||||
* like this one. Test that we maintain compatibility. */
|
||||
const char *uuid = "f43bec2cdd60e5da381ebb1eb1fa39f3cc52660c";
|
||||
|
||||
setting = nm_setting_connection_new ();
|
||||
g_object_set (G_OBJECT (setting),
|
||||
NM_SETTING_CONNECTION_ID, "uuidtest",
|
||||
NM_SETTING_CONNECTION_UUID, uuid,
|
||||
NM_SETTING_CONNECTION_TYPE, NM_SETTING_WIRED_SETTING_NAME,
|
||||
NULL);
|
||||
|
||||
success = nm_setting_verify (NM_SETTING (setting), NULL, &error);
|
||||
g_assert_no_error (error);
|
||||
g_assert (success == TRUE);
|
||||
}
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
|
@ -2106,6 +2129,7 @@ int main (int argc, char **argv)
|
|||
test_setting_compare_vpn_secrets (NM_SETTING_SECRET_FLAG_NOT_SAVED, NM_SETTING_COMPARE_FLAG_IGNORE_NOT_SAVED_SECRETS, TRUE);
|
||||
test_setting_compare_vpn_secrets (NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_IGNORE_SECRETS, TRUE);
|
||||
test_setting_compare_vpn_secrets (NM_SETTING_SECRET_FLAG_NONE, NM_SETTING_COMPARE_FLAG_EXACT, FALSE);
|
||||
test_setting_old_uuid ();
|
||||
|
||||
test_connection_to_hash_setting_name ();
|
||||
test_setting_new_from_hash ();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue