From owner-freebsd-bugs Wed Aug 4 10:30:41 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id ABDF81541D for ; Wed, 4 Aug 1999 10:30:30 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id KAA25838; Wed, 4 Aug 1999 10:30:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from david.siemens.de (david.siemens.de [192.35.17.14]) by hub.freebsd.org (Postfix) with ESMTP id 3D0F515199 for ; Wed, 4 Aug 1999 10:23:12 -0700 (PDT) (envelope-from ust@cert.siemens.de) Received: from mail2.siemens.de (mail2.siemens.de [139.25.208.14]) by david.siemens.de (8.9.3/8.9.3) with ESMTP id TAA12069 for ; Wed, 4 Aug 1999 19:22:29 +0200 (MET DST) Received: from mars.cert.siemens.de (ust.mchp.siemens.de [139.23.201.17]) by mail2.siemens.de (8.9.3/8.9.3) with ESMTP id TAA18443 for ; Wed, 4 Aug 1999 19:22:28 +0200 (MET DST) Received: from alaska.cert.siemens.de (alaska.cert.siemens.de [139.23.202.134]) by mars.cert.siemens.de (8.9.3/8.9.3/Siemens CERT [ $Revision: 1.9 ]) with ESMTP id TAA30027 for ; Wed, 4 Aug 1999 19:22:29 +0200 (CEST) Received: (from ust@localhost) by alaska.cert.siemens.de (8.9.3/8.9.3/alaska [ $Revision: 1.2 ]) id RAA39205; Wed, 4 Aug 1999 17:22:29 GMT (envelope-from ust) Message-Id: <199908041722.RAA39205@alaska.cert.siemens.de> Date: Wed, 4 Aug 1999 17:22:29 GMT From: Udo Schweigert Reply-To: ust@cert.siemens.de To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/12967: File permissions after timezone changing with "tzsetup" Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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