delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/08/28/06:07:11

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_23
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
Date: Fri, 28 Aug 2009 12:06:24 +0200
Reply-To: "Christian Franke" <Christian DOT Franke AT t-online DOT de>
To: "Cygwin" <cygwin AT cygwin DOT com>
Subject: =?ISO-8859-15?Q?=5B1.7=5D_Admins_can_write_to_readonly_files?=
From: "Christian Franke" <Christian DOT Franke AT t-online DOT de>
Message-ID: <1MgyLg-0CvIW00@fwd04.aul.t-online.de>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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

For members of Admin group, Cygwin 1.7 allows to overwrite files without
write permission, but Cygwin 1.5 does not.

Is this a intended change of 1.7 ?

I would suggest to add a note to
http://cygwin.com/1.7/cygwin-ug-net/ov-new1.7.html


Testcase (WinXP SP2 and 3, Cygwin 1.7.0-60):

$ touch foo

$ chmod a=r foo

$ ls -l foo
-r--r--r-- 1 franke none 0 Aug 28 11:17 foo

$ cacls foo | grep FILE_WRITE_DATA

$ attrib foo
A          C:\cygwin\tmp\foo

$ dd if=/dev/zero bs=1 count=1 of=foo
1+0 records in
1+0 records out
1 byte (1 B) copied, 0 s, Infinity B/s


Same file, but Cygwin 1.5:

$ dd if=/dev/zero bs=1 count=1 of=foo
dd: opening `foo': Permission denied


fhandler_base::open() calls NtCreateFile() with different
'creation_options' values:

1.5.0-25:
0x0420 = FILE_OPEN_FOR_RECOVERY|FILE_SYNCHRONOUS_IO_NONALERT

1.7.0-60:
0x4020 = FILE_OPEN_FOR_BACKUP_INTENT|FILE_SYNCHRONOUS_IO_NONALERT

What is the effect of FILE_OPEN_FOR_RECOVERY ?

-- 
Regards
Christian Franke




--
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