permission upgrade during O_TRUNC

Steve Hardy s.a.hardy at connectux.com
Wed Jan 8 09:37:00 GMT 2003


Yeah I thought about implementing it the way it's in CVS now but didn't dare
touch your code :P, although I just found another instance of attributes
changing.... the whole story goes for READONLY as well ...

hmm let me make a table

- H -> H
- S -> S
- R -> R
- RH -> RH
- SH -> SH
H * -> H
S * -> S
R * -> R

So it seems you can only upgrade the attributes if NONE of the original
attributes were set, and if so, you take all of the new attributes.
Currently the code always takes the new attributes if you're upgrading
system or hidden so you'd get

S H -> H
H S -> S
and worse:
S HR -> HR
H SR -> SR

It probably doesn't make much of a difference but hey, you never know :)
Makes the code easier too 'cause you get

if(old_dos_mode == 0 && new_dos_mode != 0)
	*returned_mode = new_dos_mode

Which is even easier (yay!). Sorry for the part misinformation in previous
posts :)

grtz,
	Steve

> -----Oorspronkelijk bericht-----
> Van: samba-technical-admin at lists.samba.org
> [mailto:samba-technical-admin at lists.samba.org]Namens jra at dp.samba.org
> Verzonden: Wednesday, January 08, 2003 3:10 AM
> Aan: steve at griffin.sio2.nl
> CC: samba-technical at samba.org
> Onderwerp: Re: permission upgrade during O_TRUNC
>
>
> On Tue, Jan 07, 2003 at 10:53:41AM +0100, steve at griffin.sio2.nl wrote:
> > Hey there, I posted a quick fix for a problem I found with
> all samba's up
> > to 2.2.7a on the general samba list, which describes the following
> > problem:
> >
> > In Windows, if you create a file with NORMAL attributes and
> ALWAYS_CREATE,
> > close the file and then re-create it with, say, HIDDEN and
> ALWAYS_CREATE,
> > the file *should* be upgraded to HIDDEN. The other way around, ie.
> > starting with HIDDEN and re-creating with NORMAL should
> keep the file as
> > HIDDEN. Currently, samba always keep the original
> attributes. This causes
> > windows to incorrectly store hidden and system files from
> in a roaming
> > profile which gets you that stupid popping-up Desktop.ini
> in new profiles
> > after the second login (because the files are not hidden on
> the profile
> > directory). Why windows opens the files as non-hidden first
> is unknown to
> > me :) Anyways, here is a patch that fixes it. I have tried
> my best to make
> > it as clean as possible but as I know little of samba
> internals it may be
> > wrong ...
> >
> > This works for me, and stops Desktop.ini appearing all over
> the place. I
> > haven't found any problems with it yet.
>
> Thanks for this - I didn't apply exactly this patch but it inspired me
> to write something I believe is correct. I applied it to HEAD and 3.0,
> and will back-port to 2.2.x.
>
> Thanks once again !
>
> Jeremy.
>
> PS. Andrew Bartlett - we now pass the torture test OPEN #9 when map
> hidden and map system are set :-).




More information about the samba-technical mailing list