summaryrefslogtreecommitdiff
path: root/src/proxsmtpd.c
AgeCommit message (Collapse)Author
2011-10-21proxsmtpd: [PATCH] Close extra file descriptors for filter commandKeith Owens
Short form: Passing extra file descriptors to the filter command can prevent it from detecting EOF or EPIPE. Result, dead filter commands that never terminate. Close everything except fd 0, 1, 2 before running the filter command. Long form: At the point that the filter command is forked and executed, proxsmtd may have multiple children with multiple pipes open. fork() bumps the reference count on all the file descriptors that are open at that moment. When the parent closes its part of the pipe, the pipe fd may or may not be removed from the system, depending on how many children have accidentally inherited that pipe. The child code closes fd 0, 1 and 2, calls dup2() to map the pipes to 0, 1 and 2 then runs. If another child has accidentally bumped the reference count on the pipes to this child then fd 0 can have multiple writers. This prevents the filter from detecting EOF or EPIPE when proxsmtpd closes the pipe to this particular child. This bug is particularly evident if the filter program does another fork and uses more pipes to communicate with its own child. awk does this as a matter of course. The result is a dangling filter command just sitting there waiting for input and not detecting that stdin has been closed. The dangling commands are owned by pid 1 rather than proxsmtpd. The only way to get rid of them is to manually kill them.
2011-09-16workaround for race between waitpid(-1) and waitpid(pid)Keith Owens
Sometimes waitpid(-1) in cb_check_data reaps a child that has just terminated, before waitpid(pid) in wait_process can reap it. Linux waitpid(pid,,WNOHANG) may not return an error if the child has already terminated, which results in wait_process looping waiting for the child which has already terminated. The symptom is a spurious "timeout waiting for filter command to exit".
2011-01-23Reject early before recipient server gets the envelope.Stef Walter
2011-01-23Add a default reject messageStef Walter
2011-01-23Add status to logs for rejection and skippingStef Walter
2011-01-23Allow skipping processing data for unauthenticated connections.Stef Walter
2011-01-23Implement reject filter for messages.Stef Walter
2007-10-26Fix uninitialized pid variable.Stef Walter
2007-05-28Use 'Stef' instead of 'Nate'Stef Walter
2007-03-20Fix version string.Stef Walter
2006-11-14Add header option back into proxsmtpStef Walter
2006-09-27 - On FreeBSD fix problem where stderr wasn't processed when filter Stef Walter
didn't read stdin.
2006-08-30Bring in some changes from ClamSMTPStef Walter
2006-07-13Another fix for waiting on processes.Stef Walter
2005-12-08Fix problem when waiting for processes.Stef Walter
2005-10-19Fixes from Loic Le LoarerStef Walter
2005-09-28Fixes from Loic Le Loarer <loic.le-loarer@polytechnique.org>Stef Walter
2005-09-08Bring some Solaris changes over from ClamSMTP.Stef Walter
2005-03-20Sync with clamsmtp changes.Stef Walter
2004-10-30Supress errors when waiting for a process that's already gone.Stef Walter
2004-09-24Debugged, which resulted in tons of fixes.Stef Walter
2004-09-20Better processing of result messagesStef Walter
2004-09-20Debug fixesStef Walter
2004-09-14Initial buildStef Walter
2004-09-13Initial fork from clamsmtpStef Walter