Re: [Evolution-hackers] known bugs in gpg support?



did some digging and it seems that my first impression of the problem
was *almost right*.  I had been thinking that we were passing the last
\n before the boundary (which really belongs to the boundary, so we
should not be doing that) but it actually turns out the canon filter
code would always just add a \r\n to the end of the stream even if the
higher-level code did provided a stream that did not end with \n

however, that was not the only problem... I discovered in my testing
that the code was in fact dropping the entire last line when sending it
to gpg because the last line did not end with a \n, and so it was saved
in the backup buffer of the canon filter waiting for a
filter_complete().

the filter_complete(), however, would never come because:
1) all of the data had been read from the src stream
2) filter_stream->priv->filteredlen == 0, meaning that the filter_stream
did not have any data in its own buffer.

to fix this, I just fixed camel-stream-filter.c:do_eos() to check for
buffered data in any of the filters in the chain. if there was data
there, then eos == FALSE.

attached are patches for 1.2 and 1.3 - it seems when I backported a
patch from 1.3 to 1.2 (or vise versa?) and extra blank line made it in
there and so the 1.3 patch will not apply cleanly to the 1-2-branch, so
I made 2 patches. both are identical except for that minor difference.

Michael (NotZed): The only change I'm not 100% sure about is the removal
of the code in camel-mime-filter-canon.c:filter_complete() that added
\r\n to the stream. As far as I can tell, it should not be needed since
filter_filter() works on a line-by-line basis and so any remaining
buffered data *should* be an incomplete line and thus never contain a
\n, and so I *think* my removal of that code is fine.

Jeff

