Bug#310327: patch

2005-09-10 Thread Martin Schulze
Aníbal Monsalve Salazar wrote:
 Upon investigation of this problem I noticed that ssmtp (oldstable
 and stable) always strips the last line of the input before sending.
 
 gluck!joey(pts/4):~ seq 1 10|sendmail [EMAIL PROTECTED]
 
 -- 1..9
 
 gluck!joey(pts/4):~ echo seq 1 10|sendmail [EMAIL PROTECTED]
 
 -- no lines
 
 This is not fixed by the above patch.
 
 I've patched ssmtp.c to fix the problem above and to close #310327
 in ssmtp 2.61-5. It can be argued that you _must_ separate the data
 from the mail headers with an empty line. The following works:
 
 (echo; seq 1 10)|sendmail [EMAIL PROTECTED]
 
 If you want to really fix it, I can send you patches for the
 oldstable and stable versions of ssmtp. I can also prepare new
 packages as well. Please let me know what would you like me to do.

Oh, I see.

If I recall correctly, I've used mailx to build the mail before
so that there was a header.  Well, then it may not be a bug but
a feature and we can leave it as it is.

 The other problem, the subject of #310327, is fixed in ssmtp 2.61-5
 by the patch at:
 
 http://bugs.debian.org/cgi-bin/bugreport.cgi/ssmtp_2.61-4_non_blocking_fgets.diff?bug=310327;msg=64;att=2
 
 That patch is not requiered for the versions of ssmtp currently in
 oldstable and stable as bug #310327 was introduced with ssmtp
 2.61-3.

Good news.  Thanks.

Regards,

Joey

-- 
All language designers are arrogant.  Goes with the territory...
-- Larry Wall

Please always Cc to me when replying to me on the lists.



Bug#310327: patch

2005-09-09 Thread Aníbal Monsalve Salazar
On Fri, Aug 26, 2005 at 10:47:29AM +0200, Martin Schulze wrote:

Upon investigation of this problem I noticed that ssmtp (oldstable
and stable) always strips the last line of the input before sending.

gluck!joey(pts/4):~ seq 1 10|sendmail [EMAIL PROTECTED]

-- 1..9

gluck!joey(pts/4):~ echo seq 1 10|sendmail [EMAIL PROTECTED]

-- no lines

This is not fixed by the above patch.

I've patched ssmtp.c to fix the problem above and to close #310327
in ssmtp 2.61-5. It can be argued that you _must_ separate the data
from the mail headers with an empty line. The following works:

(echo; seq 1 10)|sendmail [EMAIL PROTECTED]

If you want to really fix it, I can send you patches for the
oldstable and stable versions of ssmtp. I can also prepare new
packages as well. Please let me know what would you like me to do.

The other problem, the subject of #310327, is fixed in ssmtp 2.61-5
by the patch at:

http://bugs.debian.org/cgi-bin/bugreport.cgi/ssmtp_2.61-4_non_blocking_fgets.diff?bug=310327;msg=64;att=2

That patch is not requiered for the versions of ssmtp currently in
oldstable and stable as bug #310327 was introduced with ssmtp
2.61-3.




Regards,

   Joey

-- 
WARNING: Do not execute!  This call violates patent DE10108564.
http://www.elug.de/projekte/patent-party/patente/DE10108564

wget -O patinfo-`date +%Y%m%d`.html http://patinfo.ffii.org/

Please always Cc to me when replying to me on the lists.

-- 

Mit freundlichen Grüßen,

Anibal Monsalve Salazar
--
 .''`. Debian GNU/Linux
: :' : Free Operating System
`. `'  http://debian.org/
  `-   http://v7w.com/anibal


signature.asc
Description: Digital signature


Bug#310327: patch fixing the stdin-no-headers scenario

2005-09-04 Thread Wouter Van Hemel


This quick patch should fix the problem of ssmtp eating lines when there 
are no headers supplied on stdin, as Martin Schulze remarked before.


Ssmtp expects to receive 'headers - empty line - body', and when only the 
body is included, it tries to put all lines in the header and creatively 
eats some at the end.


On its way, MTAs usually add real headers to the message, making the body 
appear again but incomplete.


What this patch does, is checking the first line for a colon and jumping 
out of the headers routine if the message doesn't appear to have a header.


Can somebody verify if this fixes at least that problem?


Regards,

  Wouter
--- ssmtp-2.61/ssmtp.c  2005-09-04 18:05:20.0 +0200
+++ ssmtp-2.61-wvh/ssmtp.c  2005-09-04 19:19:53.0 +0200
@@ -727,11 +727,12 @@
 /*
 header_parse() -- Break headers into seperate entries
 */
