Here is a proposal fix for the bug (only on SMTP / LMTP protocol) where
we lose "." in a message if he is on the first position of a line (due
to lack of escaping)

here is the fix:

I don't tested it (i'll do it soon, but i think it shouldn't be far from
the solution)

Index: client.c
===================================================================
RCS file: /usr/local/cvsroot/dspam/src/client.c,v
retrieving revision 1.62
diff -u -r1.62 client.c
--- client.c    25 May 2006 15:36:39 -0000      1.62
+++ client.c    13 Sep 2007 17:31:27 -0000
@@ -791,13 +791,34 @@
   i = 0;
   msglen = strlen(msg);
   while(i<msglen) {
-    int r = send(TTX.sockfd, msg+i, msglen - i, 0);
+       /* START BUG CORRECTION */
+       char *next_pos=(msg+i, "\r\n.");
+       int len=0;
+       if (next_pos==NULL){
+           int r = send(TTX.sockfd, msg+i, msglen - i, 0);
+       } else {
+               if (next_pos==msg+i){
+                       r = sent(TTX.sockfd, "\r\n..", 4, 0);
+                       if (r>=4){ /* DUNNO If \0 is in r value */
+                               i+=3; /* Adding Only the \r\n. */
+                           int r = send(TTX.sockfd, msg+i, len, 0);
+                       } else {
+                             LOG(LOG_ERR, ERR_CLIENT_SEND_FAILED);
+                             STATUS(ERR_CLIENT_SEND_FAILED);
+                             goto BAIL;
+                       }
+               } else {
+                       len=next_pos-msg+i;
+                   int r = send(TTX.sockfd, msg+i, len, 0);
+               }
+       }
     if (r <= 0) {
       LOG(LOG_ERR, ERR_CLIENT_SEND_FAILED);
       STATUS(ERR_CLIENT_SEND_FAILED);
       goto BAIL;
     }
     i += r;
+    /* END BUG CORRECTION */
   }
 
   if (msg[strlen(msg)-1]!= '\n') {

Attachment: signature.asc
Description: Ceci est une partie de message numériquement signée

Reply via email to