Bug#280282: exim4-daemon-heavy: files in /var/spool/exim4/scan are mode 666

Roderick Schertler roderick at argon.org
Tue Feb 14 19:50:28 UTC 2006


On Tue, 14 Feb 2006 16:46:21 +0100, Marc Haber <mh+debian-packages at zugschlus.de> said:
>
> That sounds, however, reasonably easy fixable. I do not have too much
> clue, but would it be enough to do something like
> mode_t umask_save;
> umask_save=umask(077);
> fopen();
> umask(umask_save);
> for all fopen calls found in demime.c?

Yes, that is direct and I believe it would work.  I think it isn't just
demime.c which needs fixing, though.  Eg, in spool_mbox.c, line 59.

    /* open [message_id].eml file for writing */
    (void)string_format(mbox_path, 1024, "%s/scan/%s/%s.eml", spool_directory, message_id, message_id);
    mbox_file = Ufopen(mbox_path,"wb");

I think a wrapper which accepted a mode argument would be a better
overall solution.  Some parts of the code would even be simplified
(such as daemon.c, which does fopen()/fchmod() on the PID file -- it
would even be made safer because there's a race condition in the code
currently there).

src/buildconfig.c:new = fopen("config.h", "wb");
src/daemon.c:  f = Ufopen(pid_file_path, "wb");
src/demime.c:  *f = fopen(CS file_name,"wb+");
src/malware.c:      scanner_record = fopen(CS file_name,"wb");
src/mime.c:    f = fopen(CS filename,"wb+");
src/mime.c:    f = fopen(CS fname,"wb+");
src/mime.c:    f = fopen(CS filename,"wb+");
src/pcre/dftables.c:f = fopen(argv[1], "wb");
src/pcre/pcretest.c:  outfile = fopen(argv[op+1], "wb");
src/pcre/pcretest.c:      FILE *f = fopen((char *)to_file, "wb");
src/spool_mbox.c:    mbox_file = Ufopen(mbox_path,"wb");

-- 
Roderick Schertler
roderick at argon.org




More information about the Pkg-exim4-maintainers mailing list