On Sat, 2013-09-07 at 13:32 -0400, Daniel Drake wrote: > 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.
Pushed to master and 0.9.8, thanks! Dan > --- > libnm-util/nm-utils.c | 9 ++++++++- > libnm-util/tests/test-general.c | 24 ++++++++++++++++++++++++ > 2 files changed, 32 insertions(+), 1 deletion(-) > > diff --git a/libnm-util/nm-utils.c b/libnm-util/nm-utils.c > index e869e0a..c0b18f6 100644 > --- a/libnm-util/nm-utils.c > +++ b/libnm-util/nm-utils.c > @@ -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; > } > diff --git a/libnm-util/tests/test-general.c b/libnm-util/tests/test-general.c > index ff89128..3e6cee7 100644 > --- a/libnm-util/tests/test-general.c > +++ b/libnm-util/tests/test-general.c > @@ -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 (); _______________________________________________ networkmanager-list mailing list networkmanager-list@gnome.org https://mail.gnome.org/mailman/listinfo/networkmanager-list