List Info

Thread: xsane and qmail




xsane and qmail
user name
2006-11-03 22:17:42
QMail is strict regarding the format of emails.  It rejects
emails not
conforming to 822bis section 2.3, which prohibits all bare
LFs.
Unfortunately this is what xsane-email sends in its message
body.
The patch below corrects this. It shouldnt break operation
with any
other mail daemons although I'm not in a position to check
specifically.

Hopefully it can be included in the next release.

Dave

diff -Naur xsane-0.991/src/xsane-email-project.c
xsane-0.991a/src/xsane-email-project.c
--- xsane-0.991/src/xsane-email-project.c	2006-01-10
18:07:44.000000000 +0000
+++ xsane-0.991a/src/xsane-email-project.c	2006-11-03
22:03:39.000000000 +0000
 -1595,7
+1595,7 
           /* doc files like ps and pdf can not be displayed
inline in html email */
           if (display_images_inline)
           {
-            snprintf(buf, sizeof(buf),
"<p><img SRC="cid:%s">n",
content_id);
+            snprintf(buf, sizeof(buf),
"<p><img
SRC="cid:%s">rn", content_id);
           }
           write(fd, buf, strlen(buf));
         }
 -1605,7
+1605,7 
       }
       else if (*email_text_pos == 10) /* new line */
       {
-        snprintf(buf, sizeof(buf),
"<br>n");
+        snprintf(buf, sizeof(buf),
"<br>rn");
         write(fd, buf, strlen(buf));
       }
       else
 -1624,12
