<feed xmlns='http://www.w3.org/2005/Atom'>
<title>proxsmtp/src, branch 1.10</title>
<subtitle>Proxy for smtp connections filter via script</subtitle>
<link rel='alternate' type='text/html' href='http://thewalter.net/git/cgit.cgi/proxsmtp/'/>
<entry>
<title>proxsmtpd: [PATCH] Close extra file descriptors for filter command</title>
<updated>2011-10-21T13:24:58+00:00</updated>
<author>
<name>Keith Owens</name>
<email>k10@ocs.com.au</email>
</author>
<published>2011-09-28T06:09:59+00:00</published>
<link rel='alternate' type='text/html' href='http://thewalter.net/git/cgit.cgi/proxsmtp/commit/?id=b0c0f832896d49f22ba7d952ddfc628a07218fd6'/>
<id>b0c0f832896d49f22ba7d952ddfc628a07218fd6</id>
<content type='text'>
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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.
</pre>
</div>
</content>
</entry>
<entry>
<title>workaround for race between waitpid(-1) and waitpid(pid)</title>
<updated>2011-09-16T15:55:28+00:00</updated>
<author>
<name>Keith Owens</name>
<email>k10@ocs.com.au</email>
</author>
<published>2011-09-16T15:55:28+00:00</published>
<link rel='alternate' type='text/html' href='http://thewalter.net/git/cgit.cgi/proxsmtp/commit/?id=52747cc1752b8a8e35aee47db2f55d3a3c365ce3'/>
<id>52747cc1752b8a8e35aee47db2f55d3a3c365ce3</id>
<content type='text'>
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".
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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".
</pre>
</div>
</content>
</entry>
<entry>
<title>Reject early before recipient server gets the envelope.</title>
<updated>2011-01-23T21:47:45+00:00</updated>
<author>
<name>Stef Walter</name>
<email>stef@thewalter.net</email>
</author>
<published>2010-11-17T15:17:18+00:00</published>
<link rel='alternate' type='text/html' href='http://thewalter.net/git/cgit.cgi/proxsmtp/commit/?id=78658c88caf7e6374efbbb451159da261e3b0695'/>
<id>78658c88caf7e6374efbbb451159da261e3b0695</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Add a default reject message</title>
<updated>2011-01-23T21:47:45+00:00</updated>
<author>
<name>Stef Walter</name>
<email>stef@thewalter.net</email>
</author>
<published>2010-11-03T23:11:11+00:00</published>
<link rel='alternate' type='text/html' href='http://thewalter.net/git/cgit.cgi/proxsmtp/commit/?id=22162029e12b6c01e0802d743510adc91fd4d796'/>
<id>22162029e12b6c01e0802d743510adc91fd4d796</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Add status to logs for rejection and skipping</title>
<updated>2011-01-23T21:47:45+00:00</updated>
<author>
<name>Stef Walter</name>
<email>stef@thewalter.net</email>
</author>
<published>2010-11-02T16:34:46+00:00</published>
<link rel='alternate' type='text/html' href='http://thewalter.net/git/cgit.cgi/proxsmtp/commit/?id=b8dafc3005f6ceb4e509933068d6a53a40366260'/>
<id>b8dafc3005f6ceb4e509933068d6a53a40366260</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Allow skipping processing data for unauthenticated connections.</title>
<updated>2011-01-23T21:47:45+00:00</updated>
<author>
<name>Stef Walter</name>
<email>stef@thewalter.net</email>
</author>
<published>2010-11-02T16:31:10+00:00</published>
<link rel='alternate' type='text/html' href='http://thewalter.net/git/cgit.cgi/proxsmtp/commit/?id=3ce51cb78093af80e7617135384e5834a181ca64'/>
<id>3ce51cb78093af80e7617135384e5834a181ca64</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Implement reject filter for messages.</title>
<updated>2011-01-23T21:47:45+00:00</updated>
<author>
<name>Stef Walter</name>
<email>stef@thewalter.net</email>
</author>
<published>2010-11-02T14:49:50+00:00</published>
<link rel='alternate' type='text/html' href='http://thewalter.net/git/cgit.cgi/proxsmtp/commit/?id=5e0d08fd4309e37120ec851bfc2c2cb06c776964'/>
<id>5e0d08fd4309e37120ec851bfc2c2cb06c776964</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix uninitialized pid variable.</title>
<updated>2007-10-26T03:43:14+00:00</updated>
<author>
<name>Stef Walter</name>
<email>stef@memberwebs.com</email>
</author>
<published>2007-10-26T03:43:14+00:00</published>
<link rel='alternate' type='text/html' href='http://thewalter.net/git/cgit.cgi/proxsmtp/commit/?id=f81457cf835cc6a1c79f104ea80bf6e50bf7e2ac'/>
<id>f81457cf835cc6a1c79f104ea80bf6e50bf7e2ac</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Use 'Stef' instead of 'Nate'</title>
<updated>2007-05-28T19:34:01+00:00</updated>
<author>
<name>Stef Walter</name>
<email>stef@memberwebs.com</email>
</author>
<published>2007-05-28T19:34:01+00:00</published>
<link rel='alternate' type='text/html' href='http://thewalter.net/git/cgit.cgi/proxsmtp/commit/?id=4093e901218ff6293aa9543f6468b75edc23c9f1'/>
<id>4093e901218ff6293aa9543f6468b75edc23c9f1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix version string.</title>
<updated>2007-03-20T00:08:10+00:00</updated>
<author>
<name>Stef Walter</name>
<email>stef@memberwebs.com</email>
</author>
<published>2007-03-20T00:08:10+00:00</published>
<link rel='alternate' type='text/html' href='http://thewalter.net/git/cgit.cgi/proxsmtp/commit/?id=cc384c282d16ee733d2971c3ecf16a866babeeec'/>
<id>cc384c282d16ee733d2971c3ecf16a866babeeec</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
