From bd2e568da48acbae7e0b43c48226541220b85340 Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Mon, 25 May 2009 12:35:54 +0000 Subject: Enforce minimum recommended SMTP timeouts, apply to EHLO/LHLO as well. Short timeouts could cause fetchmail to not wait long enough for the "250 Ok" after shipping a long message, particularly with synchronous mailers and extensive spam filtering. This caused fetchmail to re-fetch long messages. While the actual fix is making sure that the timeout is no shorter than the time the SMTP server takes to process the message, we now enforce the minimum RFC-5321 recommended timeouts even if the user configures a lower timeout. This is to fix Berlios Bug #10972, reported by Viktor Binzberger. NOTE: it is untested whether we will properly delete the message from the POP3/IMAP server or mark it as seen, as the upstream server may close the connection sooner. svn path=/branches/BRANCH_6-3/; revision=5338 --- sink.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sink.c') diff --git a/sink.c b/sink.c index d6e4f430..78630a02 100644 --- a/sink.c +++ b/sink.c @@ -158,7 +158,7 @@ int smtp_open(struct query *ctl) } /* first, probe for ESMTP */ - if (SMTP_ok(ctl->smtp_socket, ctl->smtphostmode) == SM_OK && + if (SMTP_ok(ctl->smtp_socket, ctl->smtphostmode, TIMEOUT_STARTSMTP) == SM_OK && SMTP_ehlo(ctl->smtp_socket, ctl->smtphostmode, id_me, ctl->server.esmtp_name, ctl->server.esmtp_password, &ctl->server.esmtp_options) == SM_OK) @@ -186,7 +186,7 @@ int smtp_open(struct query *ctl) } } - if (SMTP_ok(ctl->smtp_socket, ctl->smtphostmode) == SM_OK && + if (SMTP_ok(ctl->smtp_socket, ctl->smtphostmode, TIMEOUT_STARTSMTP) == SM_OK && SMTP_helo(ctl->smtp_socket, ctl->smtphostmode, id_me) == SM_OK) break; /* success */ @@ -282,7 +282,7 @@ static int send_bouncemail(struct query *ctl, struct msgblk *msg, if ((sock = SockOpen("localhost", SMTP_PORT, NULL, &ai1)) == -1) return(FALSE); - if (SMTP_ok(sock, SMTP_MODE) != SM_OK) + if (SMTP_ok(sock, SMTP_MODE, TIMEOUT_STARTSMTP) != SM_OK) { SockClose(sock); return FALSE; @@ -1422,7 +1422,7 @@ int close_sink(struct query *ctl, struct msgblk *msg, flag forward) { if (lmtp_responses == 0) { - SMTP_ok(ctl->smtp_socket, ctl->smtphostmode); + SMTP_ok(ctl->smtp_socket, ctl->smtphostmode, TIMEOUT_EOM); /* * According to RFC2033, 503 is the only legal response @@ -1455,7 +1455,7 @@ int close_sink(struct query *ctl, struct msgblk *msg, flag forward) responses = (char **)xmalloc(sizeof(char *) * lmtp_responses); for (errors = i = 0; i < lmtp_responses; i++) { - if ((smtp_err = SMTP_ok(ctl->smtp_socket, ctl->smtphostmode)) + if ((smtp_err = SMTP_ok(ctl->smtp_socket, ctl->smtphostmode, TIMEOUT_EOM)) == SM_UNRECOVERABLE) { smtp_close(ctl, 0); -- cgit v1.2.3