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
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('}');
{
int smtperr = atoi(smtp_response);
- if (smtperr == ctl->antispam)
+ if (str_find(&ctl->antispam, smtperr))
{
/*
* SMTP listener explicitly refuses to deliver mail
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
FLAG_MERGE(password);
FLAG_MERGE(mda);
FLAG_MERGE(smtpaddress);
- FLAG_MERGE(antispam);
FLAG_MERGE(preconnect);
FLAG_MERGE(keep);
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;
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");
}
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 */
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)
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
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);
#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);
| smtp_list STRING {save_str(¤t.smtphunt, $2,TRUE);}
;
+num_list : NUMBER {
+ struct idlist *id;
+ id=save_str(¤t.antispam,0,0);
+ id->val.status.num = $1;
+ }
+ | num_list NUMBER {
+ struct idlist *id;
+ id=save_str(¤t.antispam,0,0);
+ id->val.status.num = $2;
+ }
+ ;
+
user_option : TO localnames HERE
| TO localnames
| IS 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);}