aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1998-07-20 17:48:01 +0000
committerEric S. Raymond <esr@thyrsus.com>1998-07-20 17:48:01 +0000
commit2b4651b3546053c71d5566ab2f8b943a43de2354 (patch)
treeda458c2e6d4d9b469e754c83d4e28fc1600efd3f
parentfe13f5844212ba65b0e172ac4087136a36240e44 (diff)
downloadfetchmail-2b4651b3546053c71d5566ab2f8b943a43de2354.tar.gz
fetchmail-2b4651b3546053c71d5566ab2f8b943a43de2354.tar.bz2
fetchmail-2b4651b3546053c71d5566ab2f8b943a43de2354.zip
Can specify multiple spam-blocks now.
svn path=/trunk/; revision=1997
-rw-r--r--NEWS1
-rw-r--r--conf.c9
-rw-r--r--driver.c2
-rw-r--r--fetchmail.c19
-rw-r--r--fetchmail.h2
-rw-r--r--fetchmail.man11
-rw-r--r--options.c14
-rw-r--r--rcfile_y.y14
8 files changed, 55 insertions, 17 deletions
diff --git a/NEWS b/NEWS
index d3e52286..4fd34e59 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ fetchmail-4.5.3 ():
of run, and then only if they'll actually be needed later for multidrop
checking or fetching Kerberos tickets. This change eliminates many
gethostbyname calls.
+* It's now possible to specify multiple spam-block responses as a list.
* 1.1 version of fetchmailconf.
Note: the DNS-usage change might conceivably break your configuration
diff --git a/conf.c b/conf.c
index 7a4b7b4b..b98ac1d0 100644
--- a/conf.c
+++ b/conf.c
@@ -270,7 +270,14 @@ void dump_config(struct runctl *runp, struct query *querylist)
numdump("expunge", ctl->expunge);
listdump("smtphunt", ctl->smtphunt);
stringdump("smtpaddress", ctl->smtpaddress);
- numdump("antispam", ctl->antispam);
+ fprintf(stdout, "'antispam':[");
+ for (idp = ctl->antispam; idp; idp = idp->next)
+ {
+ fprintf(stdout, "%d", idp->val.status.num);
+ if (idp->next)
+ fputs(", ", stdout);
+ }
+ fputs("],\n", stdout);
listdump("mailboxes", ctl->mailboxes);
indent('}');
diff --git a/driver.c b/driver.c
index a6c79b05..425ffd5f 100644
--- a/driver.c
+++ b/driver.c
@@ -1193,7 +1193,7 @@ int num; /* index of message */
{
int smtperr = atoi(smtp_response);
- if (smtperr == ctl->antispam)
+ if (str_find(&ctl->antispam, smtperr))
{
/*
* SMTP listener explicitly refuses to deliver mail
diff --git a/fetchmail.c b/fetchmail.c
index 63ad9999..f495d16b 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -678,6 +678,7 @@ static void optmerge(struct query *h2, struct query *h1, int force)
LIST_MERGE(h2->localnames, h1->localnames);
LIST_MERGE(h2->mailboxes, h1->mailboxes);
LIST_MERGE(h2->smtphunt, h1->smtphunt);
+ LIST_MERGE(h2->antispam, h1->antispam);
#undef LIST_MERGE
#define FLAG_MERGE(fld) if (force ? !!h1->fld : !h2->fld) h2->fld = h1->fld
@@ -711,7 +712,6 @@ static void optmerge(struct query *h2, struct query *h1, int force)
FLAG_MERGE(password);
FLAG_MERGE(mda);
FLAG_MERGE(smtpaddress);
- FLAG_MERGE(antispam);
FLAG_MERGE(preconnect);
FLAG_MERGE(keep);
@@ -739,7 +739,7 @@ static int load_params(int argc, char **argv, int optind)
memset(&def_opts, '\0', sizeof(struct query));
def_opts.smtp_socket = -1;
def_opts.smtpaddress = (char *)0;
- def_opts.antispam = 571;
+ save_str(&def_opts.antispam, (char *)NULL, 0)->val.status.num = 571;
def_opts.server.protocol = P_AUTO;
def_opts.server.timeout = CLIENT_TIMEOUT;
@@ -1297,10 +1297,19 @@ void dump_params (struct runctl *runp, struct query *querylist, flag implicit)
printf(" Host part of MAIL FROM line will be %s\n",
ctl->smtpaddress);
}
- if (ctl->server.protocol != P_ETRN) {
- if (ctl->antispam != -1)
- printf(" Listener SMTP reponse %d will be treated as a spam block\n",
+ if (ctl->server.protocol != P_ETRN)
+ {
+ if (ctl->antispam != (struct idlist *)NULL)
+ {
+ struct idlist *idp;
+
+ printf(" Recognized listener spam block responses are:",
ctl->antispam);
+ for (idp = ctl->antispam; idp; idp =
+idp->next)
+ printf(" %d", idp->val.status.num);
+ printf("\n");
+ }
else if (outlevel == O_VERBOSE)
printf(" Spam-blocking disabled\n");
}
diff --git a/fetchmail.h b/fetchmail.h
index cfb729a7..acbf14fc 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -174,7 +174,7 @@ struct query
struct idlist *smtphunt; /* list of SMTP hosts to try forwarding to */
char *smtphost; /* actual SMTP host to point to */
char *smtpaddress; /* address we want to force in the delivery messages */
- int antispam; /* listener's antispam response */
+ struct idlist *antispam; /* list of listener's antispam response */
char *mda; /* local MDA to pass mail to */
char *preconnect; /* pre-connection command to execute */
char *postconnect; /* post-connection command to execute */
diff --git a/fetchmail.man b/fetchmail.man
index ed24bdc9..56000f6d 100644
--- a/fetchmail.man
+++ b/fetchmail.man
@@ -231,11 +231,12 @@ Specify the domain to be put in RCPT TO lines shipped to SMTP. The
name of the SMTP server (as specified by --smtphost, or defaulted to
"localhost") is used when this is not specified.
.TP
-.B \-Z nnn, --antispam nnn
+.B \-Z nnn, --antispam nnn[,nnn[,nnn...]]
(Keyword: antispam)
-Specifies the numeric SMTP error that is to be interpreted as a
-spam-block response from the listener. A value of -1 disables
-this option.
+Specifies the list of numeric SMTP errors that are to be interpreted
+as a spam-block response from the listener. A value of -1 disables
+this option. For the command-line option, the list values should
+be comma-separated.
.TP
.B \-m, \--mda
(Keyword: mda)
@@ -927,7 +928,7 @@ smtpaddress -D T{
Specify the domain to be put in RCPT TO lines
T}
antispam -Z T{
-Specify what SMTP return is interpreted as a spam-policy block
+Specify what SMTP returns are interpreted as spam-policy blocks
T}
mda -m T{
Specify MDA for local delivery
diff --git a/options.c b/options.c
index 892e0f3e..94595e30 100644
--- a/options.c
+++ b/options.c
@@ -426,8 +426,16 @@ struct query *ctl; /* option record to be initialized */
break;
case 'Z':
case LA_ANTISPAM:
- c = xatoi(optarg, &errflag);
- ctl->antispam = NUM_VALUE(c);
+ strcpy(buf, optarg);
+ cp = strtok(buf, ",");
+ do {
+ struct idlist *idp = save_str(&ctl->antispam, NULL, 0);;
+
+ idp->val.status.num = atoi(cp);
+ } while
+ ((cp = strtok((char *)NULL, ",")));
+ free(buf);
+ break;
case 'b':
case LA_BATCHLIMIT:
c = xatoi(optarg, &errflag);
@@ -543,7 +551,7 @@ struct query *ctl; /* option record to be initialized */
#endif /* NET_SECURITY */
fputs(" -S, --smtphost set SMTP forwarding host\n", stderr);
fputs(" -D, --smtpaddress set SMTP delivery domain to use\n", stderr);
- fputs(" -Z, --antispam, set antispam response value\n", stderr);
+ fputs(" -Z, --antispam, set antispam response values\n", stderr);
fputs(" -b, --batchlimit set batch limit for SMTP connections\n", stderr);
fputs(" -B, --fetchlimit set fetch limit for server connections\n", stderr);
fputs(" -e, --expunge set max deletions between expunges\n", stderr);
diff --git a/rcfile_y.y b/rcfile_y.y
index d6930b2a..d3af58b3 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -261,6 +261,18 @@ smtp_list : STRING {save_str(&current.smtphunt, $1,TRUE);}
| smtp_list STRING {save_str(&current.smtphunt, $2,TRUE);}
;
+num_list : NUMBER {
+ struct idlist *id;
+ id=save_str(&current.antispam,0,0);
+ id->val.status.num = $1;
+ }
+ | num_list NUMBER {
+ struct idlist *id;
+ id=save_str(&current.antispam,0,0);
+ id->val.status.num = $2;
+ }
+ ;
+
user_option : TO localnames HERE
| TO localnames
| IS localnames HERE
@@ -271,7 +283,7 @@ user_option : TO localnames HERE
| FOLDER folder_list
| SMTPHOST smtp_list
| SMTPADDRESS STRING {current.smtpaddress = xstrdup($2);}
- | SPAMRESPONSE NUMBER {current.antispam = $2;}
+ | SPAMRESPONSE num_list
| MDA STRING {current.mda = xstrdup($2);}
| PRECONNECT STRING {current.preconnect = xstrdup($2);}
| POSTCONNECT STRING {current.postconnect = xstrdup($2);}