Yahoo Groups archive

Milter-greylist

Index last updated: 2026-04-28 23:32 UTC

Thread

output spamassassin score

output spamassassin score

2010-07-04 by gitoshi

right now I´m using the follow config without problems

spamdsock inet "127.0.0.1:783"
dacl "SPAMASS" blacklist spamd > 10 msg "Your message is considered spam."

however I want to log spamd score/tests in my reject response

using postfix 2.3 + milter-greylist 4.2.5

I don´t found a format string for spamd score

any ideas??

Re: [milter-greylist] output spamassassin score

2010-07-04 by manu@netbsd.org

gitoshi <gitoshi@...> wrote:

> spamdsock inet "127.0.0.1:783"
> dacl "SPAMASS" blacklist spamd > 10 msg "Your message is considered spam."
> 
> however I want to log spamd score/tests in my reject response
> 
> using postfix 2.3 + milter-greylist 4.2.5
> 
> I don´t found a format string for spamd score

It is not implemented, but it would not be difficult to do it. Do you
know some C? 

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu@...

Re: output spamassassin score

2010-07-04 by gitoshi

unfortunately I know very little C



--- In milter-greylist@...m, manu@... wrote:
Show quoted textHide quoted text
>
> gitoshi <gitoshi@...> wrote:
> 
> > spamdsock inet "127.0.0.1:783"
> > dacl "SPAMASS" blacklist spamd > 10 msg "Your message is considered spam."
> > 
> > however I want to log spamd score/tests in my reject response
> > 
> > using postfix 2.3 + milter-greylist 4.2.5
> > 
> > I don´t found a format string for spamd score
> 
> It is not implemented, but it would not be difficult to do it. Do you
> know some C? 
> 
> -- 
> Emmanuel Dreyfus
> http://hcpnet.free.fr/pubz
> manu@...
>

Re: [milter-greylist] Re: output spamassassin score

2010-07-05 by manu@netbsd.org

gitoshi <gitoshi@...> wrote:

> unfortunately I know very little C

Well, it's an opportunity to improve that skill. All you need is a minor
tweak in milter-greylist.c. The function where format strings are
expanded is fstring_expand()

I suggest we use %Ms for the spamassassin score. You need to add a code
like this:

case 'M': /* SpamAssassin information */
#ifdef USE_SPAMD
        str_len = 2;
        switch(*(ptok + 1)) {
        case 's': {     /* score */
                char buf[QSTRLEN + 1];

                (void)snprintf(buf, sizeof(buf), "%d", 
                             priv->priv_spamd_score10);
                mystrncat(&outstr, buf, &outmaxlen);
                break;
        }
#endif /* USE_SPAMD */
        break;
}

Once you get it working, please update the format string section in
greylist.conf.5 and send me a patch, I'll commit it in the repository.

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu@...

Re: output spamassassin score

2010-07-05 by gitoshi

look like %M is already used for sendmail macros
I´m using %Hs

                case 'H': { /* SpamAssassin information */
                #ifdef USE_SPAMD
                        fstr_len = 2;
                        switch(*(ptok + 1)) {
                        case 's': { /* score */
                            char buf[QSTRLEN + 1];
                            (void)snprintf(buf, sizeof(buf), "%g",(double)priv->priv_spamd_score10/10);
                            mystrncat(&outstr, buf, &outmaxlen);
                            break;
                            }
                        }
                #endif /* USE_SPAMD */
                        break;
                        }




--- In milter-greylist@yahoogroups.com, manu@... wrote:
Show quoted textHide quoted text
>
> gitoshi <gitoshi@...> wrote:
> 
> > unfortunately I know very little C
> 
> Well, it's an opportunity to improve that skill. All you need is a minor
> tweak in milter-greylist.c. The function where format strings are
> expanded is fstring_expand()
> 
> I suggest we use %Ms for the spamassassin score. You need to add a code
> like this:
> 
> case 'M': /* SpamAssassin information */
> #ifdef USE_SPAMD
>         str_len = 2;
>         switch(*(ptok + 1)) {
>         case 's': {     /* score */
>                 char buf[QSTRLEN + 1];
> 
>                 (void)snprintf(buf, sizeof(buf), "%d", 
>                              priv->priv_spamd_score10);
>                 mystrncat(&outstr, buf, &outmaxlen);
>                 break;
>         }
> #endif /* USE_SPAMD */
>         break;
> }
> 
> Once you get it working, please update the format string section in
> greylist.conf.5 and send me a patch, I'll commit it in the repository.
> 
> -- 
> Emmanuel Dreyfus
> http://hcpnet.free.fr/pubz
> manu@...
>

Re: [milter-greylist] Re: output spamassassin score

2010-07-06 by Emmanuel Dreyfus

On Mon, Jul 05, 2010 at 10:30:18PM -0000, gitoshi wrote:
> look like %M is already used for sendmail macros
> I\ufffdm using %Hs

Now if it works, please update greylist.conf.5 and send a patch.

-- 
Emmanuel Dreyfus
manu@...

Re: output spamassassin score

2010-07-06 by gitoshi

--- milter-greylist-4.2.5/greylist.conf.5       2010-04-14
10:32:49.000000000 -0500
+++ milter-greylist-4.2.5.patched/greylist.conf.5       2010-07-06
08:32:04.000000000 -0500
@@ -1247,6 +1247,9 @@
  .I %R
  shortcut to %Rh:%Rm:Rs
  .TP
+.I %Hs
+SpamAssassin score
+.TP
  .I %%
  a single % character
  .PP


--- milter-greylist-4.2.5/milter-greylist.c     2010-04-17
22:56:40.000000000 -0500
+++ milter-greylist-4.2.5.patched/milter-greylist.c     2010-07-05
16:55:56.000000000 -0500
@@ -2403,6 +2403,20 @@
                 fstr_len = 1;

                 switch (*ptok) {
+               case 'H': { /* SpamAssassin information */
+               #ifdef USE_SPAMD
+                       fstr_len = 2;
+                       switch(*(ptok + 1)) {
+                       case 's': { /* score */
+                           char buf[QSTRLEN + 1];
+                           (void)snprintf(buf, sizeof(buf),
"%g",(double)priv->priv_spamd_score10/10);
+                           mystrncat(&outstr, buf, &outmaxlen);
+                           break;
+                           }
+                       }
+               #endif /* USE_SPAMD */
+                       break;
+                       }
                 case 'h':       /* Hello string */
                         mystrncat(&outstr, priv->priv_helo, &outmaxlen);
                         break;

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.