diff options
| -rw-r--r-- | NEWS | 1 | ||||
| -rw-r--r-- | conf.c | 9 | ||||
| -rw-r--r-- | driver.c | 2 | ||||
| -rw-r--r-- | fetchmail.c | 19 | ||||
| -rw-r--r-- | fetchmail.h | 2 | ||||
| -rw-r--r-- | fetchmail.man | 11 | ||||
| -rw-r--r-- | options.c | 14 | ||||
| -rw-r--r-- | rcfile_y.y | 14 | 
8 files changed, 55 insertions, 17 deletions
@@ -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 @@ -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('}'); @@ -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 @@ -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); @@ -261,6 +261,18 @@ smtp_list	: STRING		{save_str(¤t.smtphunt, $1,TRUE);}  		| 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 @@ -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);}  | 
