[Dovecot] plugin problem

Lars Stavholm stava at telcotec.se
Sun Sep 30 19:00:08 EEST 2007


Timo Sirainen wrote:
> On Sun, 2007-09-30 at 09:30 +0200, Lars Stavholm wrote:
>> Another (mildly stupid maybe) question: why the fork()
>> in the original dspam plugin? Seems to me that the fork()
>> + waitpid() doesn't really allow for any advantage over
>> a simple popen() and read the output? I have a sneaky
>> feeling that I'm missing something vital here.
> 
> popen() uses FILE streams, which I at least try to avoid. For example in
> some systems (Solaris IIRC) they were limited to 256 first file
> descriptors.
> 
> It also executes everything through /bin/sh -c, which is pointless if
> you're not running a script and possibly dangerous if you're not
> escaping parameters correctly.

I hear you.
What would you suggest instead?
pipe() + fork() + execl()?
/L



More information about the dovecot mailing list