[Dovecot] plugin problem

Timo Sirainen tss at iki.fi
Sun Sep 30 20:13:41 EEST 2007


On Sun, 2007-09-30 at 18:00 +0200, Lars Stavholm wrote:
> 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()?

Yes. Or execv().

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://dovecot.org/pipermail/dovecot/attachments/20070930/9bd56b9d/attachment.bin 


More information about the dovecot mailing list