-void header_parse(FILE *stream)
+char *header_parse(FILE *stream)
 {
size_t size = BUF_SZ, len = 0;
char *p = (char *)NULL, *q;
bool_t in_header = True;
+   bool_t on_first_line = True;
char l = (char)NULL;
int c;
 
@@ -749,7 +750,15 @@
}
len++;
 
+   /* -wvh- sniff out the first line to see if it really is a 
header */
+   if (on_first_line  c == '\n'  strchr(p, ':') == (char 
*)NULL) {
+   in_header = False;
+   }
+
if(l == '\n') {
+
+   on_first_line = False;
+
switch(c) {
case ' ':
case '\t':
@@ -781,7 +790,14 @@
 
l = c;
}
+
+   if (!in_header  on_first_line) {
+   return (p);
+   }
+
(void)free(p);
+
+   return (char *)NULL;
 }
 
 /*
@@ -1319,6 +1335,7 @@
struct passwd *pw;
int i, sock;
uid_t uid;
+   char *head_body = (char *)NULL;
 
outbytes = 0;
 
@@ -1347,7 +1364,7 @@
ht = headers;
rt = rcpt_list;
 
-   header_parse(stdin);
+   head_body = header_parse(stdin);
 
 #if 1
/* With FromLineOverride=YES set, try to recover sane MAIL FROM address 
*/
@@ -1528,6 +1545,11 @@
/* End of headers, start body */
outbytes += smtp_write(sock, );
 
+   if ((char *)head_body != (char *)NULL) {
+   standardise(head_body);
+   outbytes += smtp_write(sock, %s, head_body);
+}
+
/*prevent blocking on pipes, we really shouldnt be using
  stdio functions like fgets in the first place */
fcntl(STDIN_FILENO,F_SETFL,O_NONBLOCK);


Bug#310327: patch

2005-08-26 Thread Martin Schulze
Aidas Kasparas wrote:
 Please find bellow a patch which check EOF condition instead of no
 input. Without fix for this bug package is virtually not useable (I
 experienced mysterious attachment cuts, so I can not relay on it at it's
 present form :-( Please consider importance of this bug as serious at
 the very least.
 
 --- ssmtp.c.R   2005-08-25 19:41:15.0 +0300
 +++ ssmtp.c 2005-08-25 19:45:11.0 +0300
 @@ -1532,7 +1532,13 @@
   stdio functions like fgets in the first place */
 fcntl(STDIN_FILENO,F_SETFL,O_NONBLOCK);
 
 -   while(fgets(buf, sizeof(buf), stdin)) {
 +   while(!feof(stdin)) {
 +   if (!fgets(buf, sizeof(buf), stdin)) {
 +   /* if nothing was received, then no transmission
 +* over smtp should be done */
 +   sleep(1);
 +   continue;
 +   }
 /* Trim off \n, double leading .'s */
 standardise(buf);
 
 - 8 

Upon investigation of this problem I noticed that ssmtp (oldstable
and stable) always strips the last line of the input before sending.

gluck!joey(pts/4):~ seq 1 10|sendmail [EMAIL PROTECTED]

-- 1..9

gluck!joey(pts/4):~ echo seq 1 10|sendmail [EMAIL PROTECTED]

-- no lines

This is not fixed by the above patch.

Regards,

Joey

-- 
WARNING: Do not execute!  This call violates patent DE10108564.
http://www.elug.de/projekte/patent-party/patente/DE10108564

wget -O patinfo-`date +%Y%m%d`.html http://patinfo.ffii.org/

Please always Cc to me when replying to me on the lists.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#310327: patch

2005-08-25 Thread Aidas Kasparas
Please find bellow a patch which check EOF condition instead of no
input. Without fix for this bug package is virtually not useable (I
experienced mysterious attachment cuts, so I can not relay on it at it's
present form :-( Please consider importance of this bug as serious at
the very least.

--- ssmtp.c.R   2005-08-25 19:41:15.0 +0300
+++ ssmtp.c 2005-08-25 19:45:11.0 +0300
@@ -1532,7 +1532,13 @@
  stdio functions like fgets in the first place */
fcntl(STDIN_FILENO,F_SETFL,O_NONBLOCK);

-   while(fgets(buf, sizeof(buf), stdin)) {
+   while(!feof(stdin)) {
+   if (!fgets(buf, sizeof(buf), stdin)) {
+   /* if nothing was received, then no transmission
+* over smtp should be done */
+   sleep(1);
+   continue;
+   }
/* Trim off \n, double leading .'s */
standardise(buf);

- 8 



-- 
Aidas Kasparas
IT administrator
GM Consult Group, UAB


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]