[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: maybe contentfilter trouble



On Thu, 2004-08-05 at 13:23 +0400, Eugene Crosser wrote:

> So, my current theory is that this is smtpserver who somehow remembers
> negative result from contentfilter and applies it to all consequitive
> messages.  I am going to investigate it today.

Looks like two things interfering:

1. result sanity check in subdaemon-ctf.c line 710 is too strict: it
fails if there is no extended code in the message.

2. in contentfilter_proc() (subdaemon-ctf.c line 634 and down),
ctfstate->pbuf does not get initialized, and if sanity check above
fails, on reception of "#hungry" the *old* value is used.  Oops!

This is what I suggest:

Index: subdaemon-ctf.c
===================================================================
RCS file: /cvsroot/zmailer/smtpserver/subdaemon-ctf.c,v
retrieving revision 1.17
diff -u -r1.17 subdaemon-ctf.c
--- subdaemon-ctf.c     9 Jul 2004 21:59:40 -0000       1.17
+++ subdaemon-ctf.c     5 Aug 2004 10:27:23 -0000
@@ -660,6 +660,9 @@
        /* We have seen  "#hungry\n",  now we go and send our little thingie
           down the pipe... */

+       if (ctfstate->pbuf) free(ctfstate->pbuf);
+       ctfstate->pbuf=NULL;
+
        fprintf(ctfstate->outfp, "%s\n", fname);
        fflush(ctfstate->outfp);
        if (ferror(ctfstate->outfp)) {
@@ -707,9 +710,9 @@
          /* We have a reply line here.. */
          {
            int i;
-           rc = sscanf(ctfstate->buf, "%i %i %i", &i, &i, &i);
+           rc = sscanf(ctfstate->buf, "%i %i", &i, &i);
          }
-         if (rc < 3) {
+         if (rc < 2) {
            /* BAD! */
            continue;
          }

This is a digitally signed message part