Commit 4ca7fa7f authored by Thomas Haller's avatar Thomas Haller

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: 648c256b
parent 39bd412d
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment