[rt-devel] Decoding of Subjects broken in 3.0.3pre3 (3.0.3pre2 was OK)

Dmitry Sivachenko mitya at cavia.pp.ru
Fri Jun 13 05:57:24 EDT 2003


On Wed, Jun 11, 2003 at 01:43:46PM -0400, Jesse Vincent wrote:
> Interesting.  What if you back it out just for the Subject, but leave it
> in for the Headers?  The problem we're trying to solve is that _some_
> mail readers send headers containing _unencoded_ non-ascii character
> sets, which makes postgres go down in flames. Which is clearly not what
> we want ;)

When I back this patch out only for Subject (see diff between 3.0.3pre3 and
my current version attached), I get the following error:

# perl -c Attachment_Overlay.pm
Bareword "Encode::FB_PERLQQ" not allowed while "strict subs" in use at Attachmen
t_Overlay.pm line 145.
Bareword "Encode::FB_PERLQQ" not allowed while "strict subs" in use at Attachmen
t_Overlay.pm line 222.
Attachment_Overlay.pm had compilation errors.

Could you please send me a correct patch for testing?


I see your intention to fix the case when e-mail contains unencoded non-ascii
characters, we also faced the same problem.

I propose we should pass such headers to Encode::Guess, as we do for
e-mail body.



Thanks!

> 
> 
> On Wed, Jun 11, 2003 at 04:47:33PM +0400, Dmitry Sivachenko wrote:
> > Hello!
> > 
> > In 3.0.3pre3 you committed the following patch.  It broke charset recongizing
> > of Subjects like =?koi8-r?B?1MXT1A==?=
> > This perfectly valid subject, but after RT processing it becomes '????????'.
> > 
> > When I rollback the following patch, everythink becomes OK.
> > 
> > Please fix!
> > 
> > 
> > Thanks!!!
> > 
> > 
> > 
> > --- rt-3-0-3pre2/lib/RT/Attachment_Overlay.pm   Thu Jun  5 01:22:36 2003
> > +++ rt-3-0-3pre3/lib/RT/Attachment_Overlay.pm   Wed Jun 11 00:17:58 2003
> > @@ -146,8 +146,11 @@
> >              TransactionId => $args{'TransactionId'},
> >              Parent        => 0,
> >              ContentType   => $Attachment->mime_type,
> > -            Headers       => $Attachment->head->as_string,
> > -            Subject       => $Subject,
> > +
> > +            # We need to untaint the data here, because there's a high likelyho
> > od that some incompetent MUA
> > +            # Author will try to put bogus non-ascii data in a message header.
> > +            Headers => Encode::encode( utf8 => $Attachment->head->as_string, En
> > code::FB_PERLQQ ),
> > +            Subject => Encode::encode( utf8 => $Subject, Encode::FB_PERLQQ )
> > 
> >          );
> >          foreach my $part ( $Attachment->parts ) {
> > @@ -219,14 +222,15 @@
> >              $Body = MIME::Base64::encode_base64($Body);
> > 
> >          }
> > -
> >          my $id = $self->SUPER::Create( TransactionId => $args{'TransactionId'},
> >                                         ContentType   => $Attachment->mime_type,
> >                                         ContentEncoding => $ContentEncoding,
> >                                         Parent          => $args{'Parent'},
> > +                                       # We need to untaint the data here, beca
> > use there's a high likelyhood that some incompetent MUA
> > +                                       # Author will try to put bogus non-ascii
> >  data in a message header.
> > +                                       Headers       => Encode::encode(utf8 =>
> > $Attachment->head->as_string, Encode::FB_PERLQQ),
> > +                                       Subject       => Encode::encode(utf8 =>
> > $Subject, Encode::FB_PERLQQ),
> >                                         Content         => $Body,
> > -                                       Headers  => $Attachment->head->as_string
> > ,
> > -                                       Subject  => $Subject,
> >                                         Filename => $Filename, );
> >          return ($id);
> >      }
> > _______________________________________________
> > rt-devel mailing list
> > rt-devel at lists.fsck.com
> > http://lists.fsck.com/mailman/listinfo/rt-devel
> > 
> 
> -- 
> http://www.bestpractical.com/rt  -- Trouble Ticketing. Free.
> _______________________________________________
> rt-devel mailing list
> rt-devel at lists.fsck.com
> http://lists.fsck.com/mailman/listinfo/rt-devel
> 
-------------- next part --------------
--- /usr/ports/distfiles/rt-3-0-3pre3/lib/RT/Attachment_Overlay.pm	Wed Jun 11 00:17:58 2003
+++ Attachment_Overlay.pm	Fri Jun 13 13:51:32 2003
@@ -146,11 +146,8 @@
             TransactionId => $args{'TransactionId'},
             Parent        => 0,
             ContentType   => $Attachment->mime_type,
-
-            # We need to untaint the data here, because there's a high likelyhood that some incompetent MUA
-            # Author will try to put bogus non-ascii data in a message header.
-            Headers => Encode::encode( utf8 => $Attachment->head->as_string, Encode::FB_PERLQQ ),
-            Subject => Encode::encode( utf8 => $Subject, Encode::FB_PERLQQ )
+	    Headers => Encode::encode( utf8 => $Attachment->head->as_string, Encode::FB_PERLQQ ),
+	    Subject       => $Subject,
 
         );
         foreach my $part ( $Attachment->parts ) {
@@ -226,11 +223,9 @@
                                        ContentType   => $Attachment->mime_type,
                                        ContentEncoding => $ContentEncoding,
                                        Parent          => $args{'Parent'},
-                                       # We need to untaint the data here, because there's a high likelyhood that some incompetent MUA
-                                       # Author will try to put bogus non-ascii data in a message header.
-                                       Headers       => Encode::encode(utf8 => $Attachment->head->as_string, Encode::FB_PERLQQ),
-                                       Subject       => Encode::encode(utf8 => $Subject, Encode::FB_PERLQQ),
                                        Content         => $Body,
+					Headers       => Encode::encode(utf8 => $Attachment->head->as_string, Encode::FB_PERLQQ),
+					Subject  => $Subject,
                                        Filename => $Filename, );
         return ($id);
     }


More information about the Rt-devel mailing list