+1624,12 
       /* doc files like ps and pdf can not be displayed
inline in html email */
       if (display_images_inline)
       {
-        snprintf(buf, sizeof(buf), "<p><img
SRC="cid:%s">n", content_id);
+        snprintf(buf, sizeof(buf), "<p><img
SRC="cid:%s">rn", content_id);
       }
       write(fd, buf, strlen(buf));
     }
 
-    snprintf(buf, sizeof(buf),
"</html>n");
+    snprintf(buf, sizeof(buf),
"</html>rn");
     write(fd, buf, strlen(buf));
 
 
 -1666,7
+1666,7 
     write_email_mime_ascii(fd, boundary);
 
     write(fd, email_text, strlen(email_text));
-    write(fd, "nn", 2);
+    write(fd, "rnrn", 4);
 
     for (i=0; i<attachments; i++)
     {
diff -Naur xsane-0.991/src/xsane-save.c
xsane-0.991a/src/xsane-save.c
--- xsane-0.991/src/xsane-save.c	2006-01-10
17:46:32.000000000 +0000
+++ xsane-0.991a/src/xsane-save.c	2006-11-03
22:03:39.000000000 +0000
 -5477,7
+5477,7 
     pos += 4;
     if (pos > 71)
     {
-      write(fd_socket, "n", 1);
+      write(fd_socket, "rn", 2);
       
       pos = 0;
     }
 -5492,7
+5492,7 
 
   if (pos)
   {
-    write(fd_socket, "n", 1);
+    write(fd_socket, "rn", 2);
   }
 
   xsane.email_progress_val = 1.0;
 -5505,33
+5505,33 
 {
  char buf[1024];
 
-  snprintf(buf, sizeof(buf), "From: %sn", from);
+  snprintf(buf, sizeof(buf), "From: %srn",
from);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "Reply-To: %sn",
reply_to);
+  snprintf(buf, sizeof(buf), "Reply-To: %srn",
reply_to);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "To: %sn", to);
+  snprintf(buf, sizeof(buf), "To: %srn", to);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "Subject: %sn",
subject);
+  snprintf(buf, sizeof(buf), "Subject: %srn",
subject);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "MIME-Version:
1.0n");
+  snprintf(buf, sizeof(buf), "MIME-Version:
1.0rn");
   write(fd_socket, buf, strlen(buf));
 
   if (related) /* related means that we need a special link
in the html part to display the image */
   {
-    snprintf(buf, sizeof(buf), "Content-Type:
multipart/related;n");
+    snprintf(buf, sizeof(buf), "Content-Type:
multipart/related;rn");
     write(fd_socket, buf, strlen(buf));
   }
   else
   {
-    snprintf(buf, sizeof(buf), "Content-Type:
multipart/mixed;n");
+    snprintf(buf, sizeof(buf), "Content-Type:
multipart/mixed;rn");
     write(fd_socket, buf, strlen(buf));
   }
 
-  snprintf(buf, sizeof(buf), "
boundary="%s"nn", boundary);
+  snprintf(buf, sizeof(buf), "
boundary="%s"rnrn", boundary);
   write(fd_socket, buf, strlen(buf));
 }
 
 -5541,7
+5541,7 
 {
  char buf[1024];
 
-  snprintf(buf, sizeof(buf), "--%s--n",
boundary);
+  snprintf(buf, sizeof(buf), "--%s--rn",
boundary);
   write(fd_socket, buf, strlen(buf));
 }
 
 -5551,16
+5551,16 
 {
  char buf[1024];
 
-  snprintf(buf, sizeof(buf), "--%sn", boundary);
+  snprintf(buf, sizeof(buf), "--%srn",
boundary);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "Content-Type:
text/plain;n");
+  snprintf(buf, sizeof(buf), "Content-Type:
text/plain;rn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "       
charset="iso-8859-1"n");
+  snprintf(buf, sizeof(buf), "       
charset="iso-8859-1"rn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf),
"Content-Transfer-Encoding: 8bitnn");
+  snprintf(buf, sizeof(buf),
"Content-Transfer-Encoding: 8bitrnrn");
   write(fd_socket, buf, strlen(buf));
 }
 
 -5570,22
+5570,22 
 {
  char buf[1024];
 
-  snprintf(buf, sizeof(buf), "--%sn", boundary);
+  snprintf(buf, sizeof(buf), "--%srn",
boundary);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "Content-Type:
text/html;n");
+  snprintf(buf, sizeof(buf), "Content-Type:
text/html;rn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "       
charset="us-ascii"n");
+  snprintf(buf, sizeof(buf), "       
charset="us-ascii"rn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf),
"Content-Transfer-Encoding: 7bitnn");
+  snprintf(buf, sizeof(buf),
"Content-Transfer-Encoding: 7bitrnrn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "<!doctype html public
"-//w3c//dtd html 4.0
transitional//en">n");
+  snprintf(buf, sizeof(buf), "<!doctype html public
"-//w3c//dtd html 4.0
transitional//en">rn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "<html>n");
+  snprintf(buf, sizeof(buf), "<html>rn");
   write(fd_socket, buf, strlen(buf));
 }
 
 -5595,28
+5595,28 
 {
  char buf[1024];
 
-  snprintf(buf, sizeof(buf), "--%sn", boundary);
+  snprintf(buf, sizeof(buf), "--%srn",
boundary);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "Content-Type:
%sn", content_type);
+  snprintf(buf, sizeof(buf), "Content-Type:
%srn", content_type);
   write(fd_socket, buf, strlen(buf));
 
   if (content_id)
   {
-    snprintf(buf, sizeof(buf), "Content-ID:
<%s>n", content_id);
+    snprintf(buf, sizeof(buf), "Content-ID:
<%s>rn", content_id);
     write(fd_socket, buf, strlen(buf));
   }
 
-  snprintf(buf, sizeof(buf),
"Content-Transfer-Encoding: base64n");
+  snprintf(buf, sizeof(buf),
"Content-Transfer-Encoding: base64rn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "Content-Disposition:
inline;n");
+  snprintf(buf, sizeof(buf), "Content-Disposition:
inline;rn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "       
filename="%s"n", filename);
+  snprintf(buf, sizeof(buf), "       
filename="%s"rn", filename);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "n");
+  snprintf(buf, sizeof(buf), "rn");
   write(fd_socket, buf, strlen(buf));
 
   write_base64(fd_socket, infile);
 -5628,25
+5628,25 
 {
  char buf[1024];
 
-  snprintf(buf, sizeof(buf), "--%sn", boundary);
+  snprintf(buf, sizeof(buf), "--%srn",
boundary);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "Content-Type:
application/octet-streamn");
+  snprintf(buf, sizeof(buf), "Content-Type:
application/octet-streamrn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "       
name="%s"n", filename);
+  snprintf(buf, sizeof(buf), "       
name="%s"rn", filename);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf),
"Content-Transfer-Encoding: base64n");
+  snprintf(buf, sizeof(buf),
"Content-Transfer-Encoding: base64rn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "Content-Disposition:
attachment;n");
+  snprintf(buf, sizeof(buf), "Content-Disposition:
attachment;rn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "       
filename="%s"n", filename);
+  snprintf(buf, sizeof(buf), "       
filename="%s"rn", filename);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "n");
+  snprintf(buf, sizeof(buf), "rn");
   write(fd_socket, buf, strlen(buf));
 
   write_base64(fd_socket, infile);
diff -Naur xsane-0.991/src/xsane-save.c.orig
xsane-0.991a/src/xsane-save.c.orig
--- xsane-0.991/src/xsane-save.c.orig	2005-12-17
12:37:25.000000000 +0000
+++ xsane-0.991a/src/xsane-save.c.orig	2006-11-03
22:03:38.000000000 +0000
 -5366,7
+5366,7 
     pos += 4;
     if (pos > 71)
     {
-      write(fd_socket, "n", 1);
+      write(fd_socket, "rn", 2);
       
       pos = 0;
     }
 -5381,7
+5381,7 
 
   if (pos)
   {
-    write(fd_socket, "n", 1);
+    write(fd_socket, "rn", 2);
   }
 
   xsane.mail_progress_val = 1.0;
 -5394,33
+5394,33 
 {
  char buf[1024];
 
-  snprintf(buf, sizeof(buf), "From: %sn", from);
+  snprintf(buf, sizeof(buf), "From: %srn",
from);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "Reply-To: %sn",
reply_to);
+  snprintf(buf, sizeof(buf), "Reply-To: %srn",
reply_to);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "To: %sn", to);
+  snprintf(buf, sizeof(buf), "To: %srn", to);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "Subject: %sn",
subject);
+  snprintf(buf, sizeof(buf), "Subject: %srn",
subject);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "MIME-Version:
1.0n");
+  snprintf(buf, sizeof(buf), "MIME-Version:
1.0rn");
   write(fd_socket, buf, strlen(buf));
 
   if (related) /* related means that we need a special link
in the html part to display the image */
   {
-    snprintf(buf, sizeof(buf), "Content-Type:
multipart/related;n");
+    snprintf(buf, sizeof(buf), "Content-Type:
multipart/related;rn");
     write(fd_socket, buf, strlen(buf));
   }
   else
   {
-    snprintf(buf, sizeof(buf), "Content-Type:
multipart/mixed;n");
+    snprintf(buf, sizeof(buf), "Content-Type:
multipart/mixed;rn");
     write(fd_socket, buf, strlen(buf));
   }
 
-  snprintf(buf, sizeof(buf), "
boundary="%s"nn", boundary);
+  snprintf(buf, sizeof(buf), "
boundary="%s"rnrn", boundary);
   write(fd_socket, buf, strlen(buf));
 }
 
 -5430,7
+5430,7 
 {
  char buf[1024];
 
-  snprintf(buf, sizeof(buf), "--%s--n",
boundary);
+  snprintf(buf, sizeof(buf), "--%s--rn",
boundary);
   write(fd_socket, buf, strlen(buf));
 }
 
 -5440,16
+5440,16 
 {
  char buf[1024];
 
-  snprintf(buf, sizeof(buf), "--%sn", boundary);
+  snprintf(buf, sizeof(buf), "--%srn",
boundary);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "Content-Type:
text/plain;n");
+  snprintf(buf, sizeof(buf), "Content-Type:
text/plain;rn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "       
charset="iso-8859-1"n");
+  snprintf(buf, sizeof(buf), "       
charset="iso-8859-1"rn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf),
"Content-Transfer-Encoding: 8bitnn");
+  snprintf(buf, sizeof(buf),
"Content-Transfer-Encoding: 8bitrnrn");
   write(fd_socket, buf, strlen(buf));
 }
 
 -5459,22
+5459,22 
 {
  char buf[1024];
 
-  snprintf(buf, sizeof(buf), "--%sn", boundary);
+  snprintf(buf, sizeof(buf), "--%srn",
boundary);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "Content-Type:
text/html;n");
+  snprintf(buf, sizeof(buf), "Content-Type:
text/html;rn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "       
charset="us-ascii"n");
+  snprintf(buf, sizeof(buf), "       
charset="us-ascii"rn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf),
"Content-Transfer-Encoding: 7bitnn");
+  snprintf(buf, sizeof(buf),
"Content-Transfer-Encoding: 7bitrnrn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "<!doctype html public
"-//w3c//dtd html 4.0
transitional//en">n");
+  snprintf(buf, sizeof(buf), "<!doctype html public
"-//w3c//dtd html 4.0
transitional//en">rn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "<html>n");
+  snprintf(buf, sizeof(buf), "<html>rn");
   write(fd_socket, buf, strlen(buf));
 }
 
 -5484,28
+5484,28 
 {
  char buf[1024];
 
-  snprintf(buf, sizeof(buf), "--%sn", boundary);
+  snprintf(buf, sizeof(buf), "--%srn",
boundary);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "Content-Type:
%sn", content_type);
+  snprintf(buf, sizeof(buf), "Content-Type:
%srn", content_type);
   write(fd_socket, buf, strlen(buf));
 
   if (content_id)
   {
-    snprintf(buf, sizeof(buf), "Content-ID:
<%s>n", content_id);
+    snprintf(buf, sizeof(buf), "Content-ID:
<%s>rn", content_id);
     write(fd_socket, buf, strlen(buf));
   }
 
-  snprintf(buf, sizeof(buf),
"Content-Transfer-Encoding: base64n");
+  snprintf(buf, sizeof(buf),
"Content-Transfer-Encoding: base64rn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "Content-Disposition:
inline;n");
+  snprintf(buf, sizeof(buf), "Content-Disposition:
inline;rn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "       
filename="%s"n", filename);
+  snprintf(buf, sizeof(buf), "       
filename="%s"rn", filename);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "n");
+  snprintf(buf, sizeof(buf), "rn");
   write(fd_socket, buf, strlen(buf));
 
   write_base64(fd_socket, infile);
 -5517,25
+5517,25 
 {
  char buf[1024];
 
-  snprintf(buf, sizeof(buf), "--%sn", boundary);
+  snprintf(buf, sizeof(buf), "--%srn",
boundary);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "Content-Type:
application/octet-streamn");
+  snprintf(buf, sizeof(buf), "Content-Type:
application/octet-streamrn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "       
name="%s"n", filename);
+  snprintf(buf, sizeof(buf), "       
name="%s"rn", filename);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf),
"Content-Transfer-Encoding: base64n");
+  snprintf(buf, sizeof(buf),
"Content-Transfer-Encoding: base64rn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "Content-Disposition:
attachment;n");
+  snprintf(buf, sizeof(buf), "Content-Disposition:
attachment;rn");
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "       
filename="%s"n", filename);
+  snprintf(buf, sizeof(buf), "       
filename="%s"rn", filename);
   write(fd_socket, buf, strlen(buf));
 
-  snprintf(buf, sizeof(buf), "n");
+  snprintf(buf, sizeof(buf), "rn");
   write(fd_socket, buf, strlen(buf));
 
   write_base64(fd_socket, infile);


-- 
sane-devel mailing list: sane-devellists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/sane-d
evel
Unsubscribe: Send mail with subject "unsubscribe
your_password"
             to sane-devel-requestlists.alioth.debian.org
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )