From: Sunil S. <sh...@bo...> - 2010-10-13 21:40:37
|
This appears to be similar to the recent --nosoftbounce and --nobounce issue where options are not handled exactly the same way as the rcfile parser. Is there a way to push the options also to the parser so that options.c as well as these mismatches can be eliminated? Dear keesbakker, Quoting from ad...@be...'s mail on Wed, Oct 13, 2010: > Summary: antispam does not work > > Details: The --antispam option does not work (anymore?). I guess, it must have been disfunctional since 2002-sep-04, when a patch from Sunil Shetye ("double-bounce patch") was applied. (Git commit efe3c6cc82e214142809c77c4f2fa8a58bdef787) Oops... > The code that was added in sink.c has this piece > > if (str_find(&ctl->antispam, smtperr)) > > And the problem is that the function returns a NULL pointer even if it finds the requested value. > > Notice that there is another location in sink.c which searches the ctl->antispam list using a while loop. It looks like one str_find() was replaced by the loop after my patch while the other was left alone. Let me try restoring the str_find() first!!! Please try this patch and report: ========================================================================= >From 00c78f2ada31b85ea2089a48f6c9467144a4fbf1 Mon Sep 17 00:00:00 2001 From: Sunil Shetye <sh...@bo...> Date: Thu, 14 Oct 2010 00:00:54 +0530 Subject: [PATCH] handle --antispam option correctly --- NEWS | 2 ++ options.c | 2 +- sink.c | 12 +----------- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/NEWS b/NEWS index 4cbdd21..9a319e7 100644 --- a/NEWS +++ b/NEWS @@ -63,6 +63,8 @@ fetchmail-6.3.19 (not yet released): of local users, not just at the end. * In multidrop mode, header parsing is now more verbose in -vv mode, so that it becomes possible to see which header is used. +* Make --antispam work from command line (these used to work in rcfiles). + Reported by keesbakker. (Sunil Shetye) # KNOWN BUGS AND WORKAROUNDS: (this section floats upwards through the NEWS file so it stays with the diff --git a/options.c b/options.c index d0c7c2a..a298cb6 100644 --- a/options.c +++ b/options.c @@ -487,7 +487,7 @@ int parsecmdline (int argc /** argument count */, buf = xstrdup(optarg); cp = strtok(buf, ","); do { - struct idlist *idp = save_str(&ctl->antispam, NULL, 0);; + struct idlist *idp = save_str(&ctl->antispam, STRING_DUMMY, 0); idp->val.status.num = xatoi(cp, &errflag); } while diff --git a/sink.c b/sink.c index 3abbd60..92f7b43 100644 --- a/sink.c +++ b/sink.c @@ -441,8 +441,6 @@ static int handle_smtp_report(struct query *ctl, struct msgblk *msg) { int smtperr = atoi(smtp_response); char *responses[1]; - struct idlist *walk; - int found = 0; responses[0] = xstrdup(smtp_response); @@ -466,15 +464,7 @@ static int handle_smtp_report(struct query *ctl, struct msgblk *msg) * messages, which are probably in English (none of the * MTAs I know about are internationalized). */ - for( walk = ctl->antispam; walk; walk = walk->next ) - if ( walk->val.status.num == smtperr ) - { - found=1; - break; - } - - /* if (str_find(&ctl->antispam, smtperr)) */ - if ( found ) + if (str_find(&ctl->antispam, smtperr)) { /* * SMTP listener explicitly refuses to deliver mail -- 1.7.2.3 ========================================================================= -- Sunil Shetye. |