aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.in2
-rw-r--r--driver.c25
-rw-r--r--fetchmail.h2
-rw-r--r--smtp.c3
4 files changed, 27 insertions, 5 deletions
diff --git a/Makefile.in b/Makefile.in
index ca672d9e..159447cd 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -4,7 +4,7 @@
# So just uncomment all the lines marked QNX.
VERS=2.1
-PL=0
+PL=1
# Ultrix 2.2 make doesn't expand the value of VPATH.
srcdir = @srcdir@
diff --git a/driver.c b/driver.c
index 70192ac5..c28098b2 100644
--- a/driver.c
+++ b/driver.c
@@ -547,10 +547,25 @@ struct query *ctl; /* query control record */
* ID. This won't affect replies, which use the header
* From address anyway.
*/
- if (!fromhdr || !(ap = nxtaddr(fromhdr))
- || SMTP_from(sinkfp, ap) != SM_OK)
+ if (!fromhdr || !(ap = nxtaddr(fromhdr)))
+ {
if (SMTP_from(sinkfp, user) != SM_OK)
return(PS_SMTP); /* should never happen */
+ }
+ else if (SMTP_from(sinkfp, ap) != SM_OK)
+ if (smtp_response == 571)
+ {
+ /*
+ * SMTP listener explicitly refuses to deliver
+ * mail coming from this address, probably due
+ * to an anti-spam domain exclusion. Respect
+ * this.
+ */
+ sinkfp = (FILE *)NULL;
+ goto skiptext;
+ }
+ else if (SMTP_from(sinkfp, user) != SM_OK)
+ return(PS_SMTP); /* should never happen */
/* now list the recipient addressees */
for (idp = xmit_names; idp; idp = idp->next)
@@ -574,6 +589,8 @@ struct query *ctl; /* query control record */
SMTP_data(sinkfp);
if (outlevel == O_VERBOSE)
fputs("SMTP> ", stderr);
+
+ skiptext:;
}
/* change continuation markers back to regular newlines */
@@ -594,7 +611,7 @@ struct query *ctl; /* query control record */
/* write all the headers */
if (ctl->mda[0])
n = write(mboxfd,headers,oldlen);
- else
+ else if (sinkfp)
n = SockWrite(headers, oldlen, sinkfp);
if (n < 0)
@@ -676,7 +693,7 @@ struct query *ctl; /* query control record */
/* ship out the text line */
if (ctl->mda[0])
n = write(mboxfd,bufp,strlen(bufp));
- else
+ else if (sinkfp)
n = SockWrite(bufp, strlen(bufp), sinkfp);
if (!ctl->mda[0])
diff --git a/fetchmail.h b/fetchmail.h
index e524e6af..8c68e1a0 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -156,6 +156,8 @@ extern int linelimit; /* limit # lines retrieved per site */
extern int versioninfo; /* emit only version info */
extern char *user; /* name of invoking user */
+extern int smtp_response; /* numeric value of SMTP response code */
+
/* prototypes for globally callable functions */
#if defined(HAVE_STDARG_H)
void gen_send (FILE *sockfp, char *, ... );
diff --git a/smtp.c b/smtp.c
index 77ced235..ea75560c 100644
--- a/smtp.c
+++ b/smtp.c
@@ -18,6 +18,8 @@
#include "fetchmail.h"
#include "smtp.h"
+int smtp_response; /* numeric value of SMTP response code */
+
int SMTP_helo(FILE *sockfp,char *host)
/* send a "HELO" message to the SMTP listener */
{
@@ -112,6 +114,7 @@ static int SMTP_check(FILE *sockfp)
buf[n] = '\0';
if (outlevel == O_VERBOSE)
fprintf(stderr, "SMTP< %s\n", buf);
+ smtp_response = atoi(buf);
if ((buf[0] == '1' || buf[0] == '2' || buf[0] == '3') && buf[3] == ' ')
return SM_OK;
else if (buf[3] != '-')