fetchmail-friends
[Top] [All Lists]

[fetchmail] socket closure on error

2002-09-03 04:53:29
If there is a socket error while reading a mail body from an IMAP
server, the smtp socket is not closed. This is because a read error
does not generate any signal.

After query_run() returns, terminate_poll() is called which sends a QUIT
in DATA mode. Since no timeout is set here, fetchmail hangs until the
smtp server quits.

Or, if the protocol is set to auto, the next protocol is tried which
sends a MAIL FROM in DATA mode. Again, fetchmail hangs.

This patch also fixes one more bug related to mailserver_socket.
This variable contains the socket to the IMAP server. However, when a
timeout occurs, the statement:

    mailserver_socket = mailserver_socket_temp;

(where mailserver_socket_temp is -1 most of the time) causes this
information to be lost and the socket is not closed. The solution is
to close mailserver_socket_temp separately.

One (minor?) thing this patch changes is that a timeout now will
return PS_SOCKET and not PS_ERROR. This is to avoid sending a
LOGOUT to the mailserver when a timeout occurs.

Sunil Shetye.

Attachment: fetchmail-5.9.13-socketclose.patch
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>
  • [fetchmail] socket closure on error, Sunil Shetye <=