This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[1.7] Admins can write to readonly files


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]