On Wed, 2003-02-26 at 12:19, Adrian 'Dagurashibanipal' von Bidder wrote:
> [cc:s please, I'm not on the list anymore]
> 
> Hi,
> 
> Does evo 1.2.2 (Debian pkg) contain any known interworking issues with
> mutt 1.5.3 and gpg signatures? I thought the issues had all been fixed
> with 1.2.1 --> 1.2.2 upgrade.
> 
> (sorry for the attachment, but I thought it's only 1.5k so it won't
> hurt)
> 
> cheers
> -- vbi
-- 
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com  - www.ximian.com
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.1747
diff -u -r1.1747 ChangeLog
--- ChangeLog	26 Feb 2003 22:51:02 -0000	1.1747
+++ ChangeLog	26 Feb 2003 23:14:18 -0000
@@ -1,2 +1,13 @@
+2003-02-26  Jeffrey Stedfast  <fejj ximian com>
+
+	* camel-mime-filter-canon.c (complete): Don't add a eol -
+	otherwise we will fail to verify some mutt signatures that do not
+	have a blank line before the boundary line (and note that the last
+	\n before the boundary really belongs to the boundary anyway).
+
+	* camel-stream-filter.c (do_eos): Make sure there is not any
+	unfiltered data in any of the filters before returning eos as
+	TRUE.
+
 2003-02-26  Jeffrey Stedfast  <fejj ximian com>
 
Index: camel-mime-filter-canon.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-mime-filter-canon.c,v
retrieving revision 1.3
diff -u -r1.3 camel-mime-filter-canon.c
--- camel-mime-filter-canon.c	21 Jan 2003 16:38:53 -0000	1.3
+++ camel-mime-filter-canon.c	26 Feb 2003 23:14:19 -0000
@@ -26,6 +26,7 @@
 #include <config.h>
 #endif
 
+#include <stdio.h>
 #include <string.h>
 #include <ctype.h>
 
@@ -170,7 +171,7 @@
 	if (len)
 		filter(f, in, len, prespace, out, outlen, outprespace);
 
-	/* the data didn't contain an eol or was too short for "From ", we only need to check for "From" and add an eol */
+	/* the data didn't contain an eol or was too short for "From ", we only need to check for "From" */
 	if (f->backlen) {
 		inptr = (unsigned char *)f->backbuf;
 		inend = (unsigned char *)f->backbuf + f->backlen;
@@ -195,19 +196,6 @@
 			while (o>starto && (o[-1] == ' ' || o[-1] == '\t' || o[-1]=='\r'))
 				o--;
 		}
-		/* check end of line canonicalisation */
-		if (o>starto) {
-			if (flags & CAMEL_MIME_FILTER_CANON_CRLF) {
-				if (o[-1] != '\r')
-					*o++ = '\r';
-			} else {
-				if (o[-1] == '\r')
-					o--;
-			}
-		}
-		
-		/* and always finish with an eol */
-		*o++ = '\n';
 		
 		*outlen = o - *out;
 		
Index: camel-stream-filter.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-stream-filter.c,v
retrieving revision 1.24
diff -u -r1.24 camel-stream-filter.c
--- camel-stream-filter.c	19 Jul 2002 11:25:02 -0000	1.24
+++ camel-stream-filter.c	26 Feb 2003 23:14:19 -0000
@@ -19,11 +19,16 @@
  * Boston, MA 02111-1307, USA.
  */
 
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
 #include <string.h>
 #include "camel-stream-filter.h"
 
 #define d(x)
-/*#include <stdio.h>*/
 
 /* use my malloc debugger? */
 /*extern void g_check(void *mp);*/
@@ -368,10 +373,18 @@
 {
 	CamelStreamFilter *filter = (CamelStreamFilter *)stream;
 	struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
-
+	struct _filter *f;
+	
 	if (p->filteredlen > 0)
 		return FALSE;
-
+	
+	f = p->filters;
+	while (f) {
+		if (f->filter->backlen > 0)
+			return FALSE;
+		f = f->next;
+	}
+	
 	return camel_stream_eos(filter->source);
 }
 
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.1681.2.9
diff -u -r1.1681.2.9 ChangeLog
--- ChangeLog	24 Feb 2003 03:48:29 -0000	1.1681.2.9
+++ ChangeLog	26 Feb 2003 23:12:09 -0000
@@ -1,3 +1,14 @@
+2003-02-26  Jeffrey Stedfast  <fejj ximian com>
+
+	* camel-mime-filter-canon.c (complete): Don't add a eol -
+	otherwise we will fail to verify some mutt signatures that do not
+	have a blank line before the boundary line (and note that the last
+	\n before the boundary really belongs to the boundary anyway).
+
+	* camel-stream-filter.c (do_eos): Make sure there is not any
+	unfiltered data in any of the filters before returning eos as
+	TRUE.
+
 2003-02-22  Jeffrey Stedfast  <fejj ximian com>
 
 	* providers/sendmail/camel-sendmail-transport.c
Index: camel-mime-filter-canon.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-mime-filter-canon.c,v
retrieving revision 1.2.8.1
diff -u -r1.2.8.1 camel-mime-filter-canon.c
--- camel-mime-filter-canon.c	21 Jan 2003 03:07:05 -0000	1.2.8.1
+++ camel-mime-filter-canon.c	26 Feb 2003 23:12:09 -0000
@@ -26,6 +26,7 @@
 #include <config.h>
 #endif
 
+#include <stdio.h>
 #include <string.h>
 #include <ctype.h>
 
@@ -170,7 +171,7 @@
 	if (len)
 		filter(f, in, len, prespace, out, outlen, outprespace);
 
-	/* the data didn't contain an eol or was too short for "From ", we only need to check for "From" and add an eol */
+	/* the data didn't contain an eol or was too short for "From ", we only need to check for "From" */
 	if (f->backlen) {
 		inptr = (unsigned char *)f->backbuf;
 		inend = (unsigned char *)f->backbuf + f->backlen;
@@ -195,20 +196,7 @@
 			while (o>starto && (o[-1] == ' ' || o[-1] == '\t' || o[-1]=='\r'))
 				o--;
 		}
-		/* check end of line canonicalisation */
-		if (o>starto) {
-			if (flags & CAMEL_MIME_FILTER_CANON_CRLF) {
-				if (o[-1] != '\r')
-					*o++ = '\r';
-			} else {
-				if (o[-1] == '\r')
-					o--;
-			}
-		}
-
-		/* and always finish with an eol */
-		*o++ = '\n';
-
+		
 		*outlen = o - *out;
 		
 		f->backlen = 0;
Index: camel-stream-filter.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-stream-filter.c,v
retrieving revision 1.24
diff -u -r1.24 camel-stream-filter.c
--- camel-stream-filter.c	19 Jul 2002 11:25:02 -0000	1.24
+++ camel-stream-filter.c	26 Feb 2003 23:12:10 -0000
@@ -19,11 +19,16 @@
  * Boston, MA 02111-1307, USA.
  */
 
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
 #include <string.h>
 #include "camel-stream-filter.h"
 
 #define d(x)
-/*#include <stdio.h>*/
 
 /* use my malloc debugger? */
 /*extern void g_check(void *mp);*/
@@ -368,10 +373,18 @@
 {
 	CamelStreamFilter *filter = (CamelStreamFilter *)stream;
 	struct _CamelStreamFilterPrivate *p = _PRIVATE(filter);
-
+	struct _filter *f;
+	
 	if (p->filteredlen > 0)
 		return FALSE;
-
+	
+	f = p->filters;
+	while (f) {
+		if (f->filter->backlen > 0)
+			return FALSE;
+		f = f->next;
+	}
+	
 	return camel_stream_eos(filter->source);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]