From owner-freebsd-bugs Fri Jan 14 0:40: 5 2000 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 492CD151C4 for ; Fri, 14 Jan 2000 00:40:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id AAA89556; Fri, 14 Jan 2000 00:40:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from hawaii.uni-trier.de (hawaii.uni-trier.de [136.199.8.223]) by hub.freebsd.org (Postfix) with ESMTP id 9A9D515182 for ; Fri, 14 Jan 2000 00:39:33 -0800 (PST) (envelope-from blank@uni-trier.de) Received: from blank.uni-trier.de (rzppp-67.uni-trier.de [136.199.4.67]) by hawaii.uni-trier.de (8.9.3+Sun/8.9.3) with ESMTP id JAA09691 for ; Fri, 14 Jan 2000 09:39:30 +0100 (MET) Received: (from blank@localhost) by blank.uni-trier.de (8.9.3/8.9.3) id TAA01645; Thu, 13 Jan 2000 19:53:19 +0100 (CET) (envelope-from blank) Message-Id: <200001131853.TAA01645@blank.uni-trier.de> Date: Thu, 13 Jan 2000 19:53:19 +0100 (CET) From: blank@uni-trier.de (Sascha Blank) Reply-To: blank@uni-trier.de (Sascha Blank) To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/16119: ctm_rmail does not honor umask Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 16119 >Category: bin >Synopsis: ctm_rmail does not honor umask >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jan 14 00:40:00 PST 2000 >Closed-Date: >Last-Modified: >Originator: Sascha Blank >Release: FreeBSD 3.4-STABLE i386 >Organization: >Environment: A FreeBSD 3.4-STABLE (i386) system current as of Jan 12th 2000. >Description: When you feed a CTM delta into ctm_rmail the file that it produces has the permission 0600 no matter what your umask is set to. While this is of little concern for most users it will definatively get you into trouble when you want to make these deltas available over nfs or ftp (like I do on ctm.freebsd.org). Important note: This problem report applies to 4.0-CURRENT as well. >How-To-Repeat: Simply feed a CTM delta into ctm_rmail and look at the permission of the produced file. >Fix: The following small fix explicitly changes the permission to what the user expects while taking the current umask into account. Nothing fancy, but it works. *** ctm_rmail.c.orig Tue Jul 28 00:26:25 1998 --- ctm_rmail.c Thu Jan 13 19:27:40 2000 *************** *** 31,36 **** --- 31,37 ---- int delete_after = 0; /* Delete deltas after ctm applies them. */ int apply_verbose = 0; /* Run with '-v' */ int set_time = 0; /* Set the time of the files that is changed. */ + int mask = 0; /* The current umask */ void apply_complete(void); int read_piece(char *input_file); *************** *** 60,65 **** --- 61,69 ---- int status = 0; int fork_ctm = 0; + mask = umask(0); + umask(mask); + err_prog_name(argv[0]); OPTIONS("[-Dfuv] [-p piecedir] [-d deltadir] [-b basedir] [-l log] [file ...]") *************** *** 442,447 **** --- 446,452 ---- mk_piece_name(pname, delta, 1, 1); if (rename(pname, dname) == 0) { + chmod(dname, 0666 & ~mask); err("%s complete", delta); return 1; } *************** *** 552,557 **** --- 557,563 ---- unlink(tname); return 0; } + chmod(dname, 0666 & ~mask); /* * Throw the pieces away. >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message