Date: Wed, 4 Aug 1999 17:22:29 GMT From: Udo Schweigert <ust@cert.siemens.de> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/12967: File permissions after timezone changing with "tzsetup" Message-ID: <199908041722.RAA39205@alaska.cert.siemens.de>
index | next in thread | raw e-mail
>Number: 12967
>Category: bin
>Synopsis: File permissions after timezone changing with "tzsetup"
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Aug 4 10:30:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator: Udo Schweigert
>Release: FreeBSD 3.2-STABLE i386
>Organization:
>Environment:
FreeBSD 3.2-STABLE
FreeBSD 4.0-CURRENT
>Description:
After changing the timezone with /usr/sbin/tzsetup (or /stand/sysinstall)
the file /etc/localtime gets file permissions modified with the callers umask.
(If /etc/localtime is a symbolic links, things may be different)
So if umask is 077 the file has:
-r-------- 1 root wheel 287 Aug 4 17:17 /etc/localtime
With this permissions only uid 0 has the correct zone, the others fall back
to UTC.
>How-To-Repeat:
# ls -l /etc/localtime
# umask 077
# /usr/sbin/tzsetup
# ls -l /etc/localtime
>Fix:
--- tzsetup.c Sun May 2 08:18:53 1999
+++ /tmp/tzsetup.c Tue Aug 3 06:46:58 1999
@@ -499,6 +499,7 @@
if (reallydoit) {
if (copymode) {
+ mode_t old_mask;
fd1 = open(filename, O_RDONLY, 0);
if (fd1 < 0) {
asprintf(&msg, "Could not open %s: %s",
@@ -509,9 +510,11 @@
}
unlink(_PATH_LOCALTIME);
+ old_mask = umask(022);
fd2 = open(_PATH_LOCALTIME,
O_CREAT | O_EXCL | O_WRONLY,
0444);
+ umask(old_mask);
if (fd2 < 0) {
asprintf(&msg, "Could not open "
_PATH_LOCALTIME ": %s",
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199908041722.RAA39205>
