Problem with sticky bit and free space

Jeremy Allison jallison at cthulhu.engr.sgi.com
Fri Oct 22 21:54:40 GMT 1999


Cristiano Reis Monteiro wrote:

> Samba is not setting the sticky bit anymore !!!
> 
> I have a share that look like this:
> 
> [publico]
>         comment = Arquivos publicos
>         path = /home/publicos
>         public = yes
>         writable = yes
>         force directory mode = 1777
>         create mask = 0664
> 
> With samba 1.9.x it was ok, the directories was being created with the
> correct permission (drwxrwxrwt), but since I instaled Samba 2.0.3 I
> couldn't make it work again, every new directory is created with
> drwxrwxrwx, I've tried nearly every possible configuration unsuccesfully.
> I've upgraded to 2.0.5a too, which couldn't solve my problem :( What is
> going wrong ?

Ok, I've taken a look at this and the Samba code looks
correct. I debugged the code path creating a directory
and it is indeed calling mkdir(name, 01777). 

The fun part comes here in the IRIX man page for mkdir.

     mkdir creates a new directory with the name path. The mode of the new
     directory is initialized from mode (see chmod(2) for values of mode].
     The protection part of mode is modified by the process's mode mask (see
     umask(2)).  *****The S_ISGID, S_ISUID, and S_ISVTX bits are silently
deleted
     from mode.****** <--- My emphasis !

I then looked in the POSIX spec for mkdir() which states :

"The file permission bits of the mode argument are modified
by the file creation mask of the process (see 5.3.3). When bits
in mode other than the file permission bits are set, the meaning
of these additional bits is implementation defined."

So IRIX is conformant and other POSIX OSen probably do the
same thing. I will need to add a chown call after the mkdir
in order to ensure the bits get set correctly.

Expect this after I get back from vacation.

Regards,

	Jeremy Allison,
	Samba Team.

-- 
--------------------------------------------------------
Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.
--------------------------------------------------------


More information about the samba mailing list