Re: [exim-dev] fopen(), umask, and file permissions

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Philip Hazel
Date:  
À: Marc Haber
CC: exim-dev
Sujet: Re: [exim-dev] fopen(), umask, and file permissions
On Thu, 16 Feb 2006, Marc Haber wrote:

> Yes, but I don't see any advantage in having it run with umask 0.
> Wouldn't it be possible to have it run with umask 077 or even 777,
> forcing it to fchmod files after creation to something useable?


Yes, of course it would. I suspect I just didn't fully understand the
way things worked when I wrote the code, not being a Unix guru. It has
been this way since at least Exim 1.62 (the oldest source I still have,
dated 1997). Of course, the content scanning code is much more recent.
Aha! An old ChangeLog tells me the change was made for release 0.51, but
it isn't very helpful:

7. Set Exim's umask to 0 so that the modes it specifies for files
actually work...

And further back, at release 0.26, I find:

4. Make sure spool files have the exim gid and the correct group mode
when an exim uid is set.

(Exim uids were optional back then.) It doesn't really explain much, but
it shows things have been hacked around.

I don't like 777[*] because I might overlook something, thereby causing
a disaster. 077 is probably OK, because Exim itself only relies on the
owner field; the group field is often set for eximon etc, but not for
Exim itself.

------------
[*] Hmm. I wonder, I wonder, I wonder if in my ignorance back then I
thought that umask(0) meant umask(777). No, surely I wasn't *that*
stupid?

-- 
Philip Hazel            University of Cambridge Computing Service
Get the Exim 4 book:    http://www.uit.co.uk/exim-book