delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/03/02/05:46:59

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Fri, 2 Mar 2012 11:46:05 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: base-files: New files to fix permission issues (was Re: 1.7.10/1.7.11: .Net programs started from a cygwin console may fail.)
Message-ID: <20120302104605.GF14404@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <70952A932255A2489522275A628B97C3129F49F7 AT xmb-sjc-233 DOT amer DOT cisco DOT com> <20120301100820 DOT GC2257 AT calimero DOT vinschen DOT de>
MIME-Version: 1.0
In-Reply-To: <20120301100820.GC2257@calimero.vinschen.de>
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Mar  1 11:08, Corinna Vinschen wrote:
>   # Fix a problem introduced by older versions of setup.exe
>   [...]

David, ping?  Can we add the below two files to base-files asap and
remove the tmp/temp workaround, please?

/etc/profile.d/1777fix.csh:

  #!/bin/tcsh
  # Fix a problem introduced by older versions of setup.exe
  # Read comments in /etc/profile.d/1777fix.sh for more information.
  set GUARDFILE = "/etc/.1777fix"
  if ( ! -f "${GUARDFILE}" ) then
    /bin/bash /etc/profile.d/1777fix.sh
  endif

/etc/profile.d/1777fix.sh:

  #!/bin/bash
  # Fix a problem introduced by older versions of setup.exe
  # Directories with 1777 permissions were erroneously created
  # with 777 inheritable default permissions.  This is a security
  # problem for non-Cygwin apps using these folders.  This is
  # especially tragic in case of /tmp.
  GUARDFILE="/etc/.1777fix"
  DIRLIST="/home /tmp /usr/tmp /var/log /var/run"
  if [ ! -f "${GUARDFILE}" ]
  then
    cnt=0
    success=0
    for file in ${DIRLIST}
    do
      # We test if the default group or other permissions are rwx.
      # If so, it's dangerous and highly likely that these are still
      # the permissions set by setup.exe
      if getfacl "${file}" | grep -Eq 'default:(group:|other):rwx'
      then
	cnt=$(expr $cnt + 1)
	setfacl -m d:g::r-x,d:o:r-x "${file}" 2>/dev/null \
	&& success=$(expr $success + 1)
      fi
    done
    # If no file needed treatment, or if all setfacl calls succeeded,
    # create the
    [ $cnt -eq  $success ] && touch "${GUARDFILE}"
  fi


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019