Expose host /etc/hosts and /etc/host.conf

These are local network configuration, very much similar to
resolv.conf, so should also be exposed.

Fixes https://github.com/alexlarsson/spotify-app/issues/42
This commit is contained in:
Alexander Larsson
2017-05-04 13:07:43 +02:00
parent 858a4b6044
commit 4d2d07d033
2 changed files with 17 additions and 9 deletions

View File

@@ -3544,12 +3544,10 @@ add_monitor_path_args (gboolean use_session_helper,
{
add_args (argv_array,
"--ro-bind", monitor_path, "/run/host/monitor",
NULL);
add_args (argv_array,
"--symlink", "/run/host/monitor/localtime", "/etc/localtime",
NULL);
add_args (argv_array,
"--symlink", "/run/host/monitor/resolv.conf", "/etc/resolv.conf",
"--symlink", "/run/host/monitor/host.conf", "/etc/host.conf",
"--symlink", "/run/host/monitor/hosts", "/etc/hosts",
NULL);
}
else
@@ -3596,11 +3594,17 @@ add_monitor_path_args (gboolean use_session_helper,
}
if (g_file_test ("/etc/resolv.conf", G_FILE_TEST_EXISTS))
{
add_args (argv_array,
"--ro-bind", "/etc/resolv.conf", "/etc/resolv.conf",
NULL);
}
add_args (argv_array,
"--ro-bind", "/etc/resolv.conf", "/etc/resolv.conf",
NULL);
if (g_file_test ("/etc/host.conf", G_FILE_TEST_EXISTS))
add_args (argv_array,
"--ro-bind", "/etc/host.conf", "/etc/host.conf",
NULL);
if (g_file_test ("/etc/hosts", G_FILE_TEST_EXISTS))
add_args (argv_array,
"--ro-bind", "/etc/hosts", "/etc/hosts",
NULL);
}
}
@@ -4229,6 +4233,8 @@ flatpak_run_setup_base_argv (GPtrArray *argv_array,
strcmp (dent->d_name, "group") == 0 ||
strcmp (dent->d_name, "machine-id") == 0 ||
strcmp (dent->d_name, "resolv.conf") == 0 ||
strcmp (dent->d_name, "host.conf") == 0 ||
strcmp (dent->d_name, "hosts") == 0 ||
strcmp (dent->d_name, "localtime") == 0)
continue;

View File

@@ -529,6 +529,8 @@ main (int argc,
}
setup_file_monitor ("/etc/resolv.conf");
setup_file_monitor ("/etc/host.conf");
setup_file_monitor ("/etc/hosts");
setup_file_monitor ("/etc/localtime");
flags = G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT;