[PATCH] Fix problems of getting/setting ACL on Win32 (Preserve Cygwin file mode)

90 views
Skip to first unread message

Ken Takata

unread,
Aug 29, 2012, 7:33:25 AM8/29/12
to vim...@googlegroups.com
Hi all,

I found that the current implementation of mch_get_acl() and mch_set_acl()
in os_win32.c does not work well. There are some causes:

1. mch_get_acl() tries to retrieve all security information (Owner, Group,
DACL and SACL), but it may fail because of lack of privileges.
SE_SECURITY_NAME privilege must be held and must be enabled to retrieve SACL.
2. Setting Owner or Group may also fail if the caller doesn't have enough
privileges.
3. mch_[gs]et_acl() functions don't support multibyte characters at all.

I wrote a patch to fix these problems.
(Also available at https://gist.github.com/3489193 )

This patch may also fix a problem of Cygwin file modes.
(e.g. https://groups.google.com/d/topic/vim_dev/gEQe2esLPAc/discussion )
Even if 'backupcopy' is set to 'auto' or 'no', Cygwin file modes will be
preserved. (Cygwin file modes are stored as DACL.)

Best regards,
Ken Takata

acl-fix.patch

Bram Moolenaar

unread,
Aug 30, 2012, 4:58:41 PM8/30/12
to Ken Takata, vim...@googlegroups.com
Thanks! I'll add a note in the todo list.

--
FATHER: One day, lad, all this will be yours ...
PRINCE: What - the curtains?
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Ken Takata

unread,
Aug 31, 2012, 7:33:24 AM8/31/12
to vim...@googlegroups.com, Ken Takata
Hi Bram,

2012/08/31 Fri 5:58:30 UTC+9 Bram Moolenaar:


> Thanks! I'll add a note in the todo list.

I have updated the patch. (Also available at the same gist URL.)
Now, the inheritance of a DACL is preserved. Maybe it is useful for
non-cygwin files.
I hope this patch and my symlink patch (https://groups.google.com/d/msg/vim_dev/qF8Y3xtUP-w/opEIDRL94qoJ)
make ':set backupcopy=auto' option more useful.

--
Best regards,
Ken Takata

acl-fix.patch

Ken Takata

unread,
Dec 29, 2012, 11:22:22 AM12/29/12
to vim...@googlegroups.com, Ken Takata
Hi,

I wrote an additional patch to support ACL when compiled with MinGW.
(Current MinGW and Cygwin have the ACL stuff, but I don't know when
they support it.)

Regards,
Ken Takata

acl-mingw.patch

Bram Moolenaar

unread,
Dec 29, 2012, 4:35:40 PM12/29/12
to Ken Takata, vim...@googlegroups.com
Thanks. I'm seriously running behind in including patches, I'm
afraid....

--
"You mean there really is an answer?"
"Yes! But you're not going to like it!"
"Oh do please tell us!"
"You're really not going to like it!"
"but we MUST know - tell us"
"Alright, the answer is...."
"yes..."
"... is ..."
"yes... come on!"
"is 42!"
(Douglas Adams - The Hitchhiker's Guide to the Galaxy)
Reply all
Reply to author
Forward
0 new messages