Using umask instead of explicit mode bits to create files/directories

Robert Dahlem Robert.Dahlem at gmx.net
Tue Dec 5 19:40:20 GMT 2000


Hi,

On Tue, 05 Dec 2000 08:35:55 -0500, David Collier-Brown wrote:

>> Take care! This seems to be 2.0.7 code and dos_mkdir() has changed
>> (and moved :-) since 2.0.7.

>> >  /* We don't need this fix in solaris 2.6. Kind of strange to use
>> >dos_chmod when the mkdir call returns success?!

>> This has been on a looooong thread (compared to such a small piece 
>> of code) and a cure has been found (please don't hope things could 
>> have been becoming less complicated, it took me nearly a whole day 
>> to understand my own patch :-).

>	Ok, what's your current reccomendation, and
>	does it apply to 2.2.0?

I would be happy to provide a patch against 2.2.0 (this will be against
smbd/vfs.c:vfs_mkdir()) but I need some more information because I
don't have access to a system with ACL support:

Is a default ACL possible wich negotiates down what we set with

   umask(0); mkdir("something", 0777);

?

In other words: does stat("something", &sbuf) always return
sbuf.st_mode=0777 or could it return something like 0755 because ACLs
prevent write access for group and others?

The latter case would complicate things a bit. :-)


>> Be aware of the fact that dos_chmod() fiddles around with modes 
>> when we are running with "inherit permissions = yes".

I had another look into the code and my above statement is simply
false: vfs_mkdir() [the former dos_mkdir()] gets called with the mode
unix_mode() has already fiddled around with (and "inherit permissions"
has already used its dark forces :-), so this part does not matter for
our current discussion.

Regards,
        Robert

---------------------------------------------------------------
Robert.Dahlem at gmx.net           Fax +49-69-432647
---------------------------------------------------------------






More information about the samba-technical mailing list