On 2009/07/23, at 18:37, Steve wrote: > > -------- Original-Nachricht -------- >> Datum: Thu, 23 Jul 2009 18:11:15 +0100 >> Von: Carlo Rodrigues <c...@net4b.pt> >> An: dspam-devel@lists.sourceforge.net >> Betreff: Re: [Dspam-devel] trouble understanding an extract of >> agent_shared.c on process_parseto() > >> Steve wrote: >>> -------- Original-Nachricht -------- >>> >>>> Datum: Thu, 23 Jul 2009 17:13:19 +0100 >>>> Von: Carlo Rodrigues <c...@net4b.pt> >>>> An: dspam-devel@lists.sourceforge.net >>>> Betreff: [Dspam-devel] trouble understanding an extract of >> agent_shared.c on process_parseto() >>>> >>> >>> >>>> 829 int process_parseto(AGENT_CTX *ATX, const char *buf) { >>>> 830 char *y = NULL; >>>> 831 char *x; >>>> 832 char *h; >>>> 833 >>>> 834 if (!buf) >>>> 835 return EINVAL; >>>> 836 h = strstr(buf, "\r\n\r\n"); >>>> >>>> >>> buf is the "To: " header line and h is a pointer to into buf if buf >> contains "\r\n\r\n". If not found then h = NULL. >>> >>> >>>> 837 if (!h) h = strstr(buf, "\n\n"); >>>> >>>> >>> Same as above but this time looking for "\n\n". >>> >>> >>> >>>> 838 >>>> 839 x = strstr(buf, "<spam-"); >>>> 840 if (!x) >>>> 841 x = strstr(buf, " spam-"); >>>> 842 if (!x) >>>> 843 x = strstr(buf, ":spam-"); >>>> 844 if (!x) >>>> 845 x = strstr(buf, "<spam@"); >>>> 846 if (!x) >>>> 847 x = strstr(buf, " spam@"); >>>> 848 if (!x) >>>> 849 x = strstr(buf, ":spam@"); >>>> 850 if (x > h) x = NULL; >>>> >>>> I'm trying to understand what is the h variable for. I always get >> h=NULL >>>> on lines 836/837, and then x>h is always true, and the email >>>> retraining >>>> wasn't working for me. If I comment line 850, it is working as >> expected, >>>> and the signature of the forwarded email is retrained as spam. >>>> >>>> >>> Probably better for your case would be to extend the parsing of >>> the To >> header line to be: >>> 836 h = strstr(buf, "\r\n\r\n"); >>> 837 if (!h) h = strstr(buf, "\n\n"); >>> 838 if (!h) h = strstr(buf, "\r\n"); >>> 839 if (!h) h = strstr(buf, "\n"); >>> >>> >> What I do not yet understand is why is dspam expecting 2 newlines >> after >> the string, >> > Don't know. I am still crawling in DSPAM code. > > >> and, if it doesn't find them, assumes that the string is no >> good. >> > The code tries to prevent wrong parsing of the To header. From my > viewpoint it could be done better but so many things could be done > better and who is going to do all the work? To much things to do and > to less time to look at everything.
Yep, that's fully understandable. > > >> It seems that buf, in my case comes with the '\n' already stripped. >> Just >> the string "To: email_address" and it's end,'\0'. >> > That is strange. Have you enabled "Broken lineStripping"? > No, it's not enabled. > >>> What MTA do you have over there? Can you attach a message in raw >>> format >> (how the MTA produced it and DSPAM get's it) here so I can inspect >> the >> message? >>> >>> >>> >> I'm using Mozilla Thunderbird for composing, and delivering on a >> postfix >> server, which then sends the message to dspam via LMTP. I tried with Apple Mail and the result was the same. >> >> I'm attaching the dspam.messages for that message. >> >> Thanks >> >> Carlo Rodrigues >> > // Steve > -- > Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla > Firefox 3 - > sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser > > ------------------------------------------------------------------------------ > _______________________________________________ > Dspam-devel mailing list > Dspam-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/dspam-devel ------------------------------------------------------------------------------ _______________________________________________ Dspam-devel mailing list Dspam-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dspam-devel