[Win32utils-devel] File.owned? custom implementation

Heesob Park phasis at gmail.com
Sat Dec 29 05:46:56 UTC 2012


Hi,

2012/12/29 Daniel Berger <djberg96 at gmail.com>
>
> On Tue, Dec 25, 2012 at 8:02 AM, Heesob Park <phasis at gmail.com> wrote:
> > Hi,
> >
> > 2012/12/25 Daniel Berger <djberg96 at gmail.com>
> >>
> >> On Mon, Dec 24, 2012 at 6:42 PM, Heesob Park <phasis at gmail.com> wrote:
> >> > Hi,
> >> >
> >> > 2012/12/25 Daniel Berger <djberg96 at gmail.com>:
> >> >> Hi,
> >> >>
> >> >> I've added what I think is a working File.owned? method to the
> >> >> win32-file-security gem. However, I'm not 100% sure that my method of
> >> >> comparison is correct - I'm comparing sid strings (where I sort of
> >> >> artifically chop the size of one of them) instead of using EqualSid
> >> >> with pointers.
> >> >>
> >> >> Can someone please validate? Just pull the latest git master.
> >> >>
> >> >> Suggestions welcome.
> >> >>
> >> >> Thanks,
> >> >>
> >> >> Dan
> >> >>
> >> >> PS - Heesob, I thought maybe you implemented this already at some
> >> >> point, but I couldn't find it. If you did and I missed it then I'm
> >> >> sorry!
> >> > The File.owned? method works fine on some tests.
> >> >
> >> > I can't remember I have implemented this method.
> >> > But I found some related messages.
> >> >
> >> > http://rubyforge.org/pipermail/win32utils-devel/2008-June/thread.html#1163
> >>
> >> Ok, I just wanted to make sure bit of code wasn't problematic:
> >>
> >> if string_sid == sid.read_string(string_sid.size)
> >>   return_value = true
> >> end
> >>
> >> I'm not sure how to implement File.chown. The links from those 2008
> >> messages seem to be dead. I found this:
> >>
> >> http://www.perlmonks.org/?node_id=70562
> >>
> >> Would that work?
> >>
> > Did you mean you cannot reach the link?
> > http://rubyforge.org/pipermail/win32utils-devel/2008-June/001170.html
> >
>
>
> Thanks for this. It's similar in many ways to what I was already
> working on, so I was definitely using your code as a reference point,
> so that helped.
>
> I think I have a working File.owner and File.chown implementation now
> in github. The only odd thing is that the explorer pop-up properties
> window doesn't seem to reflect the ownership change (in the "details"
> tab), but a "dir /q" on the command line does show it, as does the
> File.owner method. Perhaps I did something wrong?
>
I added SE_CHANGE_NOTIFY_NAME privilege to notify to the explorer.

> Also, I'm not sure what to do with the "group" parameter for the
> File.chown method (to match the Ruby API spec). For now I'm just
> ignoring it. Technically it's not in line with the spec anyway, since
> we're accepting a userid (string) instead of a numeric id for the
> owner. I suppose we could alter that, but I kinda like it that way.
>
I think that "group" parameter should be ignored on Windows.

> Anyway, please feel free to take a look and see what you think.
>

Regards,

Park Heesob


More information about the win32utils-devel mailing list