On Wed, 16 Dec 2009, Stephan Müller wrote:

> Hi folks,
> 
> there is a tmp race condition with root privilege at least on Unix systems 
> which we should fix:
> 
> SysDepUnix.cpp:SysGetTmpFile():
> 
> SysSNPrintf(pszFileName, SYS_MAX_PATH - 1, "/tmp/msrv%lx.%lx.tmp", ulThreadID,
>                     ulFileID);
> 
> This call gives you a very predictive file name that is created in /tmp with 
> root privileges. We all do not want that.
> 
> As I have seen that xmail creates a tmp directory in MailRoot, why can't we 
> use that instead as the destination returned by SysGetTmpFile?

On Unix, typically $MAIL_ROOT is set to 0700, and $MAIL_ROOT/tmp would not 
be readable/writeable by filters, which in many setups (like mine) run on 
a non-root UID.
Many tmp files that are "local" to XMail, can be created inside $MAIL_ROOT/tmp
but files that needs to be modified by filter, cannot.




> If the tmp dir in MailRoot does not work, can we use mktemp() or something 
> like that?

It can be made more random, yes, but things like inotify will be able to 
catch those too.



- Davide

_______________________________________________
xmail mailing list
xmail@xmailserver.org
http://xmailserver.org/mailman/listinfo/xmail

Reply via email to