diff options
author | Rasmus Thomsen <oss@cogitri.dev> | 2020-07-05 10:35:36 +0200 |
---|---|---|
committer | Leo <thinkabit.ukim@gmail.com> | 2020-07-05 07:00:14 -0300 |
commit | 9c775617adc92f7919af23b7ee6550c2a42216a7 (patch) | |
tree | f3719ac4c725b9b1c16ff9633d74e8acc61d19cc /community/openrc-settingsd/0002-Ensure-0664-permissions-on-etc-localtime.patch | |
parent | 8de727b2bfc0dd6312046aed0530bf083c97f5f1 (diff) |
community/openrc-settingsd: ensure proper permissions on localtime and timezone
Diffstat (limited to 'community/openrc-settingsd/0002-Ensure-0664-permissions-on-etc-localtime.patch')
-rw-r--r-- | community/openrc-settingsd/0002-Ensure-0664-permissions-on-etc-localtime.patch | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/community/openrc-settingsd/0002-Ensure-0664-permissions-on-etc-localtime.patch b/community/openrc-settingsd/0002-Ensure-0664-permissions-on-etc-localtime.patch new file mode 100644 index 00000000000..345f76d410d --- /dev/null +++ b/community/openrc-settingsd/0002-Ensure-0664-permissions-on-etc-localtime.patch @@ -0,0 +1,45 @@ +From fdeef40875bebf3970d1365dc92cb893a0298097 Mon Sep 17 00:00:00 2001 +From: Rasmus Thomsen <oss@cogitri.dev> +Date: Fri, 3 Jul 2020 12:19:52 +0200 +Subject: [PATCH 2/2] Ensure 0664 permissions on /etc/localtime + +Otherwise the timezone couldn't be read by other users +--- + src/timedated.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/timedated.c b/src/timedated.c +index a6779f9..77d12ee 100644 +--- a/src/timedated.c ++++ b/src/timedated.c +@@ -26,6 +26,7 @@ + + #include <dbus/dbus-protocol.h> + #include <glib.h> ++#include <glib/gstdio.h> + #include <gio/gio.h> + + #if HAVE_OPENRC +@@ -135,6 +136,9 @@ set_timezone (const gchar *_timezone_name, + g_prefix_error (error, "Unable to write '%s':", timezone_filename); + goto out; + } ++ if(g_chmod (timezone_filename, 0664) != 0) { ++ g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED, "Unable to set 0664 permissions on timezone file '%s'", timezone_filename); ++ } + + localtime_filename = g_file_get_path (localtime_file); + localtime2_filename = g_strdup_printf (DATADIR "/zoneinfo/%s", _timezone_name); +@@ -158,6 +162,9 @@ set_timezone (const gchar *_timezone_name, + g_prefix_error (error, "Unable to write '%s':", localtime_filename); + goto out; + } ++ if(g_chmod (localtime_filename, 0664) != 0) { ++ g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED, "Unable to set 0664 permissions on localtime file '%s'", localtime_filename); ++ } + } else { + // File doesn't exist yet -> make a new symlink + if (!g_file_make_symbolic_link (localtime_file, localtime2_filename, NULL, error)) { +-- +2.26.2 + |