summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-10-19 11:55:02 +0200
committerThomas Haller <thaller@redhat.com>2018-10-19 12:39:53 +0200
commit095bac3019fe0b66aff07da3228916938b94baa4 (patch)
tree12c291f6b531e3f114ab426d664574ff3d5b8561
parent3a368f351b5ab911d8db05a0078d3b655cb4d3b0 (diff)
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)
-rw-r--r--src/initrd/nm-initrd-generator.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/initrd/nm-initrd-generator.c b/src/initrd/nm-initrd-generator.c
index d2c7d56c6..eb9a38df0 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);