From e5fa26e57394ab0f60348b4ae7eded6003f0f450 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Tue, 24 Dec 2013 17:36:10 +0100 Subject: [PATCH] Make newly-created files other than grub.cfg world-readable. --- ChangeLog | 4 ++++ grub-core/osdep/apple/hostdisk.c | 4 ++-- grub-core/osdep/aros/hostdisk.c | 2 +- grub-core/osdep/bsd/hostdisk.c | 2 +- grub-core/osdep/freebsd/hostdisk.c | 2 +- grub-core/osdep/unix/hostdisk.c | 2 +- include/grub/osdep/hostfile_aros.h | 2 +- include/grub/osdep/hostfile_unix.h | 2 +- 8 files changed, 12 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index ca7e483fe..351ff5908 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-12-24 Vladimir Serbinenko + + Make newly-created files other than grub.cfg world-readable. + 2013-12-24 Andrey Borzenkov * util/grub.d/00_header.in: Improve compatibility with old config. diff --git a/grub-core/osdep/apple/hostdisk.c b/grub-core/osdep/apple/hostdisk.c index d0641744b..8d9b4b402 100644 --- a/grub-core/osdep/apple/hostdisk.c +++ b/grub-core/osdep/apple/hostdisk.c @@ -80,11 +80,11 @@ grub_util_fd_open (const char *os_dev, int flags) flags |= O_BINARY; #endif - ret = open (os_dev, flags, S_IRUSR | S_IWUSR); + ret = open (os_dev, flags, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR); /* If we can't have exclusive access, try shared access */ if (ret < 0) - ret = open (os_dev, flags | O_SHLOCK, S_IRUSR | S_IWUSR); + ret = open (os_dev, flags | O_SHLOCK, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR); return ret; } diff --git a/grub-core/osdep/aros/hostdisk.c b/grub-core/osdep/aros/hostdisk.c index c7efb9608..e1eeea7d0 100644 --- a/grub-core/osdep/aros/hostdisk.c +++ b/grub-core/osdep/aros/hostdisk.c @@ -180,7 +180,7 @@ grub_util_fd_open (const char *dev, int flg) if (dev[0] != '/' || dev[1] != '/' || dev[2] != ':') { ret->type = GRUB_UTIL_FD_FILE; - ret->fd = open (dev, flg, S_IRUSR | S_IWUSR); + ret->fd = open (dev, flg, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR); if (ret->fd < 0) { free (ret); diff --git a/grub-core/osdep/bsd/hostdisk.c b/grub-core/osdep/bsd/hostdisk.c index c82d60e11..5912d14bf 100644 --- a/grub-core/osdep/bsd/hostdisk.c +++ b/grub-core/osdep/bsd/hostdisk.c @@ -90,7 +90,7 @@ grub_util_fd_open (const char *os_dev, int flags) flags |= O_BINARY; #endif - ret = open (os_dev, flags, S_IRUSR | S_IWUSR); + ret = open (os_dev, flags, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR); if (ret >= 0) configure_device_driver (fd); return ret; diff --git a/grub-core/osdep/freebsd/hostdisk.c b/grub-core/osdep/freebsd/hostdisk.c index 944e4be02..bd5fddb91 100644 --- a/grub-core/osdep/freebsd/hostdisk.c +++ b/grub-core/osdep/freebsd/hostdisk.c @@ -106,7 +106,7 @@ grub_util_fd_open (const char *os_dev, int flags) return GRUB_UTIL_FD_INVALID; } - ret = open (os_dev, flags, S_IRUSR | S_IWUSR); + ret = open (os_dev, flags, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR); #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) if (! (sysctl_oldflags & 0x10) diff --git a/grub-core/osdep/unix/hostdisk.c b/grub-core/osdep/unix/hostdisk.c index fa83f26e2..43b56ff31 100644 --- a/grub-core/osdep/unix/hostdisk.c +++ b/grub-core/osdep/unix/hostdisk.c @@ -181,7 +181,7 @@ grub_util_fd_open (const char *os_dev, int flags) flags |= O_BINARY; #endif - return open (os_dev, flags, S_IRUSR | S_IWUSR); + return open (os_dev, flags, S_IROTH | S_IRGRP | S_IRUSR | S_IWUSR); } #endif diff --git a/include/grub/osdep/hostfile_aros.h b/include/grub/osdep/hostfile_aros.h index 4ec211b48..a059c0fa4 100644 --- a/include/grub/osdep/hostfile_aros.h +++ b/include/grub/osdep/hostfile_aros.h @@ -68,7 +68,7 @@ grub_util_rename (const char *from, const char *to) return rename (from, to); } -#define grub_util_mkdir(a) mkdir (a, 0700) +#define grub_util_mkdir(a) mkdir ((a), 0755) struct grub_util_fd { diff --git a/include/grub/osdep/hostfile_unix.h b/include/grub/osdep/hostfile_unix.h index e4e89398c..9ffe46fa3 100644 --- a/include/grub/osdep/hostfile_unix.h +++ b/include/grub/osdep/hostfile_unix.h @@ -71,7 +71,7 @@ grub_util_rename (const char *from, const char *to) return rename (from, to); } -#define grub_util_mkdir(a) mkdir ((a), 0700) +#define grub_util_mkdir(a) mkdir ((a), 0755) #if defined (__NetBSD__) /* NetBSD uses /boot for its boot block. */