Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jan 2000 19:53:19 +0100 (CET)
From:      blank@uni-trier.de (Sascha Blank)
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/16119: ctm_rmail does not honor umask
Message-ID:  <200001131853.TAA01645@blank.uni-trier.de>

next in thread | raw e-mail | index | archive | help

>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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200001131853.TAA01645>