Steve wrote:
-------- Original-Nachricht --------
Datum: Thu, 23 Jul 2009 17:13:19 +0100
Von: Carlo Rodrigues <[email protected]>
An: [email protected]
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, and, if it doesn't find them, assumes that the string is no good.

It seems that buf, in my case comes with the '\n' already stripped. Just the string "To: email_address" and it's end,'\0'.

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'm attaching the dspam.messages for that message.

Thanks

Carlo Rodrigues
Received: from [10.8.0.14] (nat.net4b.pt [195.245.179.33])
        (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
        (No client certificate requested)
        by ravaso.net4b.pt (Postfix) with ESMTP id 3188438BB7
        for <[email protected]>; Thu, 23 Jul 2009 17:57:40 +0100 (WEST)
Message-ID: <[email protected]>
Date: Thu, 23 Jul 2009 17:57:39 +0100
From: Carlo Rodrigues <[email protected]>
User-Agent: Thunderbird 2.0.0.22 (X11/20090608)
MIME-Version: 1.0
To: [email protected]
Subject: test
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

test

------------------------------------------------------------------------------
_______________________________________________
Dspam-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspam-devel

Reply via email to