diff -Naur fetchmail-5.9.14.orig/sink.c fetchmail-5.9.14/sink.c --- fetchmail-5.9.14.orig/sink.c Mon Sep 9 11:22:49 2002 +++ fetchmail-5.9.14/sink.c Mon Sep 9 12:03:31 2002 @@ -358,6 +358,10 @@ static int handle_smtp_report(struct query *ctl, struct msgblk *msg) /* handle SMTP errors based on the content of SMTP_response */ /* return of PS_REFUSED deletes mail from the server; PS_TRANSIENT keeps it */ +/* Don't call this to handle response to RCPT TO: address; + * RSET discards the message body and it doesn't get sent to the + * valid recipients. + */ { int smtperr = atoi(smtp_response); char *responses[1]; @@ -365,17 +369,9 @@ xalloca(responses[0], char *, strlen(smtp_response)+1); strcpy(responses[0], smtp_response); -#ifdef __UNUSED__ - /* - * Don't do this! It can really mess you up if, for example, you're - * reporting an error with a single RCPT TO address among several; - * RSET discards the message body and it doesn't get sent to the - * valid recipients. - */ SMTP_rset(ctl->smtp_socket); /* stay on the safe side */ if (outlevel >= O_DEBUG) report(stdout, GT_("Saved error is still %d\n"), smtperr); -#endif /* __UNUSED */ /* * Note: send_bouncemail message strings are not made subject @@ -458,7 +454,7 @@ #ifdef __DONT_FEED_THE_SPAMMERS__ if (run.bouncemail) send_bouncemail(ctl, msg, XMIT_ACCEPT, - "Invalid address in MAIL FROM/RCPT TO (SMTP error 553).\r\n", + "Invalid address in MAIL FROM (SMTP error 553).\r\n", 1, responses); #endif /* __DONT_FEED_THE_SPAMMERS__ */ return(PS_REFUSED); @@ -499,12 +495,16 @@ { int smtperr = atoi(smtp_response); +#ifdef __UNUSED__ + /* should responses to RCPT TO: be tested from spam? The antispam + * option is not really meant for handling these */ if (str_find(&ctl->antispam, smtperr)) { if (run.spambounce) return(PS_SUCCESS); return(PS_REFUSED); } +#endif /* __UNUSED__ */ if (smtperr >= 400) report(stderr, GT_("%cMTP error: %s\n"), @@ -827,10 +827,7 @@ if (SMTP_from(ctl->smtp_socket, ap, options) != SM_OK) { - int err = handle_smtp_report(ctl, msg); - - SMTP_rset(ctl->smtp_socket); /* stay on the safe side */ - return(err); + return(handle_smtp_report(ctl, msg)); } /* @@ -962,7 +959,6 @@ */ if (SMTP_data(ctl->smtp_socket) != SM_OK) { - SMTP_rset(ctl->smtp_socket); /* stay on the safe side */ return(handle_smtp_report(ctl, msg)); } @@ -1277,13 +1273,11 @@ { if (handle_smtp_report(ctl, msg) != PS_REFUSED) { - SMTP_rset(ctl->smtp_socket); /* stay on the safe side */ return(FALSE); } else { report(stderr, GT_("SMTP listener refused delivery\n")); - SMTP_rset(ctl->smtp_socket); /* stay on the safe side */ return(TRUE); } }