From 095bac3019fe0b66aff07da3228916938b94baa4 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 19 Oct 2018 11:55:02 +0200 Subject: [PATCH] initrd: add .nmconnection extension when writing keyfiles initrd does not use keyfile API from "src/settings/plugins/keyfile", hence it does not use nms_keyfile_utils_escape_filename() to add the ".nmconnection" file extension. I think that is problematic, because it also misses escapings which are necessary so that NetworkManager will accept the file. Anyway, the proper solution here would be to move the keyfile utility functions to libnm-core, alongside base keyfile API. That way, it could be used by initrd generator. For now, just dirty fix the generated filename. Fixes: 648c256b9014198aac388097e410999c68c4b452 (cherry picked from commit 4ca7fa7f4abfd52e13844013cffa0dbda3146f9a) --- src/initrd/nm-initrd-generator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/initrd/nm-initrd-generator.c b/src/initrd/nm-initrd-generator.c index d2c7d56c69..eb9a38df0b 100644 --- a/src/initrd/nm-initrd-generator.c +++ b/src/initrd/nm-initrd-generator.c @@ -63,7 +63,8 @@ output_conn (gpointer key, gpointer value, gpointer user_data) g_print ("%s\n", error->message); g_error_free (error); } else if (connections_dir) { - char *filename = g_build_filename (connections_dir, basename, NULL); + gs_free char *basename_w_ext = g_strconcat (basename, ".nmconnection", NULL); + char *filename = g_build_filename (connections_dir, basename_w_ext, NULL); if (!nm_utils_file_set_contents (filename, data, len, 0600, &error)) { g_print ("%s\n", error->message);