Patch, Version 4: Unix-like permissions on objects [was Re: b21 -- various small issues]

Corinna Vinschen
Sat May 1 17:50:00 GMT 1999

Chris Faylor wrote:
> On Fri, Apr 30, 1999 at 04:25:23PM +0200, Corinna Vinschen wrote:
> >Has anybody fixed the chown/new headers problem in the meantime???
> The last I remember, Anders didn't see any difference between the
> old/new headers.
> I would very much like to get your changes into B21, though.  I don't
> have much time for cygwin right now, though, so debugging this problem
> is not feasible for me, unfortunately.
> -chris

Hi Chris,

I have rewritten my security change. The remaining problem with chown
is solved, it was a stricter security behaviour in SP4 vs SP3, and not
Anders headers, as I suspected (sorry Anders!)

The file is now very different relative to the older version
because BackupRead()/BackupWrite() is used instead of GetFileSecurity()/
The function chown() in is exclusively implemented by calls
to get_file_attributes()/set_file_attributes() now.

Another problem is also removed in this version. The function
GetFileSecurity() crashes on FAT and Samba file systems. The use of
BackupRead() prevents this. The current version works ok, samba
refuses (correctly!) the setting of owner/group/file modes.

I have carefully integrated the change into winsup-990430, I send the
patch file as bzip2ed attachment, because it's more than 40KB.

The NT security is coupled to the new CYGWIN option [no]ntsec.
The option [no]ntea is yet legal and does still work!
So everyone can decide self, how much UNIX-like security he/she wants.

As alread written in January: Well formed /etc/passwd and /etc/group
files are essential, to get the expected results. Especially the
attachment of users to their primary group is very helpful!


	corinna::1000:547:Corinna Vinschen:/home/corinna:/bin/tcsh
	ftp::1001:545:anonymous ftp login:/home/ftp:/bin/true


Best Regards,


Sun May  2  2:00:00  Corinna Vinschen  <>

	* (ReadSD): New function.
	* (WriteSD): Ditto.
	* (get_admin_sid): Moved from
	* (set_process_privileges): Moved from,
	shortened, changed return typ to int. Sets errno now.
	* (set_file_attributes): Return type changed to int.
	* (get_file_attributes): Ditto.
	* (set_nt_attributes): Ditto. Cares for setting
	of S_ISVTX now.
	* (get_nt_attributes): Ditto.
	* (rel2abssd): #if 0'ed.
	* (set_process_privileges): Moved to
	* (chown): Rewritten.
	* (chmod): Changed call order of the functions
	set_file_attributes() and SetFileAttributesA().
	* (fhandler_base::fstat): Changed check for
	return value of get_file_attributes().
	* (NTReadEA): returns TRUE now, if allow_ntea is unset.
	* (NTWriteEA): returns TRUE now, if allow_ntea is unset.
	* (get_admin_sid): Moved to
	* (symlink_check_one): Changed check for return value
	of get_file_attributes().

Sat Mar  6 18:30:00  Corinna Vinschen  <>

        * (get_world_sid): Rewritten.
        * (world_full_access): Deleted.
        * Use gid 0 as default gid.
        * (read_etc_group): Look for account name of world group.
        * (fhandler_base::open): Call `set_file_attribute'
        only in case of disk file.

Fri Feb 26 00:44:00  Corinna Vinschen  <>

        * (get_file_attribute): Patched incorrect test
        for symlink.
        * (set_file_attribute): ditto.

Sat Jan 30 02:12:00  Corinna Vinschen  <>

        * Special handling for user and/or administrators
        permissions to write (extended) attributes.

Fri Jan 29 02:12:00  Corinna Vinschen  <>

        * Don't allow 513(none) as user or group.

Thu Jan 28 11:00:00  Corinna Vinschen  <>

        * new functions `set_nt_attribute()', `get_nt_attribute()'
        and `set_file_attribute()' with additional parameters `uid' and `gid',
        to support real NT security.
        * winsup.h: Prototype for `set_file_attribute()' with four
        * (mkdir): Calls `set_file_attribute()' now.
        * (chown): ditto.
        * (chmod): ditto, with correct uid/gid.

21 Jan 12:30:00 1999  Corinna Vinschen  <>

        * New function `get_admin_sid()' to get a SID
        of the administrators group or of administrator.
        New functions `sec_user()' and `sec_user_nih()' to get
        SECURITY_ATTRIBUTES with all permissions for the user and
        the administtrator group.
        * shared.h: Prototypes for the above new functions `sec_user()'
        and `sec_user_nih()'.
        * (getsem): Create process semaphore with
        permissions set by `sec_user()'.

More information about the Cygwin-developers mailing list